From 0cbe09d211ad2e6dfb215b021db1f6c1b0d09d07 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 2 Mar 2022 17:31:54 +0300 Subject: [PATCH] [#346] s3-gw: Reuse single `neofs.NeoFS` in application Signed-off-by: Leonard Lyubich --- cmd/s3-gw/app.go | 7 ++----- internal/neofs/neofs.go | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cmd/s3-gw/app.go b/cmd/s3-gw/app.go index bdbc10241..6b95b7bb7 100644 --- a/cmd/s3-gw/app.go +++ b/cmd/s3-gw/app.go @@ -158,15 +158,12 @@ func newApp(ctx context.Context, l *zap.Logger, v *viper.Viper) *App { NotificationController: nc, } - var n neofs.NeoFS - n.SetConnectionPool(conns) - // prepare object layer - obj = layer.NewLayer(l, &layerNeoFS{&n}, layerCfg) + obj = layer.NewLayer(l, &layerNeoFS{&neoFS}, layerCfg) // prepare auth center ctr = auth.New(&neofs.AuthmateNeoFS{ - NeoFS: n, + NeoFS: &neoFS, }, key, getAccessBoxCacheConfig(v, l)) handlerOptions := getHandlerOptions(v, l) diff --git a/internal/neofs/neofs.go b/internal/neofs/neofs.go index 97f0e0c89..ca355d6a1 100644 --- a/internal/neofs/neofs.go +++ b/internal/neofs/neofs.go @@ -512,7 +512,7 @@ func (x *NeoFS) DeleteObject(ctx context.Context, prm layer.PrmObjectDelete) err // AuthmateNeoFS is a mediator which implements authmate.NeoFS through NeoFS. type AuthmateNeoFS struct { - NeoFS + *NeoFS } func (x *AuthmateNeoFS) CreateContainer(ctx context.Context, prm authmate.PrmContainerCreate) (*cid.ID, error) {