From a476d8285abd39cc7b74284ae8ae75fed05a5ed7 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Thu, 6 Jul 2023 11:53:18 +0300 Subject: [PATCH] [#294] deletesvcv2: Refactor service constructor Pass required deps as args. Signed-off-by: Dmitrii Stepanov --- cmd/frostfs-node/object.go | 4 +--- pkg/services/object/delete/v2/service.go | 23 ++--------------------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/cmd/frostfs-node/object.go b/cmd/frostfs-node/object.go index da745817..3f0db146 100644 --- a/cmd/frostfs-node/object.go +++ b/cmd/frostfs-node/object.go @@ -397,9 +397,7 @@ func createDeleteService(c *cfg, keyStorage *util.KeyStorage, sGet *getsvc.Servi } func createDeleteServiceV2(sDelete *deletesvc.Service) *deletesvcV2.Service { - return deletesvcV2.NewService( - deletesvcV2.WithInternalService(sDelete), - ) + return deletesvcV2.NewService(sDelete) } func createSplitService(c *cfg, sPutV2 *putsvcV2.Service, sGetV2 *getsvcV2.Service, diff --git a/pkg/services/object/delete/v2/service.go b/pkg/services/object/delete/v2/service.go index 51759c5d..10dcd0e8 100644 --- a/pkg/services/object/delete/v2/service.go +++ b/pkg/services/object/delete/v2/service.go @@ -9,26 +9,13 @@ import ( // Service implements Delete operation of Object service v2. type Service struct { - *cfg -} - -// Option represents Service constructor option. -type Option func(*cfg) - -type cfg struct { svc *deletesvc.Service } // NewService constructs Service instance from provided options. -func NewService(opts ...Option) *Service { - c := new(cfg) - - for i := range opts { - opts[i](c) - } - +func NewService(svc *deletesvc.Service) *Service { return &Service{ - cfg: c, + svc: svc, } } @@ -51,9 +38,3 @@ func (s *Service) Delete(ctx context.Context, req *objectV2.DeleteRequest) (*obj return resp, nil } - -func WithInternalService(v *deletesvc.Service) Option { - return func(c *cfg) { - c.svc = v - } -}