xl: Rename 'xl.json' to 'file.json' (#1461)

Fixes #1460
master
Harshavardhana 9 years ago committed by Anand Babu (AB) Periasamy
parent ac7a7cec20
commit ad8e27a963
  1. 6
      file-json.md
  2. 8
      xl-erasure-v1-common.go
  3. 14
      xl-erasure-v1.go

@ -1,6 +1,6 @@
### xl.json
### file.json
``xl.json`` is a special file captured and written by XL storage API layer
``file.json`` is a special file captured and written by XL storage API layer
to interpret, manage and extract erasured data to multiple disks.
```json
@ -9,6 +9,7 @@ to interpret, manage and extract erasured data to multiple disks.
"stat": {
"size": 24256,
"modTime": "2016-04-28T00:11:37.843Z",
"delete": false,
"version": 0
},
"erasure": {
@ -30,6 +31,7 @@ to interpret, manage and extract erasured data to multiple disks.
- "size" // Size of the file.
- "modTime" // Modified time of the file.
- "deleted" // Field to track if the file is deleted when disks are down.
- "version" // File version tracked when disks are down.
- "erasure" // Erasure metadata for the written file.

@ -112,7 +112,7 @@ func (xl XL) listOnlineDisks(volume, path string) (onlineDisks []StorageAPI, mda
return onlineDisks, mdata, heal, nil
}
// Get xl.json metadata as a map slice.
// Get file.json metadata as a map slice.
// Returns error slice indicating the failed metadata reads.
// Read lockNS() should be done by caller.
func (xl XL) getPartsMetadata(volume, path string) ([]xlMetaV1, []error) {
@ -130,7 +130,7 @@ func (xl XL) getPartsMetadata(volume, path string) ([]xlMetaV1, []error) {
metadata, err := xlMetaV1Decode(metadataReader)
if err != nil {
// Unable to parse xl.json, set error.
// Unable to parse file.json, set error.
errs[index] = err
continue
}
@ -139,8 +139,8 @@ func (xl XL) getPartsMetadata(volume, path string) ([]xlMetaV1, []error) {
return metadataArray, errs
}
// Writes/Updates `xl.json` for given file. updateParts carries
// index of disks where `xl.json` needs to be updated.
// Writes/Updates `file.json` for given file. updateParts carries
// index of disks where `file.json` needs to be updated.
//
// Returns collection of errors, indexed in accordance with input
// updateParts order.

@ -29,8 +29,8 @@ import (
)
const (
// Part metadata file.
xlMetaV1File = "xl.json"
// XL erasure metadata file.
xlMetaV1File = "file.json"
// Maximum erasure blocks.
maxErasureBlocks = 16
)
@ -590,7 +590,7 @@ func listFiles(disk StorageAPI, volume, prefix, marker string, recursive bool, c
markerPath = fsFilesInfo[len(fsFilesInfo)-1].Name
}
if count == 0 && recursive && !strings.HasSuffix(markerPath, xlMetaV1File) {
// If last entry is not xl.json then loop once more to check if we have reached eof.
// If last entry is not file.json then loop once more to check if we have reached eof.
fsFilesInfo, eof, err = disk.ListFiles(volume, prefix, markerPath, recursive, 1)
if err != nil {
log.WithFields(logrus.Fields{
@ -603,17 +603,17 @@ func listFiles(disk StorageAPI, volume, prefix, marker string, recursive bool, c
return nil, true, err
}
if !eof {
// file.N and xl.json are always in pairs and hence this
// entry has to be xl.json. If not better to manually investigate
// file.N and file.json are always in pairs and hence this
// entry has to be file.json. If not better to manually investigate
// and fix it.
// For the next ListFiles() call we can safely assume that the
// marker is "object/xl.json"
// marker is "object/file.json"
if !strings.HasSuffix(fsFilesInfo[0].Name, xlMetaV1File) {
log.WithFields(logrus.Fields{
"volume": volume,
"prefix": prefix,
"fsFileInfo.Name": fsFilesInfo[0].Name,
}).Errorf("ListFiles failed with %s, expected %s to be a xl.json file.", err, fsFilesInfo[0].Name)
}).Errorf("ListFiles failed with %s, expected %s to be a file.json file.", err, fsFilesInfo[0].Name)
return nil, true, errUnexpected
}
}

Loading…
Cancel
Save