diff --git a/cmd/frostfs-node/object.go b/cmd/frostfs-node/object.go index 3f0db1461c..1f763dd9a6 100644 --- a/cmd/frostfs-node/object.go +++ b/cmd/frostfs-node/object.go @@ -382,17 +382,17 @@ func createGetServiceV2(sGet *getsvc.Service, keyStorage *util.KeyStorage) *gets func createDeleteService(c *cfg, keyStorage *util.KeyStorage, sGet *getsvc.Service, sSearch *searchsvc.Service, sPut *putsvc.Service) *deletesvc.Service { return deletesvc.New( - deletesvc.WithLogger(c.log), - deletesvc.WithHeadService(sGet), - deletesvc.WithSearchService(sSearch), - deletesvc.WithPutService(sPut), - deletesvc.WithNetworkInfo(&delNetInfo{ + sGet, + sSearch, + sPut, + &delNetInfo{ State: c.cfgNetmap.state, tsLifetime: c.cfgObject.tombstoneLifetime, cfg: c, - }), - deletesvc.WithKeyStorage(keyStorage), + }, + keyStorage, + deletesvc.WithLogger(c.log), ) } diff --git a/pkg/services/object/delete/service.go b/pkg/services/object/delete/service.go index 5c09ad1230..e208a298bb 100644 --- a/pkg/services/object/delete/service.go +++ b/pkg/services/object/delete/service.go @@ -62,16 +62,22 @@ type cfg struct { keyStorage *util.KeyStorage } -func defaultCfg() *cfg { - return &cfg{ - log: &logger.Logger{Logger: zap.L()}, - } -} - // New creates, initializes and returns utility serving // Object.Get service requests. -func New(opts ...Option) *Service { - c := defaultCfg() +func New(gs *getsvc.Service, + ss *searchsvc.Service, + ps *putsvc.Service, + ni NetworkInfo, + ks *util.KeyStorage, + opts ...Option) *Service { + c := &cfg{ + log: &logger.Logger{Logger: zap.L()}, + header: (*headSvcWrapper)(gs), + searcher: (*searchSvcWrapper)(ss), + placer: (*putSvcWrapper)(ps), + netInfo: ni, + keyStorage: ks, + } for i := range opts { opts[i](c) @@ -88,39 +94,3 @@ func WithLogger(l *logger.Logger) Option { c.log = &logger.Logger{Logger: l.With(zap.String("component", "objectSDK.Delete service"))} } } - -// WithHeadService returns option to set Head service -// to work with object headers. -func WithHeadService(h *getsvc.Service) Option { - return func(c *cfg) { - c.header = (*headSvcWrapper)(h) - } -} - -// WithSearchService returns option to set search service. -func WithSearchService(s *searchsvc.Service) Option { - return func(c *cfg) { - c.searcher = (*searchSvcWrapper)(s) - } -} - -// WithPutService returns option to specify put service. -func WithPutService(p *putsvc.Service) Option { - return func(c *cfg) { - c.placer = (*putSvcWrapper)(p) - } -} - -// WithNetworkInfo returns option to set network information source. -func WithNetworkInfo(netInfo NetworkInfo) Option { - return func(c *cfg) { - c.netInfo = netInfo - } -} - -// WithKeyStorage returns option to set local private key storage. -func WithKeyStorage(ks *util.KeyStorage) Option { - return func(c *cfg) { - c.keyStorage = ks - } -}