add s3 multipart upload

This commit is contained in:
Chris Lu
2018-09-09 16:25:43 -07:00
parent 9b3bf0e46c
commit 164091c269
13 changed files with 266 additions and 96 deletions

View File

@@ -3,6 +3,8 @@ package filer2
import (
"math"
"sort"
"hash/fnv"
"fmt"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
)
@@ -17,6 +19,18 @@ func TotalSize(chunks []*filer_pb.FileChunk) (size uint64) {
return
}
func ETag(chunks []*filer_pb.FileChunk) (etag string) {
if len(chunks) == 1 {
return chunks[0].ETag
}
h := fnv.New32a()
for _, c := range chunks {
h.Write([]byte(c.ETag))
}
return fmt.Sprintf("%x", h.Sum32())
}
func CompactFileChunks(chunks []*filer_pb.FileChunk) (compacted, garbage []*filer_pb.FileChunk) {
visibles := nonOverlappingVisibleIntervals(chunks)