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.

refactor to dedicated function

Chris Lu65cc6dc63609
diff --git a/weed/filer/filerstore.go b/weed/filer/filerstore.go
index 072772b4c9..afb9a59980 100644
--- a/weed/filer/filerstore.go
+++ b/weed/filer/filerstore.go
@@ -94,12 +94,16 @@ func (fsw *FilerStoreWrapper) getActualStore(path util.FullPath) (store FilerSto
return
}
+func (fsw *FilerStoreWrapper) getDefaultStore() (store FilerStore) {
+ return fsw.defaultStore
+}
+
func (fsw *FilerStoreWrapper) GetName() string {
- return fsw.getActualStore("/").GetName()
+ return fsw.getDefaultStore().GetName()
}
func (fsw *FilerStoreWrapper) Initialize(configuration util.Configuration, prefix string) error {
- return fsw.getActualStore("/").Initialize(configuration, prefix)
+ return fsw.getDefaultStore().Initialize(configuration, prefix)
}
func (fsw *FilerStoreWrapper) InsertEntry(ctx context.Context, entry *Entry) error {
@@ -299,27 +303,27 @@ func (fsw *FilerStoreWrapper) prefixFilterEntries(ctx context.Context, dirPath u
}
func (fsw *FilerStoreWrapper) BeginTransaction(ctx context.Context) (context.Context, error) {
- return fsw.getActualStore("/").BeginTransaction(ctx)
+ return fsw.getDefaultStore().BeginTransaction(ctx)
}
func (fsw *FilerStoreWrapper) CommitTransaction(ctx context.Context) error {
- return fsw.getActualStore("/").CommitTransaction(ctx)
+ return fsw.getDefaultStore().CommitTransaction(ctx)
}
func (fsw *FilerStoreWrapper) RollbackTransaction(ctx context.Context) error {
- return fsw.getActualStore("/").RollbackTransaction(ctx)
+ return fsw.getDefaultStore().RollbackTransaction(ctx)
}
func (fsw *FilerStoreWrapper) Shutdown() {
- fsw.getActualStore("/").Shutdown()
+ fsw.getDefaultStore().Shutdown()
}
func (fsw *FilerStoreWrapper) KvPut(ctx context.Context, key []byte, value []byte) (err error) {
- return fsw.getActualStore("/").KvPut(ctx, key, value)
+ return fsw.getDefaultStore().KvPut(ctx, key, value)
}
func (fsw *FilerStoreWrapper) KvGet(ctx context.Context, key []byte) (value []byte, err error) {
- return fsw.getActualStore("/").KvGet(ctx, key)
+ return fsw.getDefaultStore().KvGet(ctx, key)
}
func (fsw *FilerStoreWrapper) KvDelete(ctx context.Context, key []byte) (err error) {
- return fsw.getActualStore("/").KvDelete(ctx, key)
+ return fsw.getDefaultStore().KvDelete(ctx, key)
}