[#288] pilorama: Use more descriptive names for memory tree

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-04-26 17:07:51 +03:00 committed by Evgenii Stratonikov
parent f856ad7480
commit 0045f1bcd4
2 changed files with 22 additions and 25 deletions

View file

@ -12,7 +12,7 @@ import (
// memoryForest represents multiple replicating trees sharing a single storage.
type memoryForest struct {
// treeMap maps tree identifier (container ID + name) to the replicated log.
treeMap map[string]*state
treeMap map[string]*memoryTree
}
var _ Forest = (*memoryForest)(nil)
@ -21,7 +21,7 @@ var _ Forest = (*memoryForest)(nil)
// TODO: this function will eventually be removed and is here for debugging.
func NewMemoryForest() ForestStorage {
return &memoryForest{
treeMap: make(map[string]*state),
treeMap: make(map[string]*memoryTree),
}
}
@ -34,7 +34,7 @@ func (f *memoryForest) TreeMove(_ context.Context, d CIDDescriptor, treeID strin
fullID := d.CID.String() + "/" + treeID
s, ok := f.treeMap[fullID]
if !ok {
s = newState()
s = newMemoryTree()
f.treeMap[fullID] = s
}
@ -60,7 +60,7 @@ func (f *memoryForest) TreeAddByPath(_ context.Context, d CIDDescriptor, treeID
fullID := d.CID.String() + "/" + treeID
s, ok := f.treeMap[fullID]
if !ok {
s = newState()
s = newMemoryTree()
f.treeMap[fullID] = s
}
@ -98,7 +98,7 @@ func (f *memoryForest) TreeApply(_ context.Context, cnr cid.ID, treeID string, o
fullID := cnr.String() + "/" + treeID
s, ok := f.treeMap[fullID]
if !ok {
s = newState()
s = newMemoryTree()
f.treeMap[fullID] = s
}
@ -131,7 +131,7 @@ func (f *memoryForest) TreeGetByPath(_ context.Context, cid cid.ID, treeID strin
return nil, ErrTreeNotFound
}
return s.get(attr, path, latest), nil
return s.getByPath(attr, path, latest), nil
}
// TreeGetMeta implements the Forest interface.