diff options
| author | Chris Lu <chris.lu@gmail.com> | 2018-05-22 03:26:38 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2018-05-22 03:26:38 -0700 |
| commit | 7362de9a1895744a42931a8ccbdc5f8e4e2306b6 (patch) | |
| tree | 2f17355ecc2b727bebae9ce90526eb874dfe20a4 /weed/filer2/filechunks.go | |
| parent | 9dd228747cd2f6e7f61168e1f394a320bf542623 (diff) | |
| download | seaweedfs-7362de9a1895744a42931a8ccbdc5f8e4e2306b6.tar.xz seaweedfs-7362de9a1895744a42931a8ccbdc5f8e4e2306b6.zip | |
weed mount can work well
TODO: somehow filer url is returning empty content
Diffstat (limited to 'weed/filer2/filechunks.go')
| -rw-r--r-- | weed/filer2/filechunks.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/weed/filer2/filechunks.go b/weed/filer2/filechunks.go index 714bdab9c..834e014d9 100644 --- a/weed/filer2/filechunks.go +++ b/weed/filer2/filechunks.go @@ -37,6 +37,21 @@ func CompactFileChunks(chunks []*filer_pb.FileChunk) (compacted, garbage []*file return } +func FindUnusedFileChunks(oldChunks, newChunks []*filer_pb.FileChunk) (unused []*filer_pb.FileChunk) { + + fileIds := make(map[string]bool) + for _, interval := range newChunks { + fileIds[interval.FileId] = true + } + for _, chunk := range oldChunks { + if found := fileIds[chunk.FileId]; !found { + unused = append(unused, chunk) + } + } + + return +} + func logPrintf(name string, visibles []*visibleInterval) { // return |
