forked from TrueCloudLab/frostfs-node
Initial commit
Initial public review release v0.10.0
This commit is contained in:
commit
dadfd90dcd
276 changed files with 46331 additions and 0 deletions
30
lib/localstore/get.go
Normal file
30
lib/localstore/get.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package localstore
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/refs"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func (l *localstore) Get(key refs.Address) (*Object, error) {
|
||||
var (
|
||||
err error
|
||||
k, v []byte
|
||||
o = new(Object)
|
||||
)
|
||||
|
||||
k, err = key.Hash()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Localstore Get failed on key.Marshal")
|
||||
}
|
||||
|
||||
v, err = l.blobBucket.Get(k)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Localstore Get failed on blobBucket.Get")
|
||||
}
|
||||
|
||||
if err = o.Unmarshal(v); err != nil {
|
||||
return nil, errors.Wrap(err, "Localstore Get failed on Object.Unmarshal")
|
||||
}
|
||||
|
||||
return o, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue