[#38] service/object: Implement simplified object Head service

Implement Head service w/o linking object processing and restoration from
split-chain.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-09-22 18:04:08 +03:00 committed by Alex Vanin
parent 21fc85540a
commit 05f3963975
9 changed files with 487 additions and 0 deletions

View file

@ -0,0 +1,24 @@
package headsvc
import (
"context"
"github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/localstore"
"github.com/pkg/errors"
)
type localHeader struct {
storage *localstore.Storage
}
func (h *localHeader) head(ctx context.Context, prm *Prm, handler func(*object.Object)) error {
m, err := h.storage.Head(prm.addr)
if err != nil {
return errors.Wrapf(err, "(%T) could not get header from local storage", h)
}
handler(m.Head())
return nil
}