[#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:
Leonard Lyubich 2020-12-02 12:58:42 +03:00 committed by Alex Vanin
parent 3d77fdb347
commit eaae5a5dd7
6 changed files with 73 additions and 58 deletions

View file

@ -49,9 +49,14 @@ func (b *Blobovnicza) GetRange(prm *GetRangePrm) (*GetRangeRes, error) {
return nil, err
}
// FIXME: code below is incorrect because Get returns raw object data
// so we should unmarshal payload from it before. If blobovnicza
// stores objects in non-protocol format (e.g. compressed)
// then it should not provide GetRange method.
from := prm.rng.GetOffset()
to := from + prm.rng.GetLength()
payload := res.obj.Payload()
payload := res.obj
if from > to {
return nil, errors.Errorf("invalid range [%d:%d]", from, to)