From 19f9c7eacb417139dff3a65ce3fddba925d0d87e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 22 Oct 2020 14:12:35 +0300 Subject: [PATCH] [#83] services: Remove setting of meta header from executing services Signed-off-by: Leonard Lyubich --- cmd/neofs-node/accounting.go | 2 -- cmd/neofs-node/container.go | 2 -- cmd/neofs-node/session.go | 2 -- pkg/services/accounting/executor.go | 11 ++--------- pkg/services/container/executor.go | 16 ++-------------- pkg/services/netmap/executor.go | 2 -- pkg/services/session/executor.go | 10 ++-------- 7 files changed, 6 insertions(+), 39 deletions(-) diff --git a/cmd/neofs-node/accounting.go b/cmd/neofs-node/accounting.go index fe9373fe1..76bb2c429 100644 --- a/cmd/neofs-node/accounting.go +++ b/cmd/neofs-node/accounting.go @@ -2,7 +2,6 @@ package main import ( accountingGRPC "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-node/pkg/morph/client" "github.com/nspcc-dev/neofs-node/pkg/morph/client/balance" "github.com/nspcc-dev/neofs-node/pkg/morph/client/balance/wrapper" @@ -36,7 +35,6 @@ func initAccountingService(c *cfg) { accountingService.NewResponseService( accountingService.NewExecutionService( accounting.NewExecutor(balanceMorphWrapper), - new(session.ResponseMetaHeader), ), c.respSvc, ), diff --git a/cmd/neofs-node/container.go b/cmd/neofs-node/container.go index de2b12624..432d744af 100644 --- a/cmd/neofs-node/container.go +++ b/cmd/neofs-node/container.go @@ -2,7 +2,6 @@ package main import ( containerGRPC "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" - "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/nspcc-dev/neofs-node/pkg/morph/client" "github.com/nspcc-dev/neofs-node/pkg/morph/client/container" "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" @@ -35,7 +34,6 @@ func initContainerService(c *cfg) { containerService.NewResponseService( containerService.NewExecutionService( containerMorph.NewExecutor(cnrClient), - new(session.ResponseMetaHeader), ), c.respSvc, ), diff --git a/cmd/neofs-node/session.go b/cmd/neofs-node/session.go index 3dc6cf2fc..a7bb99472 100644 --- a/cmd/neofs-node/session.go +++ b/cmd/neofs-node/session.go @@ -1,7 +1,6 @@ package main import ( - "github.com/nspcc-dev/neofs-api-go/v2/session" sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" sessionTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/session/grpc" sessionSvc "github.com/nspcc-dev/neofs-node/pkg/services/session" @@ -18,7 +17,6 @@ func initSessionService(c *cfg) { sessionSvc.NewResponseService( sessionSvc.NewExecutionService( c.privateTokenStore, - new(session.ResponseMetaHeader), ), c.respSvc, ), diff --git a/pkg/services/accounting/executor.go b/pkg/services/accounting/executor.go index c2bc76c03..0ed5ff4c6 100644 --- a/pkg/services/accounting/executor.go +++ b/pkg/services/accounting/executor.go @@ -4,7 +4,6 @@ import ( "context" "github.com/nspcc-dev/neofs-api-go/v2/accounting" - "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/pkg/errors" ) @@ -14,17 +13,12 @@ type ServiceExecutor interface { type executorSvc struct { exec ServiceExecutor - - metaHeader *session.ResponseMetaHeader } // NewExecutionService wraps ServiceExecutor and returns Accounting Service interface. -// -// Passed meta header is attached to all responses. -func NewExecutionService(exec ServiceExecutor, metaHdr *session.ResponseMetaHeader) accounting.Service { +func NewExecutionService(exec ServiceExecutor) accounting.Service { return &executorSvc{ - exec: exec, - metaHeader: metaHdr, + exec: exec, } } @@ -36,7 +30,6 @@ func (s *executorSvc) Balance(ctx context.Context, req *accounting.BalanceReques resp := new(accounting.BalanceResponse) resp.SetBody(respBody) - resp.SetMetaHeader(s.metaHeader) return resp, nil } diff --git a/pkg/services/container/executor.go b/pkg/services/container/executor.go index 9ff59c2cc..8e573d056 100644 --- a/pkg/services/container/executor.go +++ b/pkg/services/container/executor.go @@ -4,7 +4,6 @@ import ( "context" "github.com/nspcc-dev/neofs-api-go/v2/container" - "github.com/nspcc-dev/neofs-api-go/v2/session" "github.com/pkg/errors" ) @@ -19,17 +18,12 @@ type ServiceExecutor interface { type executorSvc struct { exec ServiceExecutor - - metaHeader *session.ResponseMetaHeader } // NewExecutionService wraps ServiceExecutor and returns Container Service interface. -// -// Passed meta header is attached to all responses. -func NewExecutionService(exec ServiceExecutor, metaHdr *session.ResponseMetaHeader) container.Service { +func NewExecutionService(exec ServiceExecutor) container.Service { return &executorSvc{ - exec: exec, - metaHeader: metaHdr, + exec: exec, } } @@ -41,7 +35,6 @@ func (s *executorSvc) Put(ctx context.Context, req *container.PutRequest) (*cont resp := new(container.PutResponse) resp.SetBody(respBody) - resp.SetMetaHeader(s.metaHeader) return resp, nil } @@ -54,7 +47,6 @@ func (s *executorSvc) Delete(ctx context.Context, req *container.DeleteRequest) resp := new(container.DeleteResponse) resp.SetBody(respBody) - resp.SetMetaHeader(s.metaHeader) return resp, nil } @@ -67,7 +59,6 @@ func (s *executorSvc) Get(ctx context.Context, req *container.GetRequest) (*cont resp := new(container.GetResponse) resp.SetBody(respBody) - resp.SetMetaHeader(s.metaHeader) return resp, nil } @@ -80,7 +71,6 @@ func (s *executorSvc) List(ctx context.Context, req *container.ListRequest) (*co resp := new(container.ListResponse) resp.SetBody(respBody) - resp.SetMetaHeader(s.metaHeader) return resp, nil } @@ -93,7 +83,6 @@ func (s *executorSvc) SetExtendedACL(ctx context.Context, req *container.SetExte resp := new(container.SetExtendedACLResponse) resp.SetBody(respBody) - resp.SetMetaHeader(s.metaHeader) return resp, nil } @@ -106,7 +95,6 @@ func (s *executorSvc) GetExtendedACL(ctx context.Context, req *container.GetExte resp := new(container.GetExtendedACLResponse) resp.SetBody(respBody) - resp.SetMetaHeader(s.metaHeader) return resp, nil } diff --git a/pkg/services/netmap/executor.go b/pkg/services/netmap/executor.go index e8f9df8ca..192a11702 100644 --- a/pkg/services/netmap/executor.go +++ b/pkg/services/netmap/executor.go @@ -5,7 +5,6 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/v2/netmap" - "github.com/nspcc-dev/neofs-api-go/v2/session" ) type executorSvc struct { @@ -35,7 +34,6 @@ func (s *executorSvc) LocalNodeInfo( resp := new(netmap.LocalNodeInfoResponse) resp.SetBody(body) - resp.SetMetaHeader(new(session.ResponseMetaHeader)) return resp, nil } diff --git a/pkg/services/session/executor.go b/pkg/services/session/executor.go index 05ef3822a..520af4f1f 100644 --- a/pkg/services/session/executor.go +++ b/pkg/services/session/executor.go @@ -13,17 +13,12 @@ type ServiceExecutor interface { type executorSvc struct { exec ServiceExecutor - - metaHeader *session.ResponseMetaHeader } // NewExecutionService wraps ServiceExecutor and returns Session Service interface. -// -// Passed meta header is attached to all responses. -func NewExecutionService(exec ServiceExecutor, metaHdr *session.ResponseMetaHeader) session.Service { +func NewExecutionService(exec ServiceExecutor) session.Service { return &executorSvc{ - exec: exec, - metaHeader: metaHdr, + exec: exec, } } @@ -35,7 +30,6 @@ func (s *executorSvc) Create(ctx context.Context, req *session.CreateRequest) (* resp := new(session.CreateResponse) resp.SetBody(respBody) - resp.SetMetaHeader(s.metaHeader) return resp, nil }