Support bucket versioning (#9377)

- Implement a new xl.json 2.0.0 format to support,
  this moves the entire marshaling logic to POSIX
  layer, top layer always consumes a common FileInfo
  construct which simplifies the metadata reads.
- Implement list object versions
- Migrate to siphash from crchash for new deployments
  for object placements.

Fixes #2111
This commit is contained in:
Harshavardhana
2020-06-12 20:04:01 -07:00
committed by GitHub
parent 43d6e3ae06
commit 4915433bd2
203 changed files with 13833 additions and 6919 deletions

View File

@@ -191,7 +191,7 @@ func testStorageAPIDeleteVol(t *testing.T, storage StorageAPI) {
}
}
func testStorageAPIStatFile(t *testing.T, storage StorageAPI) {
func testStorageAPICheckFile(t *testing.T, storage StorageAPI) {
tmpGlobalServerConfig := globalServerConfig
defer func() {
globalServerConfig = tmpGlobalServerConfig
@@ -202,7 +202,7 @@ func testStorageAPIStatFile(t *testing.T, storage StorageAPI) {
if err != nil {
t.Fatalf("unexpected error %v", err)
}
err = storage.AppendFile("foo", "myobject", []byte("foo"))
err = storage.AppendFile("foo", pathJoin("myobject", xlStorageFormatFile), []byte("foo"))
if err != nil {
t.Fatalf("unexpected error %v", err)
}
@@ -218,18 +218,12 @@ func testStorageAPIStatFile(t *testing.T, storage StorageAPI) {
}
for i, testCase := range testCases {
result, err := storage.StatFile(testCase.volumeName, testCase.objectName)
err := storage.CheckFile(testCase.volumeName, testCase.objectName)
expectErr := (err != nil)
if expectErr != testCase.expectErr {
t.Fatalf("case %v: error: expected: %v, got: %v", i+1, testCase.expectErr, expectErr)
}
if !testCase.expectErr {
if result.Name != testCase.objectName {
t.Fatalf("case %v: result: expected: %+v, got: %+v", i+1, testCase.objectName, result.Name)
}
}
}
}
@@ -261,7 +255,7 @@ func testStorageAPIListDir(t *testing.T, storage StorageAPI) {
}
for i, testCase := range testCases {
result, err := storage.ListDir(testCase.volumeName, testCase.prefix, -1, "")
result, err := storage.ListDir(testCase.volumeName, testCase.prefix, -1)
expectErr := (err != nil)
if expectErr != testCase.expectErr {
@@ -586,7 +580,7 @@ func TestStorageRESTClientDeleteVol(t *testing.T) {
testStorageAPIDeleteVol(t, restClient)
}
func TestStorageRESTClientStatFile(t *testing.T) {
func TestStorageRESTClientCheckFile(t *testing.T) {
httpServer, restClient, prevGlobalServerConfig, endpointPath := newStorageRESTHTTPServerClient(t)
defer httpServer.Close()
defer func() {
@@ -594,7 +588,7 @@ func TestStorageRESTClientStatFile(t *testing.T) {
}()
defer os.RemoveAll(endpointPath)
testStorageAPIStatFile(t, restClient)
testStorageAPICheckFile(t, restClient)
}
func TestStorageRESTClientListDir(t *testing.T) {