mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
XL/metadata: use new hashOrder algorithm for newXLMeta. (#2147)
This commit is contained in:
parent
63b3f1dcfd
commit
6266328a85
@ -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…
Reference in New Issue
Block a user