diff --git a/pkg/local_object_storage/blobovnicza/delete.go b/pkg/local_object_storage/blobovnicza/delete.go index 6c255ec9a2..e37718aa7c 100644 --- a/pkg/local_object_storage/blobovnicza/delete.go +++ b/pkg/local_object_storage/blobovnicza/delete.go @@ -29,7 +29,7 @@ func (p *DeletePrm) SetAddress(addr oid.Address) { // Returns an error of type apistatus.ObjectNotFound if the object to be deleted is not in blobovnicza. // // Should not be called in read-only configuration. -func (b *Blobovnicza) Delete(prm DeletePrm) (*DeleteRes, error) { +func (b *Blobovnicza) Delete(prm DeletePrm) (DeleteRes, error) { addrKey := addressKey(prm.addr) removed := false @@ -67,8 +67,8 @@ func (b *Blobovnicza) Delete(prm DeletePrm) (*DeleteRes, error) { if err == nil && !removed { var errNotFound apistatus.ObjectNotFound - return nil, errNotFound + return DeleteRes{}, errNotFound } - return nil, err + return DeleteRes{}, err } diff --git a/pkg/local_object_storage/blobovnicza/get.go b/pkg/local_object_storage/blobovnicza/get.go index 66cc41f795..17eb7254a8 100644 --- a/pkg/local_object_storage/blobovnicza/get.go +++ b/pkg/local_object_storage/blobovnicza/get.go @@ -35,7 +35,7 @@ func (p GetRes) Object() []byte { // // Returns an error of type apistatus.ObjectNotFound if the requested object is not // presented in Blobovnicza. -func (b *Blobovnicza) Get(prm GetPrm) (*GetRes, error) { +func (b *Blobovnicza) Get(prm GetPrm) (GetRes, error) { var ( data []byte addrKey = addressKey(prm.addr) @@ -58,16 +58,16 @@ func (b *Blobovnicza) Get(prm GetPrm) (*GetRes, error) { return stop, nil }) }); err != nil { - return nil, err + return GetRes{}, err } if data == nil { var errNotFound apistatus.ObjectNotFound - return nil, errNotFound + return GetRes{}, errNotFound } - return &GetRes{ + return GetRes{ obj: data, }, nil } diff --git a/pkg/local_object_storage/blobovnicza/iterate.go b/pkg/local_object_storage/blobovnicza/iterate.go index 7fbeb070f1..75b0cd0469 100644 --- a/pkg/local_object_storage/blobovnicza/iterate.go +++ b/pkg/local_object_storage/blobovnicza/iterate.go @@ -117,7 +117,7 @@ type IterateRes struct { // Returns handler's errors directly. Returns nil after iterating finish. // // Handler should not retain object data. Handler must not be nil. -func (b *Blobovnicza) Iterate(prm IteratePrm) (*IterateRes, error) { +func (b *Blobovnicza) Iterate(prm IteratePrm) (IterateRes, error) { var elem IterationElement if err := b.boltDB.View(func(tx *bbolt.Tx) error { @@ -140,10 +140,10 @@ func (b *Blobovnicza) Iterate(prm IteratePrm) (*IterateRes, error) { }) }) }); err != nil { - return nil, err + return IterateRes{}, err } - return new(IterateRes), nil + return IterateRes{}, nil } // IterateObjects is a helper function which iterates over Blobovnicza and passes binary objects to f. diff --git a/pkg/local_object_storage/blobovnicza/put.go b/pkg/local_object_storage/blobovnicza/put.go index 4ec369e6ad..dbbec6d768 100644 --- a/pkg/local_object_storage/blobovnicza/put.go +++ b/pkg/local_object_storage/blobovnicza/put.go @@ -47,7 +47,7 @@ func (p *PutPrm) SetMarshaledObject(data []byte) { // Returns ErrFull if blobovnicza is filled. // // Should not be called in read-only configuration. -func (b *Blobovnicza) Put(prm PutPrm) (*PutRes, error) { +func (b *Blobovnicza) Put(prm PutPrm) (PutRes, error) { sz := uint64(len(prm.objData)) bucketName := bucketForSize(sz) key := addressKey(prm.addr) @@ -76,7 +76,7 @@ func (b *Blobovnicza) Put(prm PutPrm) (*PutRes, error) { b.incSize(sz) } - return nil, err + return PutRes{}, err } func addressKey(addr oid.Address) []byte {