fs: Enable returning ETag along with ListObjects() (#4042)

This is to comply with S3 behavior, we previously removed
reading `fs.json` for optimization reasons but we have a
reason to believe that providing ETag and using gjson
provides needed benefit of not having to deal with
unmarshalling overhead of golang stdlib.

Fixes #4028
This commit is contained in:
Harshavardhana
2017-04-04 09:14:03 -07:00
committed by GitHub
parent 52d8f564bf
commit 4747adfcb4
5 changed files with 127 additions and 34 deletions

View File

@@ -81,7 +81,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
IsTruncated: false,
Objects: []ObjectInfo{
{Name: "Asia-maps.png", ContentType: "image/png"},
{Name: "Asia-maps.png"},
{Name: "Asia/India/India-summer-photos-1"},
{Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"},
{Name: "newPrefix0"},
@@ -97,7 +97,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
IsTruncated: true,
Objects: []ObjectInfo{
{Name: "Asia-maps.png", ContentType: "image/png"},
{Name: "Asia-maps.png"},
{Name: "Asia/India/India-summer-photos-1"},
{Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"},
{Name: "newPrefix0"},
@@ -109,7 +109,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
IsTruncated: true,
Objects: []ObjectInfo{
{Name: "Asia-maps.png", ContentType: "image/png"},
{Name: "Asia-maps.png"},
{Name: "Asia/India/India-summer-photos-1"},
{Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"},
{Name: "newPrefix0"},
@@ -120,7 +120,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
IsTruncated: true,
Objects: []ObjectInfo{
{Name: "Asia-maps.png", ContentType: "image/png"},
{Name: "Asia-maps.png"},
{Name: "Asia/India/India-summer-photos-1"},
{Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"},
},
@@ -131,7 +131,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
IsTruncated: true,
Objects: []ObjectInfo{
{Name: "Asia-maps.png", ContentType: "image/png"},
{Name: "Asia-maps.png"},
},
},
// ListObjectsResult-5.
@@ -234,7 +234,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
IsTruncated: false,
Objects: []ObjectInfo{
{Name: "Asia-maps.png", ContentType: "image/png"},
{Name: "Asia-maps.png"},
{Name: "Asia/India/India-summer-photos-1"},
{Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"},
{Name: "newPrefix0"},
@@ -343,7 +343,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
IsTruncated: false,
Objects: []ObjectInfo{
{Name: "Asia-maps.png", ContentType: "image/png"},
{Name: "Asia-maps.png"},
{Name: "Asia/India/India-summer-photos-1"},
{Name: "Asia/India/Karnataka/Bangalore/Koramangala/pics"},
},
@@ -354,7 +354,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{
IsTruncated: false,
Objects: []ObjectInfo{
{Name: "Asia-maps.png", ContentType: "image/png"},
{Name: "Asia-maps.png"},
},
},
// ListObjectsResult-26.
@@ -549,8 +549,8 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
if testCase.result.Objects[j].Name != result.Objects[j].Name {
t.Errorf("Test %d: %s: Expected object name to be \"%s\", but found \"%s\" instead", i+1, instanceType, testCase.result.Objects[j].Name, result.Objects[j].Name)
}
if testCase.result.Objects[j].ContentType != result.Objects[j].ContentType {
t.Errorf("Test %d: %s: Expected object contentType to be \"%s\", but found \"%s\" instead", i+1, instanceType, testCase.result.Objects[j].ContentType, result.Objects[j].ContentType)
if result.Objects[j].MD5Sum == "" {
t.Errorf("Test %d: %s: Expected md5sum to be not empty, but found empty instead", i+1, instanceType)
}
}