aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/filechunks.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2023-01-10 00:46:46 -0800
committerchrislu <chris.lu@gmail.com>2023-01-10 00:46:46 -0800
commit75bdd4a0d1caa5af940397793fe0decc3da1093e (patch)
tree2f38fb005d1e81dec4d4fa57f53e6455c4fd263f /weed/filer/filechunks.go
parent51d4a4b28d0edcd01ab1faa19f8a80f4137fc497 (diff)
downloadseaweedfs-75bdd4a0d1caa5af940397793fe0decc3da1093e.tar.xz
seaweedfs-75bdd4a0d1caa5af940397793fe0decc3da1093e.zip
refactor
Diffstat (limited to 'weed/filer/filechunks.go')
-rw-r--r--weed/filer/filechunks.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/weed/filer/filechunks.go b/weed/filer/filechunks.go
index 480478fd7..7c8bb2fe1 100644
--- a/weed/filer/filechunks.go
+++ b/weed/filer/filechunks.go
@@ -86,12 +86,13 @@ func SeparateGarbageChunks(visibles *IntervalList[*VisibleInterval], chunks []*f
return compacted, garbage
}
-func FindGarbageChunks(visibles *IntervalList[*VisibleInterval], start int64, stop int64) (garbageFileId []string) {
+func FindGarbageChunks(visibles *IntervalList[*VisibleInterval], start int64, stop int64) (garbageFileIds map[string]struct{}) {
+ garbageFileIds = make(map[string]struct{})
for x := visibles.Front(); x != nil; x = x.Next {
interval := x.Value
offset := interval.start - interval.offsetInChunk
if start <= offset && offset+int64(interval.chunkSize) <= stop {
- garbageFileId = append(garbageFileId, interval.fileId)
+ garbageFileIds[interval.fileId] = struct{}{}
}
}
return