[#109] cmd/neofs-node: Activate Replicator

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-10-21 14:51:20 +03:00 committed by Alex Vanin
parent f66c7958e7
commit 334e0e6f0f
2 changed files with 19 additions and 0 deletions

View file

@ -84,6 +84,8 @@ const (
cfgPolicerWorkScope = "policer.work_scope"
cfgPolicerExpRate = "policer.expansion_rate"
cfgPolicerHeadTimeout = "policer.head_timeout"
cfgReplicatorPutTimeout = "replicator.put_timeout"
)
const (
@ -328,6 +330,8 @@ func defaultConfiguration(v *viper.Viper) {
v.SetDefault(cfgPolicerWorkScope, 100)
v.SetDefault(cfgPolicerExpRate, 10) // in %
v.SetDefault(cfgPolicerHeadTimeout, 5*time.Second)
v.SetDefault(cfgReplicatorPutTimeout, 5*time.Second)
}
func (c *cfg) LocalAddress() *network.Address {

View file

@ -35,6 +35,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/gc"
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement"
"github.com/nspcc-dev/neofs-node/pkg/services/policer"
"github.com/nspcc-dev/neofs-node/pkg/services/replicator"
"github.com/panjf2000/ants/v2"
"go.uber.org/zap"
)
@ -190,6 +191,19 @@ func initObjectService(c *cfg) {
c.workers = append(c.workers, objGC)
repl := replicator.New(
replicator.WithLogger(c.log),
replicator.WithPutTimeout(
c.viper.GetDuration(cfgReplicatorPutTimeout),
),
replicator.WithLocalStorage(ls),
replicator.WithRemoteSender(
putsvc.NewRemoteSender(keyStorage),
),
)
c.workers = append(c.workers, repl)
ch := make(chan *policer.Task, 1)
pol := policer.New(
@ -213,6 +227,7 @@ func initObjectService(c *cfg) {
policer.WithHeadTimeout(
c.viper.GetDuration(cfgPolicerHeadTimeout),
),
policer.WithReplicator(repl),
)
addNewEpochNotificationHandler(c, func(ev event.Event) {