2020-09-22 15:04:08 +00:00
|
|
|
package headsvc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
2020-11-19 08:36:58 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
|
2020-09-22 15:04:08 +00:00
|
|
|
"github.com/pkg/errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
type localHeader struct {
|
2020-11-19 08:36:58 +00:00
|
|
|
storage *engine.StorageEngine
|
2020-09-22 15:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (h *localHeader) head(ctx context.Context, prm *Prm, handler func(*object.Object)) error {
|
2020-11-19 08:36:58 +00:00
|
|
|
head, err := engine.Head(h.storage, prm.addr)
|
2020-09-22 15:04:08 +00:00
|
|
|
if err != nil {
|
|
|
|
return errors.Wrapf(err, "(%T) could not get header from local storage", h)
|
|
|
|
}
|
|
|
|
|
2020-10-29 17:16:49 +00:00
|
|
|
handler(head)
|
2020-09-22 15:04:08 +00:00
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|