[#472] blobstor: move fsTree to a separate package
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
a8a9f88d90
commit
934e394e28
9 changed files with 129 additions and 129 deletions
|
@ -1,11 +1,6 @@
|
|||
package blobstor
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
@ -41,7 +36,7 @@ func (b *BlobStor) Put(prm *PutPrm) (*PutRes, error) {
|
|||
|
||||
if big {
|
||||
// save object in shallow dir
|
||||
return new(PutRes), b.fsTree.put(prm.obj.Address(), data)
|
||||
return new(PutRes), b.fsTree.Put(prm.obj.Address(), data)
|
||||
}
|
||||
|
||||
// save object in blobovnicza
|
||||
|
@ -57,16 +52,6 @@ func (b *BlobStor) Put(prm *PutPrm) (*PutRes, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (t *fsTree) put(addr *objectSDK.Address, data []byte) error {
|
||||
p := t.treePath(addr)
|
||||
|
||||
if err := os.MkdirAll(path.Dir(p), t.Permissions); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(p, data, t.Permissions)
|
||||
}
|
||||
|
||||
// checks if object is "big".
|
||||
func (b *BlobStor) isBig(data []byte) bool {
|
||||
return uint64(len(data)) > b.smallSizeLimit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue