package headsvc import ( "context" "crypto/ecdsa" "github.com/nspcc-dev/neofs-node/pkg/core/container" "github.com/nspcc-dev/neofs-node/pkg/core/netmap" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/localstore" "github.com/nspcc-dev/neofs-node/pkg/network" "github.com/nspcc-dev/neofs-node/pkg/util" ) type Service struct { *cfg } type Option func(*cfg) type cfg struct { key *ecdsa.PrivateKey localStore *localstore.Storage cnrSrc container.Source netMapSrc netmap.Source workerPool util.WorkerPool localAddrSrc network.LocalAddressSource } func defaultCfg() *cfg { return &cfg{ workerPool: new(util.SyncWorkerPool), } } func NewService(opts ...Option) *Service { c := defaultCfg() for i := range opts { opts[i](c) } return &Service{ cfg: c, } } func (s *Service) Head(ctx context.Context, prm *Prm) (*Response, error) { return (&distributedHeader{ cfg: s.cfg, }).head(ctx, prm) } func WithKey(v *ecdsa.PrivateKey) Option { return func(c *cfg) { c.key = v } } func WithLocalStorage(v *localstore.Storage) Option { return func(c *cfg) { c.localStore = v } } func WithContainerSource(v container.Source) Option { return func(c *cfg) { c.cnrSrc = v } } func WithNetworkMapSource(v netmap.Source) Option { return func(c *cfg) { c.netMapSrc = v } } func WithWorkerPool(v util.WorkerPool) Option { return func(c *cfg) { c.workerPool = v } } func WithLocalAddressSource(v network.LocalAddressSource) Option { return func(c *cfg) { c.localAddrSrc = v } }