[#7] Use container processor in inner ring

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-08-11 15:14:08 +03:00
parent c4cdfe3ec2
commit 7e099c7921
2 changed files with 25 additions and 1 deletions

View file

@ -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")
}

View file

@ -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
}