XL/metadata: use new hashOrder algorithm for newXLMeta. (#2147)

master
Harshavardhana 8 years ago
parent 63b3f1dcfd
commit 6266328a85
  1. 6
      .travis.yml
  2. 7
      xl-v1-metadata.go
  3. 2
      xl-v1-metadata_test.go
  4. 2
      xl-v1-multipart.go
  5. 2
      xl-v1-object.go

@ -4,9 +4,9 @@ language: go
os:
- linux
## Turning off for now.
# - osx
# osx_image: xcode7.2
- osx
osx_image: xcode7.2
env:
- ARCH=x86_64

@ -107,9 +107,8 @@ type xlMetaV1 struct {
Parts []objectPartInfo `json:"parts,omitempty"`
}
// newXLMetaV1 - initializes new xlMetaV1, adds version, allocates a
// fresh erasure info.
func newXLMetaV1(dataBlocks, parityBlocks int) (xlMeta xlMetaV1) {
// newXLMetaV1 - initializes new xlMetaV1, adds version, allocates a fresh erasure info.
func newXLMetaV1(object string, dataBlocks, parityBlocks int) (xlMeta xlMetaV1) {
xlMeta = xlMetaV1{}
xlMeta.Version = "1.0.0"
xlMeta.Format = "xl"
@ -119,7 +118,7 @@ func newXLMetaV1(dataBlocks, parityBlocks int) (xlMeta xlMetaV1) {
DataBlocks: dataBlocks,
ParityBlocks: parityBlocks,
BlockSize: blockSizeV1,
Distribution: hashOrder(time.Now().UTC().String(), dataBlocks+parityBlocks),
Distribution: hashOrder(object, dataBlocks+parityBlocks),
}
return xlMeta
}

@ -39,7 +39,7 @@ func TestXLMetaV1(t *testing.T) {
}
// Create a XLMetaV1 structure to test on.
meta := newXLMetaV1(8, 8)
meta := newXLMetaV1("minio", 8, 8)
// Add 5 parts.
for _, test := range testCases {

@ -252,7 +252,7 @@ func (xl xlObjects) ListMultipartUploads(bucket, prefix, keyMarker, uploadIDMark
// all the disks. `uploads.json` carries metadata regarding on going
// multipart operation on the object.
func (xl xlObjects) newMultipartUpload(bucket string, object string, meta map[string]string) (uploadID string, err error) {
xlMeta := newXLMetaV1(xl.dataBlocks, xl.parityBlocks)
xlMeta := newXLMetaV1(object, xl.dataBlocks, xl.parityBlocks)
// If not set default to "application/octet-stream"
if meta["content-type"] == "" {
contentType := "application/octet-stream"

@ -368,7 +368,7 @@ func (xl xlObjects) PutObject(bucket string, object string, size int64, data io.
tempObj := uniqueID
// Initialize xl meta.
xlMeta := newXLMetaV1(xl.dataBlocks, xl.parityBlocks)
xlMeta := newXLMetaV1(object, xl.dataBlocks, xl.parityBlocks)
// Read metadata associated with the object from all disks.
partsMetadata, errs := xl.readAllXLMetadata(bucket, object)

Loading…
Cancel
Save