From 3065a7363bb0e097a23c5134039073318423779d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 22 Oct 2020 14:07:06 +0300 Subject: [PATCH] [#83] cmd/neofs-node: Use response services in application Signed-off-by: Leonard Lyubich --- cmd/neofs-node/accounting.go | 9 ++++++--- cmd/neofs-node/config.go | 4 ++++ cmd/neofs-node/container.go | 9 ++++++--- cmd/neofs-node/netmap.go | 9 ++++++--- cmd/neofs-node/object.go | 27 +++++++++++++++------------ cmd/neofs-node/session.go | 9 ++++++--- 6 files changed, 43 insertions(+), 24 deletions(-) diff --git a/cmd/neofs-node/accounting.go b/cmd/neofs-node/accounting.go index 28f7cb48..fe9373fe 100644 --- a/cmd/neofs-node/accounting.go +++ b/cmd/neofs-node/accounting.go @@ -33,9 +33,12 @@ func initAccountingService(c *cfg) { accountingTransportGRPC.New( accountingService.NewSignService( c.key, - accountingService.NewExecutionService( - accounting.NewExecutor(balanceMorphWrapper), - new(session.ResponseMetaHeader), + accountingService.NewResponseService( + accountingService.NewExecutionService( + accounting.NewExecutor(balanceMorphWrapper), + new(session.ResponseMetaHeader), + ), + c.respSvc, ), ), ), diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 582bafd7..fbf963f1 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -24,6 +24,7 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/nspcc-dev/neofs-node/pkg/network" tokenStorage "github.com/nspcc-dev/neofs-node/pkg/services/session/storage" + "github.com/nspcc-dev/neofs-node/pkg/services/util/response" "github.com/nspcc-dev/neofs-node/pkg/util/logger" "github.com/nspcc-dev/neofs-node/pkg/util/profiler" "github.com/pkg/errors" @@ -124,6 +125,8 @@ type cfg struct { profiler profiler.Profiler workers []worker + + respSvc *response.Service } type cfgGRPC struct { @@ -257,6 +260,7 @@ func initCfg(path string) *cfg { enableReflectService: viperCfg.GetBool(cfgReflectService), }, localAddr: netAddr, + respSvc: response.NewService(), } initLocalStorage(c) diff --git a/cmd/neofs-node/container.go b/cmd/neofs-node/container.go index 71e05a77..de2b1262 100644 --- a/cmd/neofs-node/container.go +++ b/cmd/neofs-node/container.go @@ -32,9 +32,12 @@ func initContainerService(c *cfg) { containerTransportGRPC.New( containerService.NewSignService( c.key, - containerService.NewExecutionService( - containerMorph.NewExecutor(cnrClient), - new(session.ResponseMetaHeader), + containerService.NewResponseService( + containerService.NewExecutionService( + containerMorph.NewExecutor(cnrClient), + new(session.ResponseMetaHeader), + ), + c.respSvc, ), ), ), diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index 2c7946a6..fdc3df1d 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -44,9 +44,12 @@ func initNetmapService(c *cfg) { netmapTransportGRPC.New( netmapService.NewSignService( c.key, - netmapService.NewExecutionService( - c.cfgNodeInfo.info, - c.apiVersion, + netmapService.NewResponseService( + netmapService.NewExecutionService( + c.cfgNodeInfo.info, + c.apiVersion, + ), + c.respSvc, ), ), ), diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 906df233..29a34c1b 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -333,18 +333,21 @@ func initObjectService(c *cfg) { acl.WithNextService( objectService.NewSignService( c.key, - objectService.NewTransportSplitter( - c.cfgGRPC.maxChunkSize, - c.cfgGRPC.maxAddrAmount, - &objectSvc{ - put: sPutV2, - search: sSearchV2, - head: sHeadV2, - rng: sRangeV2, - get: sGetV2, - rngHash: sRangeHashV2, - delete: sDeleteV2, - }, + objectService.NewResponseService( + objectService.NewTransportSplitter( + c.cfgGRPC.maxChunkSize, + c.cfgGRPC.maxAddrAmount, + &objectSvc{ + put: sPutV2, + search: sSearchV2, + head: sHeadV2, + rng: sRangeV2, + get: sGetV2, + rngHash: sRangeHashV2, + delete: sDeleteV2, + }, + ), + c.respSvc, ), ), ), diff --git a/cmd/neofs-node/session.go b/cmd/neofs-node/session.go index 8432f227..3dc6cf2f 100644 --- a/cmd/neofs-node/session.go +++ b/cmd/neofs-node/session.go @@ -15,9 +15,12 @@ func initSessionService(c *cfg) { sessionTransportGRPC.New( sessionSvc.NewSignService( c.key, - sessionSvc.NewExecutionService( - c.privateTokenStore, - new(session.ResponseMetaHeader), + sessionSvc.NewResponseService( + sessionSvc.NewExecutionService( + c.privateTokenStore, + new(session.ResponseMetaHeader), + ), + c.respSvc, ), ), ),