From 534ce034217d3d4bd623484309340998e1a76408 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 15 Mar 2021 12:12:49 +0300 Subject: [PATCH] [#426] cmd/neofs-node: Refactor object service pipeline set up Signed-off-by: Alex Vanin --- cmd/neofs-node/object.go | 85 ++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 62978fb0..7805e2f5 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -298,47 +298,54 @@ func initObjectService(c *cfg) { deletesvcV2.WithKeyStorage(keyStorage), ) - objectGRPC.RegisterObjectServiceServer(c.cfgGRPC.server, - objectTransportGRPC.New( - acl.New( - acl.WithSenderClassifier( - acl.NewSenderClassifier( - c.log, - c.cfgNetmap.wrapper, - c.cfgNetmap.wrapper, - ), - ), - acl.WithContainerSource( - c.cfgObject.cnrStorage, - ), - acl.WithNextService( - objectService.NewSignService( - c.key, - objectService.NewResponseService( - objectService.NewTransportSplitter( - c.cfgGRPC.maxChunkSize, - c.cfgGRPC.maxAddrAmount, - &objectSvc{ - put: sPutV2, - search: sSearchV2, - get: sGetV2, - delete: sDeleteV2, - }, - ), - c.respSvc, - ), - ), - ), - acl.WithLocalStorage(ls), - acl.WithEACLValidatorOptions( - eacl.WithEACLStorage(newCachedEACLStorage(&morphEACLStorage{ - w: c.cfgObject.cnrClient, - })), - eacl.WithLogger(c.log), - ), - acl.WithNetmapState(c.cfgNetmap.state), + // build service pipeline + // grpc | acl | signature | response | split + + splitSvc := objectService.NewTransportSplitter( + c.cfgGRPC.maxChunkSize, + c.cfgGRPC.maxAddrAmount, + &objectSvc{ + put: sPutV2, + search: sSearchV2, + get: sGetV2, + delete: sDeleteV2, + }, + ) + + respSvc := objectService.NewResponseService( + splitSvc, + c.respSvc, + ) + + signSvc := objectService.NewSignService( + c.key, + respSvc, + ) + + aclSvc := acl.New( + acl.WithSenderClassifier( + acl.NewSenderClassifier( + c.log, + c.cfgNetmap.wrapper, + c.cfgNetmap.wrapper, ), ), + acl.WithContainerSource( + c.cfgObject.cnrStorage, + ), + acl.WithNextService(signSvc), + acl.WithLocalStorage(ls), + acl.WithEACLValidatorOptions( + eacl.WithEACLStorage(newCachedEACLStorage(&morphEACLStorage{ + w: c.cfgObject.cnrClient, + })), + eacl.WithLogger(c.log), + ), + acl.WithNetmapState(c.cfgNetmap.state), + ) + + objectGRPC.RegisterObjectServiceServer(c.cfgGRPC.server, + objectTransportGRPC.New(aclSvc), ) }