[#346] s3-gw: Reuse single neofs.NeoFS in application

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-03-02 17:31:54 +03:00 committed by LeL
parent 1517b5c638
commit 0cbe09d211
2 changed files with 3 additions and 6 deletions

View file

@ -158,15 +158,12 @@ func newApp(ctx context.Context, l *zap.Logger, v *viper.Viper) *App {
NotificationController: nc, NotificationController: nc,
} }
var n neofs.NeoFS
n.SetConnectionPool(conns)
// prepare object layer // prepare object layer
obj = layer.NewLayer(l, &layerNeoFS{&n}, layerCfg) obj = layer.NewLayer(l, &layerNeoFS{&neoFS}, layerCfg)
// prepare auth center // prepare auth center
ctr = auth.New(&neofs.AuthmateNeoFS{ ctr = auth.New(&neofs.AuthmateNeoFS{
NeoFS: n, NeoFS: &neoFS,
}, key, getAccessBoxCacheConfig(v, l)) }, key, getAccessBoxCacheConfig(v, l))
handlerOptions := getHandlerOptions(v, l) handlerOptions := getHandlerOptions(v, l)

View file

@ -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. // AuthmateNeoFS is a mediator which implements authmate.NeoFS through NeoFS.
type AuthmateNeoFS struct { type AuthmateNeoFS struct {
NeoFS *NeoFS
} }
func (x *AuthmateNeoFS) CreateContainer(ctx context.Context, prm authmate.PrmContainerCreate) (*cid.ID, error) { func (x *AuthmateNeoFS) CreateContainer(ctx context.Context, prm authmate.PrmContainerCreate) (*cid.ID, error) {