[#1902] engine, shard: Implement TreeList
method
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
2e199c7ab1
commit
24e9e3f3bf
3 changed files with 25 additions and 5 deletions
|
@ -183,6 +183,24 @@ func (e *StorageEngine) TreeDrop(cid cidSDK.ID, treeID string) error {
|
||||||
|
|
||||||
// TreeList implements the pilorama.Forest interface.
|
// TreeList implements the pilorama.Forest interface.
|
||||||
func (e *StorageEngine) TreeList(cid cidSDK.ID) ([]string, error) {
|
func (e *StorageEngine) TreeList(cid cidSDK.ID) ([]string, error) {
|
||||||
//TODO implement me
|
var ids []string
|
||||||
panic("implement me")
|
var err error
|
||||||
|
|
||||||
|
for _, sh := range e.sortShardsByWeight(cid) {
|
||||||
|
ids, err = sh.TreeList(cid)
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, shard.ErrPiloramaDisabled) || errors.Is(err, shard.ErrReadOnlyMode) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
e.reportShardError(sh, "can't perform `TreeList`", err,
|
||||||
|
zap.Stringer("cid", cid))
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
return ids, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return ids, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,7 +193,7 @@ func (f *memoryForest) TreeDrop(cid cidSDK.ID, treeID string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TreeGetTrees implements the pilorama.Forest interface.
|
// TreeList implements the pilorama.Forest interface.
|
||||||
func (f *memoryForest) TreeList(cid cidSDK.ID) ([]string, error) {
|
func (f *memoryForest) TreeList(cid cidSDK.ID) ([]string, error) {
|
||||||
var res []string
|
var res []string
|
||||||
cidStr := cid.EncodeToString()
|
cidStr := cid.EncodeToString()
|
||||||
|
|
|
@ -87,6 +87,8 @@ func (s *Shard) TreeDrop(cid cidSDK.ID, treeID string) error {
|
||||||
|
|
||||||
// TreeList implements the pilorama.Forest interface.
|
// TreeList implements the pilorama.Forest interface.
|
||||||
func (s *Shard) TreeList(cid cidSDK.ID) ([]string, error) {
|
func (s *Shard) TreeList(cid cidSDK.ID) ([]string, error) {
|
||||||
//TODO implement me
|
if s.pilorama == nil {
|
||||||
panic("implement me")
|
return nil, ErrPiloramaDisabled
|
||||||
|
}
|
||||||
|
return s.pilorama.TreeList(cid)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue