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
+10 -23
View File
@@ -21,7 +21,7 @@ package cmd
import (
"io"
"os"
"strings"
"syscall"
)
// Return all the entries at the directory dirPath.
@@ -34,16 +34,7 @@ func readDir(dirPath string) (entries []string, err error) {
func readDirFilterFn(dirPath string, filter func(name string, typ os.FileMode) error) error {
d, err := os.Open(dirPath)
if err != nil {
// File is really not found.
if os.IsNotExist(err) {
return errFileNotFound
}
// File path cannot be verified since one of the parents is a file.
if strings.Contains(err.Error(), "not a directory") {
return errFileNotFound
}
return err
return osErrToFileErr(err)
}
defer d.Close()
@@ -55,7 +46,7 @@ func readDirFilterFn(dirPath string, filter func(name string, typ os.FileMode) e
if err == io.EOF {
break
}
return err
return osErrToFileErr(err)
}
for _, fi := range fis {
if err = filter(fi.Name(), fi.Mode()); err == errDoneForNow {
@@ -71,16 +62,7 @@ func readDirFilterFn(dirPath string, filter func(name string, typ os.FileMode) e
func readDirN(dirPath string, count int) (entries []string, err error) {
d, err := os.Open(dirPath)
if err != nil {
// File is really not found.
if os.IsNotExist(err) {
return nil, errFileNotFound
}
// File path cannot be verified since one of the parents is a file.
if strings.Contains(err.Error(), "not a directory") {
return nil, errFileNotFound
}
return nil, err
return nil, osErrToFileErr(err)
}
defer d.Close()
@@ -99,7 +81,7 @@ func readDirN(dirPath string, count int) (entries []string, err error) {
if err == io.EOF {
break
}
return nil, err
return nil, osErrToFileErr(err)
}
if count > 0 {
if remaining <= len(fis) {
@@ -125,3 +107,8 @@ func readDirN(dirPath string, count int) (entries []string, err error) {
}
return entries, nil
}
func globalSync() {
// no-op not sure about plan9/solaris support for syscall support
syscall.Sync()
}