mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
rename
This commit is contained in:
parent
3e52329cee
commit
0adbb56cc1
|
@ -17,7 +17,7 @@ import (
|
||||||
// e.g. fill fileId field for chunks
|
// e.g. fill fileId field for chunks
|
||||||
|
|
||||||
type MetaCache struct {
|
type MetaCache struct {
|
||||||
actualStore filer.FilerStore
|
localStore filer.FilerStore
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
visitedBoundary *bounded_tree.BoundedTree
|
visitedBoundary *bounded_tree.BoundedTree
|
||||||
uidGidMapper *UidGidMapper
|
uidGidMapper *UidGidMapper
|
||||||
|
@ -25,7 +25,7 @@ type MetaCache struct {
|
||||||
|
|
||||||
func NewMetaCache(dbFolder string, uidGidMapper *UidGidMapper) *MetaCache {
|
func NewMetaCache(dbFolder string, uidGidMapper *UidGidMapper) *MetaCache {
|
||||||
return &MetaCache{
|
return &MetaCache{
|
||||||
actualStore: openMetaStore(dbFolder),
|
localStore: openMetaStore(dbFolder),
|
||||||
visitedBoundary: bounded_tree.NewBoundedTree(),
|
visitedBoundary: bounded_tree.NewBoundedTree(),
|
||||||
uidGidMapper: uidGidMapper,
|
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 {
|
func (mc *MetaCache) doInsertEntry(ctx context.Context, entry *filer.Entry) error {
|
||||||
filer_pb.BeforeEntrySerialization(entry.Chunks)
|
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 {
|
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
|
// skip the unnecessary deletion
|
||||||
// leave the update to the following InsertEntry operation
|
// leave the update to the following InsertEntry operation
|
||||||
} else {
|
} else {
|
||||||
if err := mc.actualStore.DeleteEntry(ctx, oldPath); err != nil {
|
if err := mc.localStore.DeleteEntry(ctx, oldPath); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ func (mc *MetaCache) AtomicUpdateEntryFromFiler(ctx context.Context, oldPath uti
|
||||||
if newEntry != nil {
|
if newEntry != nil {
|
||||||
newDir, _ := newEntry.DirAndName()
|
newDir, _ := newEntry.DirAndName()
|
||||||
if mc.visitedBoundary.HasVisited(util.FullPath(newDir)) {
|
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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,13 +95,13 @@ func (mc *MetaCache) UpdateEntry(ctx context.Context, entry *filer.Entry) error
|
||||||
mc.Lock()
|
mc.Lock()
|
||||||
defer mc.Unlock()
|
defer mc.Unlock()
|
||||||
filer_pb.BeforeEntrySerialization(entry.Chunks)
|
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) {
|
func (mc *MetaCache) FindEntry(ctx context.Context, fp util.FullPath) (entry *filer.Entry, err error) {
|
||||||
mc.RLock()
|
mc.RLock()
|
||||||
defer mc.RUnlock()
|
defer mc.RUnlock()
|
||||||
entry, err = mc.actualStore.FindEntry(ctx, fp)
|
entry, err = mc.localStore.FindEntry(ctx, fp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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) {
|
func (mc *MetaCache) DeleteEntry(ctx context.Context, fp util.FullPath) (err error) {
|
||||||
mc.Lock()
|
mc.Lock()
|
||||||
defer mc.Unlock()
|
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) {
|
func (mc *MetaCache) ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int) ([]*filer.Entry, error) {
|
||||||
mc.RLock()
|
mc.RLock()
|
||||||
defer mc.RUnlock()
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ func (mc *MetaCache) ListDirectoryEntries(ctx context.Context, dirPath util.Full
|
||||||
func (mc *MetaCache) Shutdown() {
|
func (mc *MetaCache) Shutdown() {
|
||||||
mc.Lock()
|
mc.Lock()
|
||||||
defer mc.Unlock()
|
defer mc.Unlock()
|
||||||
mc.actualStore.Shutdown()
|
mc.localStore.Shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mc *MetaCache) mapIdFromFilerToLocal(entry *filer.Entry) {
|
func (mc *MetaCache) mapIdFromFilerToLocal(entry *filer.Entry) {
|
||||||
|
|
Loading…
Reference in a new issue