forked from TrueCloudLab/frostfs-node
[#1460] blobstor: Do not use pointers as the results
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
08bf8a68f1
commit
0e4a1beecf
11 changed files with 64 additions and 63 deletions
|
@ -26,31 +26,31 @@ type GetBigRes struct {
|
|||
//
|
||||
// Returns an error of type apistatus.ObjectNotFound if the requested object is not
|
||||
// presented in shallow dir.
|
||||
func (b *BlobStor) GetBig(prm GetBigPrm) (*GetBigRes, error) {
|
||||
func (b *BlobStor) GetBig(prm GetBigPrm) (GetBigRes, error) {
|
||||
// get compressed object data
|
||||
data, err := b.fsTree.Get(prm.addr)
|
||||
if err != nil {
|
||||
if errors.Is(err, fstree.ErrFileNotFound) {
|
||||
var errNotFound apistatus.ObjectNotFound
|
||||
|
||||
return nil, errNotFound
|
||||
return GetBigRes{}, errNotFound
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("could not read object from fs tree: %w", err)
|
||||
return GetBigRes{}, fmt.Errorf("could not read object from fs tree: %w", err)
|
||||
}
|
||||
|
||||
data, err = b.decompressor(data)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not decompress object data: %w", err)
|
||||
return GetBigRes{}, fmt.Errorf("could not decompress object data: %w", err)
|
||||
}
|
||||
|
||||
// unmarshal the object
|
||||
obj := objectSDK.New()
|
||||
if err := obj.Unmarshal(data); err != nil {
|
||||
return nil, fmt.Errorf("could not unmarshal the object: %w", err)
|
||||
return GetBigRes{}, fmt.Errorf("could not unmarshal the object: %w", err)
|
||||
}
|
||||
|
||||
return &GetBigRes{
|
||||
return GetBigRes{
|
||||
roObject: roObject{
|
||||
obj: obj,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue