From 7e099c7921390af868c5af74d21d05f13c89622e Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 11 Aug 2020 15:14:08 +0300 Subject: [PATCH] [#7] Use container processor in inner ring Signed-off-by: Alex Vanin --- cmd/neofs-ir/defaults.go | 2 ++ pkg/innerring/innerring.go | 24 +++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index 4f3447d50..c2017e5d2 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -63,6 +63,7 @@ func defaultConfiguration(cfg *viper.Viper) { cfg.SetDefault("contracts.netmap", "") cfg.SetDefault("contracts.neofs", "") cfg.SetDefault("contracts.balance", "") + cfg.SetDefault("contracts.container", "") // gas native contract in LE cfg.SetDefault("contracts.gas", "668e0c1f9d7b70a99dd9e06eadd4c784d641afbc") @@ -71,4 +72,5 @@ func defaultConfiguration(cfg *viper.Viper) { cfg.SetDefault("workers.netmap", "10") cfg.SetDefault("workers.balance", "10") cfg.SetDefault("workers.neofs", "10") + cfg.SetDefault("workers.container", "10") } diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 0b486b90c..a8b1ad9d5 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -9,6 +9,7 @@ import ( crypto "github.com/nspcc-dev/neofs-crypto" "github.com/nspcc-dev/neofs-node/pkg/innerring/invoke" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/balance" + "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/container" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/neofs" "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/netmap" "github.com/nspcc-dev/neofs-node/pkg/innerring/timers" @@ -158,7 +159,22 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } - // todo: create container processor + // container processor + containerProcessor, err := container.New(&container.Params{ + Log: log, + PoolSize: cfg.GetInt("workers.container"), + ContainerContract: contracts.container, + MorphClient: server.morphClient, + ActiveState: server, + }) + if err != nil { + return nil, err + } + + err = bindMorphProcessor(containerProcessor, server) + if err != nil { + return nil, err + } // create balance processor balanceProcessor, err := balance.New(&balance.Params{ @@ -253,6 +269,7 @@ func parseContracts(cfg *viper.Viper) (*contracts, error) { neofsContractStr := cfg.GetString("contracts.neofs") balanceContractStr := cfg.GetString("contracts.balance") nativeGasContractStr := cfg.GetString("contracts.gas") + containerContractStr := cfg.GetString("contracts.container") result.netmap, err = util.Uint160DecodeStringLE(netmapContractStr) if err != nil { @@ -274,6 +291,11 @@ func parseContracts(cfg *viper.Viper) (*contracts, error) { return nil, errors.Wrap(err, "ir: can't read native gas script-hash") } + result.container, err = util.Uint160DecodeStringLE(containerContractStr) + if err != nil { + return nil, errors.Wrap(err, "ir: can't read container script-hash") + } + return result, nil }