[#472] blobstor: move fsTree to a separate package

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-04-08 16:53:25 +03:00 committed by Alex Vanin
parent a8a9f88d90
commit 934e394e28
9 changed files with 129 additions and 129 deletions

View file

@ -1,10 +1,8 @@
package blobstor
import (
"os"
"github.com/nspcc-dev/neofs-api-go/pkg/object"
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree"
"github.com/pkg/errors"
)
@ -48,8 +46,8 @@ func (b *BlobStor) Exists(prm *ExistsPrm) (*ExistsRes, error) {
// checks if object is presented in shallow dir.
func (b *BlobStor) existsBig(addr *object.Address) (bool, error) {
_, err := b.fsTree.exists(addr)
if errors.Is(err, errFileNotFound) {
_, err := b.fsTree.Exists(addr)
if errors.Is(err, fstree.ErrFileNotFound) {
return false, nil
}
@ -61,14 +59,3 @@ func (b *BlobStor) existsSmall(addr *object.Address) (bool, error) {
// TODO: implement
return false, nil
}
func (t *fsTree) exists(addr *objectSDK.Address) (string, error) {
p := t.treePath(addr)
_, err := os.Stat(p)
if os.IsNotExist(err) {
err = errFileNotFound
}
return p, err
}