From 4db2b0331211207d620931d85e10875dcce37419 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 27 Jun 2016 21:42:33 -0700 Subject: [PATCH] XL: Rename objectN to part.N (#2019) Fixes #2015 --- docs/backend/fs/fs.json | 4 ++-- docs/backend/xl/uploads.json | 2 +- docs/backend/xl/xl.json | 16 +++++----------- fs-v1-multipart.go | 2 +- xl-v1-metadata_test.go | 10 +++++----- xl-v1-multipart.go | 4 ++-- xl-v1-object.go | 6 +++--- 7 files changed, 19 insertions(+), 25 deletions(-) diff --git a/docs/backend/fs/fs.json b/docs/backend/fs/fs.json index 3fc555bd0..c2a7c0c19 100644 --- a/docs/backend/fs/fs.json +++ b/docs/backend/fs/fs.json @@ -1,5 +1,5 @@ { - "version": "1", + "version": "1.0.0", "format": "fs", "minio": { "release": "DEVELOPMENT.GOGET" @@ -7,7 +7,7 @@ "parts": [ { "number": 1, - "name": "object1", + "name": "part.1", "size": 29, "eTag": "", }, diff --git a/docs/backend/xl/uploads.json b/docs/backend/xl/uploads.json index 301f731ec..b8f2e921c 100644 --- a/docs/backend/xl/uploads.json +++ b/docs/backend/xl/uploads.json @@ -1,5 +1,5 @@ { - "version": "1", + "version": "1.0.0", "format": "xl", "uploadIds": [ { diff --git a/docs/backend/xl/xl.json b/docs/backend/xl/xl.json index 08db8c07c..0c6435c1c 100644 --- a/docs/backend/xl/xl.json +++ b/docs/backend/xl/xl.json @@ -4,19 +4,13 @@ "number": 1, "size": 5242880, "etag": "3565c6e741e69a007a5ac7db893a62b5", - "name": "object1" + "name": "part.1" }, { "number": 2, "size": 5242880, "etag": "d416712335c280ab1e39498552937764", - "name": "object2" - }, - { - "number": 3, - "size": 4338324, - "etag": "8a98c5c54d81c6c95ed9bdcaeb941aaf", - "name": "object3" + "name": "part.2" } ], "meta": { @@ -36,12 +30,12 @@ "data": 5, "checksum": [ { - "name": "object1", + "name": "part.1", "algorithm": "blake2b", "hash": "173c2cda7fb9e2798f91ba10135b65475fd2b97684355b328941d1c470a37549502672b2b4630c8268d5e5f79c8eb2fe433a25c6368f31d75b2c0504e3104c0e", }, { - "name": "object2", + "name": "part.2", "algorithm": "blake2b", "hash": "14f9ba0006b2db7cd171507e79032ad3a34eab7df02b6564c487614b6d1e6613343a4f56074aa3473ac9c3b26e00cbbeae937d478cca4cfb138e72838ebb0826", }, @@ -53,5 +47,5 @@ "size": 14824084 }, "format": "xl", - "version": "1" + "version": "1.0.0" } diff --git a/fs-v1-multipart.go b/fs-v1-multipart.go index a3f4c2692..d2002d563 100644 --- a/fs-v1-multipart.go +++ b/fs-v1-multipart.go @@ -488,7 +488,7 @@ func (fs fsObjects) CompleteMultipartUpload(bucket string, object string, upload return "", err } - tempObj := path.Join(tmpMetaPrefix, uploadID, "object1") + tempObj := path.Join(tmpMetaPrefix, uploadID, "part.1") // Allocate 128KiB of staging buffer. var buf = make([]byte, readSizeV1) diff --git a/xl-v1-metadata_test.go b/xl-v1-metadata_test.go index 7f19934d4..1439b074a 100644 --- a/xl-v1-metadata_test.go +++ b/xl-v1-metadata_test.go @@ -31,11 +31,11 @@ func TestXLMetaV1(t *testing.T) { size int64 index int }{ - {5, "object5", "etag5", fiveMB + 5, 3}, - {4, "object4", "etag4", fiveMB + 4, 2}, - {7, "object7", "etag7", fiveMB + 7, 4}, - {2, "object2", "etag2", fiveMB + 2, 1}, - {1, "object1", "etag1", fiveMB + 1, 0}, + {5, "part.5", "etag5", fiveMB + 5, 3}, + {4, "part.4", "etag4", fiveMB + 4, 2}, + {7, "part.7", "etag7", fiveMB + 7, 4}, + {2, "part.2", "etag2", fiveMB + 2, 1}, + {1, "part.1", "etag1", fiveMB + 1, 0}, } // Create a XLMetaV1 structure to test on. diff --git a/xl-v1-multipart.go b/xl-v1-multipart.go index 6d1c29f51..8cdea4fac 100644 --- a/xl-v1-multipart.go +++ b/xl-v1-multipart.go @@ -334,7 +334,7 @@ func (xl xlObjects) putObjectPart(bucket string, object string, uploadID string, // Pick one from the first valid metadata. xlMeta := pickValidXLMeta(partsMetadata) - partSuffix := fmt.Sprintf("object%d", partID) + partSuffix := fmt.Sprintf("part.%d", partID) tmpPartPath := path.Join(tmpMetaPrefix, uploadID, partSuffix) // Initialize md5 writer. @@ -612,7 +612,7 @@ func (xl xlObjects) CompleteMultipartUpload(bucket string, object string, upload Number: part.PartNumber, ETag: part.ETag, Size: currentXLMeta.Parts[partIdx].Size, - Name: fmt.Sprintf("object%d", part.PartNumber), + Name: fmt.Sprintf("part.%d", part.PartNumber), } } diff --git a/xl-v1-object.go b/xl-v1-object.go index b128e1713..7c74a4593 100644 --- a/xl-v1-object.go +++ b/xl-v1-object.go @@ -304,7 +304,7 @@ func (xl xlObjects) PutObject(bucket string, object string, size int64, data io. defer nsMutex.Unlock(bucket, object) uniqueID := getUUID() - tempErasureObj := path.Join(tmpMetaPrefix, uniqueID, "object1") + tempErasureObj := path.Join(tmpMetaPrefix, uniqueID, "part.1") tempObj := path.Join(tmpMetaPrefix, uniqueID) // Initialize xl meta. @@ -342,7 +342,7 @@ func (xl xlObjects) PutObject(bucket string, object string, size int64, data io. } // Erasure code and write across all disks. - newEInfos, n, err := erasureCreateFile(onlineDisks, minioMetaBucket, tempErasureObj, "object1", teeReader, eInfos, xl.writeQuorum) + newEInfos, n, err := erasureCreateFile(onlineDisks, minioMetaBucket, tempErasureObj, "part.1", teeReader, eInfos, xl.writeQuorum) if err != nil { return "", toObjectErr(err, minioMetaBucket, tempErasureObj) } @@ -399,7 +399,7 @@ func (xl xlObjects) PutObject(bucket string, object string, size int64, data io. xlMeta.Stat.ModTime = modTime xlMeta.Stat.Version = higherVersion // Add the final part. - xlMeta.AddObjectPart(1, "object1", newMD5Hex, xlMeta.Stat.Size) + xlMeta.AddObjectPart(1, "part.1", newMD5Hex, xlMeta.Stat.Size) // Update `xl.json` content on each disks. for index := range partsMetadata {