aboutsummaryrefslogtreecommitdiff
path: root/weed/filer2/filechunks.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/filer2/filechunks.go')
-rw-r--r--weed/filer2/filechunks.go15
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