forked from TrueCloudLab/frostfs-node
[#229] blobovnicza: Store objects in a binary format
In previous implementation Blobovnicza's stored objects in protocol format which did not allow working with externally compressed objects. To achieve this goal, operations Get and Put no longer work with the structure of the object, but only with abstract binary data. Operation GetRange has become incorrect in its original purpose to receive the payload range. In this regard, BlobStor receives the payload range of the object through Get operation. In the future either Blobovnicza will learn to compress objects by itself, or the GetRange operation will be eliminated. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
3d77fdb347
commit
eaae5a5dd7
6 changed files with 73 additions and 58 deletions
|
@ -3,7 +3,6 @@ package blobovnicza
|
|||
import (
|
||||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
||||
"github.com/pkg/errors"
|
||||
"go.etcd.io/bbolt"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -15,7 +14,7 @@ type GetPrm struct {
|
|||
|
||||
// GetRes groups resulting values of Get operation.
|
||||
type GetRes struct {
|
||||
obj *object.Object
|
||||
obj []byte
|
||||
}
|
||||
|
||||
// SetAddress sets address of the requested object.
|
||||
|
@ -23,8 +22,8 @@ func (p *GetPrm) SetAddress(addr *objectSDK.Address) {
|
|||
p.addr = addr
|
||||
}
|
||||
|
||||
// Object returns the requested object.
|
||||
func (p *GetRes) Object() *object.Object {
|
||||
// Object returns binary representation of the requested object.
|
||||
func (p *GetRes) Object() []byte {
|
||||
return p.obj
|
||||
}
|
||||
|
||||
|
@ -64,15 +63,7 @@ func (b *Blobovnicza) Get(prm *GetPrm) (*GetRes, error) {
|
|||
return nil, object.ErrNotFound
|
||||
}
|
||||
|
||||
// TODO: add decompression step
|
||||
|
||||
// unmarshal the object
|
||||
obj := object.New()
|
||||
if err := obj.Unmarshal(data); err != nil {
|
||||
return nil, errors.Wrap(err, "could not unmarshal the object")
|
||||
}
|
||||
|
||||
return &GetRes{
|
||||
obj: obj,
|
||||
obj: data,
|
||||
}, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue