[#83] services: Remove setting of meta header from executing services

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-10-22 14:12:35 +03:00 committed by Alex Vanin
parent 3065a7363b
commit 19f9c7eacb
7 changed files with 6 additions and 39 deletions

View file

@ -2,7 +2,6 @@ package main
import ( import (
accountingGRPC "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc" 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"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/balance" "github.com/nspcc-dev/neofs-node/pkg/morph/client/balance"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/balance/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/client/balance/wrapper"
@ -36,7 +35,6 @@ func initAccountingService(c *cfg) {
accountingService.NewResponseService( accountingService.NewResponseService(
accountingService.NewExecutionService( accountingService.NewExecutionService(
accounting.NewExecutor(balanceMorphWrapper), accounting.NewExecutor(balanceMorphWrapper),
new(session.ResponseMetaHeader),
), ),
c.respSvc, c.respSvc,
), ),

View file

@ -2,7 +2,6 @@ package main
import ( import (
containerGRPC "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" 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"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container" "github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
@ -35,7 +34,6 @@ func initContainerService(c *cfg) {
containerService.NewResponseService( containerService.NewResponseService(
containerService.NewExecutionService( containerService.NewExecutionService(
containerMorph.NewExecutor(cnrClient), containerMorph.NewExecutor(cnrClient),
new(session.ResponseMetaHeader),
), ),
c.respSvc, c.respSvc,
), ),

View file

@ -1,7 +1,6 @@
package main package main
import ( import (
"github.com/nspcc-dev/neofs-api-go/v2/session"
sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc" sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc"
sessionTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/session/grpc" sessionTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/session/grpc"
sessionSvc "github.com/nspcc-dev/neofs-node/pkg/services/session" sessionSvc "github.com/nspcc-dev/neofs-node/pkg/services/session"
@ -18,7 +17,6 @@ func initSessionService(c *cfg) {
sessionSvc.NewResponseService( sessionSvc.NewResponseService(
sessionSvc.NewExecutionService( sessionSvc.NewExecutionService(
c.privateTokenStore, c.privateTokenStore,
new(session.ResponseMetaHeader),
), ),
c.respSvc, c.respSvc,
), ),

View file

@ -4,7 +4,6 @@ import (
"context" "context"
"github.com/nspcc-dev/neofs-api-go/v2/accounting" "github.com/nspcc-dev/neofs-api-go/v2/accounting"
"github.com/nspcc-dev/neofs-api-go/v2/session"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -14,17 +13,12 @@ type ServiceExecutor interface {
type executorSvc struct { type executorSvc struct {
exec ServiceExecutor exec ServiceExecutor
metaHeader *session.ResponseMetaHeader
} }
// NewExecutionService wraps ServiceExecutor and returns Accounting Service interface. // NewExecutionService wraps ServiceExecutor and returns Accounting Service interface.
// func NewExecutionService(exec ServiceExecutor) accounting.Service {
// Passed meta header is attached to all responses.
func NewExecutionService(exec ServiceExecutor, metaHdr *session.ResponseMetaHeader) accounting.Service {
return &executorSvc{ return &executorSvc{
exec: exec, exec: exec,
metaHeader: metaHdr,
} }
} }
@ -36,7 +30,6 @@ func (s *executorSvc) Balance(ctx context.Context, req *accounting.BalanceReques
resp := new(accounting.BalanceResponse) resp := new(accounting.BalanceResponse)
resp.SetBody(respBody) resp.SetBody(respBody)
resp.SetMetaHeader(s.metaHeader)
return resp, nil return resp, nil
} }

View file

@ -4,7 +4,6 @@ import (
"context" "context"
"github.com/nspcc-dev/neofs-api-go/v2/container" "github.com/nspcc-dev/neofs-api-go/v2/container"
"github.com/nspcc-dev/neofs-api-go/v2/session"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -19,17 +18,12 @@ type ServiceExecutor interface {
type executorSvc struct { type executorSvc struct {
exec ServiceExecutor exec ServiceExecutor
metaHeader *session.ResponseMetaHeader
} }
// NewExecutionService wraps ServiceExecutor and returns Container Service interface. // NewExecutionService wraps ServiceExecutor and returns Container Service interface.
// func NewExecutionService(exec ServiceExecutor) container.Service {
// Passed meta header is attached to all responses.
func NewExecutionService(exec ServiceExecutor, metaHdr *session.ResponseMetaHeader) container.Service {
return &executorSvc{ return &executorSvc{
exec: exec, exec: exec,
metaHeader: metaHdr,
} }
} }
@ -41,7 +35,6 @@ func (s *executorSvc) Put(ctx context.Context, req *container.PutRequest) (*cont
resp := new(container.PutResponse) resp := new(container.PutResponse)
resp.SetBody(respBody) resp.SetBody(respBody)
resp.SetMetaHeader(s.metaHeader)
return resp, nil return resp, nil
} }
@ -54,7 +47,6 @@ func (s *executorSvc) Delete(ctx context.Context, req *container.DeleteRequest)
resp := new(container.DeleteResponse) resp := new(container.DeleteResponse)
resp.SetBody(respBody) resp.SetBody(respBody)
resp.SetMetaHeader(s.metaHeader)
return resp, nil return resp, nil
} }
@ -67,7 +59,6 @@ func (s *executorSvc) Get(ctx context.Context, req *container.GetRequest) (*cont
resp := new(container.GetResponse) resp := new(container.GetResponse)
resp.SetBody(respBody) resp.SetBody(respBody)
resp.SetMetaHeader(s.metaHeader)
return resp, nil return resp, nil
} }
@ -80,7 +71,6 @@ func (s *executorSvc) List(ctx context.Context, req *container.ListRequest) (*co
resp := new(container.ListResponse) resp := new(container.ListResponse)
resp.SetBody(respBody) resp.SetBody(respBody)
resp.SetMetaHeader(s.metaHeader)
return resp, nil return resp, nil
} }
@ -93,7 +83,6 @@ func (s *executorSvc) SetExtendedACL(ctx context.Context, req *container.SetExte
resp := new(container.SetExtendedACLResponse) resp := new(container.SetExtendedACLResponse)
resp.SetBody(respBody) resp.SetBody(respBody)
resp.SetMetaHeader(s.metaHeader)
return resp, nil return resp, nil
} }
@ -106,7 +95,6 @@ func (s *executorSvc) GetExtendedACL(ctx context.Context, req *container.GetExte
resp := new(container.GetExtendedACLResponse) resp := new(container.GetExtendedACLResponse)
resp.SetBody(respBody) resp.SetBody(respBody)
resp.SetMetaHeader(s.metaHeader)
return resp, nil return resp, nil
} }

View file

@ -5,7 +5,6 @@ import (
"github.com/nspcc-dev/neofs-api-go/pkg" "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/netmap"
"github.com/nspcc-dev/neofs-api-go/v2/session"
) )
type executorSvc struct { type executorSvc struct {
@ -35,7 +34,6 @@ func (s *executorSvc) LocalNodeInfo(
resp := new(netmap.LocalNodeInfoResponse) resp := new(netmap.LocalNodeInfoResponse)
resp.SetBody(body) resp.SetBody(body)
resp.SetMetaHeader(new(session.ResponseMetaHeader))
return resp, nil return resp, nil
} }

View file

@ -13,17 +13,12 @@ type ServiceExecutor interface {
type executorSvc struct { type executorSvc struct {
exec ServiceExecutor exec ServiceExecutor
metaHeader *session.ResponseMetaHeader
} }
// NewExecutionService wraps ServiceExecutor and returns Session Service interface. // NewExecutionService wraps ServiceExecutor and returns Session Service interface.
// func NewExecutionService(exec ServiceExecutor) session.Service {
// Passed meta header is attached to all responses.
func NewExecutionService(exec ServiceExecutor, metaHdr *session.ResponseMetaHeader) session.Service {
return &executorSvc{ return &executorSvc{
exec: exec, exec: exec,
metaHeader: metaHdr,
} }
} }
@ -35,7 +30,6 @@ func (s *executorSvc) Create(ctx context.Context, req *session.CreateRequest) (*
resp := new(session.CreateResponse) resp := new(session.CreateResponse)
resp.SetBody(respBody) resp.SetBody(respBody)
resp.SetMetaHeader(s.metaHeader)
return resp, nil return resp, nil
} }