aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-12-21 21:18:34 -0800
committerChris Lu <chris.lu@gmail.com>2020-12-21 21:18:34 -0800
commit65cc6dc6360950c70e3d2a3f9d65ce05c7e75344 (patch)
tree8d362bf5be336aa03cd7f5924ae7caf42fe57f20
parent488c2680e86555a84951838940dba4f3391a3904 (diff)
downloadseaweedfs-65cc6dc6360950c70e3d2a3f9d65ce05c7e75344.tar.xz
seaweedfs-65cc6dc6360950c70e3d2a3f9d65ce05c7e75344.zip
refactor to dedicated function
-rw-r--r--weed/filer/filerstore.go22
1 files changed, 13 insertions, 9 deletions
diff --git a/weed/filer/filerstore.go b/weed/filer/filerstore.go
index 072772b4c..afb9a5998 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)
}