[#488] storage/config: Add wrapper and scripthash

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-04-29 08:32:24 +03:00 committed by Alex Vanin
parent ea781664cf
commit ad4a55468e

View file

@ -27,7 +27,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache" "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache"
"github.com/nspcc-dev/neofs-node/pkg/metrics" "github.com/nspcc-dev/neofs-node/pkg/metrics"
"github.com/nspcc-dev/neofs-node/pkg/morph/client" "github.com/nspcc-dev/neofs-node/pkg/morph/client"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" cntwrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
nmwrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper" nmwrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap/wrapper"
"github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/nspcc-dev/neofs-node/pkg/morph/event"
netmap2 "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap" netmap2 "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
@ -101,6 +101,7 @@ const (
cfgContainerWorkerPoolSize = "container.async_worker.size" cfgContainerWorkerPoolSize = "container.async_worker.size"
// config keys for cfgReputation // config keys for cfgReputation
cfgReputationContract = "reputation.scripthash"
cfgReputationAlpha = "reputation.alpha" cfgReputationAlpha = "reputation.alpha"
cfgReputationWorkerPoolEnabled = "reputation.async_worker.enabled" cfgReputationWorkerPoolEnabled = "reputation.async_worker.enabled"
cfgReputationWorkerPoolSize = "reputation.async_worker.size" cfgReputationWorkerPoolSize = "reputation.async_worker.size"
@ -297,7 +298,7 @@ type cfgObject struct {
cnrStorage container.Source cnrStorage container.Source
cnrClient *wrapper.Wrapper cnrClient *cntwrapper.Wrapper
pool cfgObjectRoutines pool cfgObjectRoutines
@ -327,6 +328,8 @@ type cfgReputation struct {
localTrustStorage *truststorage.Storage localTrustStorage *truststorage.Storage
localTrustCtrl *trustcontroller.Controller localTrustCtrl *trustcontroller.Controller
scriptHash util.Uint160
} }
const ( const (
@ -353,6 +356,10 @@ func initCfg(path string) *cfg {
viperCfg.GetString(cfgContainerContract)) viperCfg.GetString(cfgContainerContract))
fatalOnErr(err) fatalOnErr(err)
u160Reputation, err := util.Uint160DecodeStringLE(
viperCfg.GetString(cfgReputationContract))
fatalOnErr(err)
log, err := logger.NewLogger(viperCfg) log, err := logger.NewLogger(viperCfg)
fatalOnErr(err) fatalOnErr(err)
@ -422,6 +429,7 @@ func initCfg(path string) *cfg {
netStatus: atomic.NewInt32(int32(control.NetmapStatus_STATUS_UNDEFINED)), netStatus: atomic.NewInt32(int32(control.NetmapStatus_STATUS_UNDEFINED)),
healthStatus: atomic.NewInt32(int32(control.HealthStatus_HEALTH_STATUS_UNDEFINED)), healthStatus: atomic.NewInt32(int32(control.HealthStatus_HEALTH_STATUS_UNDEFINED)),
cfgReputation: cfgReputation{ cfgReputation: cfgReputation{
scriptHash: u160Reputation,
alpha: viper.GetFloat64(cfgReputationAlpha), alpha: viper.GetFloat64(cfgReputationAlpha),
workerPool: reputationWorkerPool, workerPool: reputationWorkerPool,
}, },