From 96a8ee7c830d3543ceabe6d15418926fc7aafef2 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 19 Apr 2021 13:00:56 +0300 Subject: [PATCH] [#472] blobstor: allow to put raw objects Signed-off-by: Evgenii Stratonikov --- pkg/local_object_storage/blobstor/put.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/local_object_storage/blobstor/put.go b/pkg/local_object_storage/blobstor/put.go index 8ecc9773b..9864d1c9f 100644 --- a/pkg/local_object_storage/blobstor/put.go +++ b/pkg/local_object_storage/blobstor/put.go @@ -1,6 +1,7 @@ package blobstor import ( + objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object" "github.com/pkg/errors" ) @@ -29,6 +30,11 @@ func (b *BlobStor) Put(prm *PutPrm) (*PutRes, error) { return nil, errors.Wrap(err, "could not marshal the object") } + return b.PutRaw(prm.obj.Address(), data) +} + +// PutRaw saves already marshaled object in BLOB storage. +func (b *BlobStor) PutRaw(addr *objectSDK.Address, data []byte) (*PutRes, error) { big := b.isBig(data) // compress object data @@ -36,11 +42,11 @@ func (b *BlobStor) Put(prm *PutPrm) (*PutRes, error) { if big { // save object in shallow dir - return new(PutRes), b.fsTree.Put(prm.obj.Address(), data) + return new(PutRes), b.fsTree.Put(addr, data) } // save object in blobovnicza - res, err := b.blobovniczas.put(prm.obj.Address(), data) + res, err := b.blobovniczas.put(addr, data) if err != nil { return nil, err }