Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

trivial refactoring

Chris Lucda2a6b51014
diff --git a/go/storage/volume.go b/go/storage/volume.go
index d7aa8dcd96..f3cfe2194f 100644
--- a/go/storage/volume.go
+++ b/go/storage/volume.go
@@ -53,14 +53,17 @@ func loadVolumeWithoutIndex(dirname string, collection string, id VolumeId) (v *
e = v.load(false)
return
}
+func (v *Volume) FileName() (fileName string) {
+ if v.Collection == "" {
+ fileName = path.Join(v.dir, v.Id.String())
+ } else {
+ fileName = path.Join(v.dir, v.Collection+"_"+v.Id.String())
+ }
+ return
+}
func (v *Volume) load(alsoLoadIndex bool) error {
var e error
- var fileName string
- if v.Collection == "" {
- fileName = path.Join(v.dir, v.Id.String())
- } else {
- fileName = path.Join(v.dir, v.Collection+"_"+v.Id.String())
- }
+ fileName := v.FileName()
if exists, canRead, canWrite, _ := checkFile(fileName + ".dat"); exists && !canRead {
return fmt.Errorf("cannot read Volume Data file %s.dat", fileName)
} else if !exists || canWrite {