diff --git a/weed/filesys/meta_cache/meta_cache.go b/weed/filesys/meta_cache/meta_cache.go index ac193a493..06f634c72 100644 --- a/weed/filesys/meta_cache/meta_cache.go +++ b/weed/filesys/meta_cache/meta_cache.go @@ -17,7 +17,7 @@ import ( // e.g. fill fileId field for chunks type MetaCache struct { - actualStore filer.FilerStore + localStore filer.FilerStore sync.RWMutex visitedBoundary *bounded_tree.BoundedTree uidGidMapper *UidGidMapper @@ -25,7 +25,7 @@ type MetaCache struct { func NewMetaCache(dbFolder string, uidGidMapper *UidGidMapper) *MetaCache { return &MetaCache{ - actualStore: openMetaStore(dbFolder), + localStore: openMetaStore(dbFolder), visitedBoundary: bounded_tree.NewBoundedTree(), uidGidMapper: uidGidMapper, } @@ -57,7 +57,7 @@ func (mc *MetaCache) InsertEntry(ctx context.Context, entry *filer.Entry) error func (mc *MetaCache) doInsertEntry(ctx context.Context, entry *filer.Entry) error { filer_pb.BeforeEntrySerialization(entry.Chunks) - return mc.actualStore.InsertEntry(ctx, entry) + return mc.localStore.InsertEntry(ctx, entry) } func (mc *MetaCache) AtomicUpdateEntryFromFiler(ctx context.Context, oldPath util.FullPath, newEntry *filer.Entry) error { @@ -71,7 +71,7 @@ func (mc *MetaCache) AtomicUpdateEntryFromFiler(ctx context.Context, oldPath uti // skip the unnecessary deletion // leave the update to the following InsertEntry operation } else { - if err := mc.actualStore.DeleteEntry(ctx, oldPath); err != nil { + if err := mc.localStore.DeleteEntry(ctx, oldPath); err != nil { return err } } @@ -83,7 +83,7 @@ func (mc *MetaCache) AtomicUpdateEntryFromFiler(ctx context.Context, oldPath uti if newEntry != nil { newDir, _ := newEntry.DirAndName() if mc.visitedBoundary.HasVisited(util.FullPath(newDir)) { - if err := mc.actualStore.InsertEntry(ctx, newEntry); err != nil { + if err := mc.localStore.InsertEntry(ctx, newEntry); err != nil { return err } } @@ -95,13 +95,13 @@ func (mc *MetaCache) UpdateEntry(ctx context.Context, entry *filer.Entry) error mc.Lock() defer mc.Unlock() filer_pb.BeforeEntrySerialization(entry.Chunks) - return mc.actualStore.UpdateEntry(ctx, entry) + return mc.localStore.UpdateEntry(ctx, entry) } func (mc *MetaCache) FindEntry(ctx context.Context, fp util.FullPath) (entry *filer.Entry, err error) { mc.RLock() defer mc.RUnlock() - entry, err = mc.actualStore.FindEntry(ctx, fp) + entry, err = mc.localStore.FindEntry(ctx, fp) if err != nil { return nil, err } @@ -113,14 +113,14 @@ func (mc *MetaCache) FindEntry(ctx context.Context, fp util.FullPath) (entry *fi func (mc *MetaCache) DeleteEntry(ctx context.Context, fp util.FullPath) (err error) { mc.Lock() defer mc.Unlock() - return mc.actualStore.DeleteEntry(ctx, fp) + return mc.localStore.DeleteEntry(ctx, fp) } func (mc *MetaCache) ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int) ([]*filer.Entry, error) { mc.RLock() defer mc.RUnlock() - entries, err := mc.actualStore.ListDirectoryEntries(ctx, dirPath, startFileName, includeStartFile, limit) + entries, err := mc.localStore.ListDirectoryEntries(ctx, dirPath, startFileName, includeStartFile, limit) if err != nil { return nil, err } @@ -134,7 +134,7 @@ func (mc *MetaCache) ListDirectoryEntries(ctx context.Context, dirPath util.Full func (mc *MetaCache) Shutdown() { mc.Lock() defer mc.Unlock() - mc.actualStore.Shutdown() + mc.localStore.Shutdown() } func (mc *MetaCache) mapIdFromFilerToLocal(entry *filer.Entry) {