From df8a3807fef9fb2237637c31ee5e7bb2a5d7c2cc Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 10 Jun 2022 19:49:12 +0300 Subject: [PATCH] [#1508] node: Remove unused replicator code The node does not support asynchronous object replication anymore, so it does not need to have replicator worker, channel and `AddTask` function. Signed-off-by: Pavel Karpy --- cmd/neofs-node/object.go | 2 -- pkg/services/replicator/process.go | 33 --------------------------- pkg/services/replicator/replicator.go | 4 ---- pkg/services/replicator/task.go | 11 --------- 4 files changed, 50 deletions(-) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index cad4baf2e..b5a5f6651 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -217,8 +217,6 @@ func initObjectService(c *cfg) { ), ) - c.workers = append(c.workers, repl) - pol := policer.New( policer.WithLogger(c.log), policer.WithLocalStorage(ls), diff --git a/pkg/services/replicator/process.go b/pkg/services/replicator/process.go index 3ea435ffb..e29af250c 100644 --- a/pkg/services/replicator/process.go +++ b/pkg/services/replicator/process.go @@ -9,39 +9,6 @@ import ( "go.uber.org/zap" ) -func (p *Replicator) Run(ctx context.Context) { - defer func() { - close(p.ch) - p.log.Info("routine stopped") - }() - - p.ch = make(chan *Task, p.taskCap) - - p.log.Info("process routine", - zap.Uint32("task queue capacity", p.taskCap), - zap.Duration("put timeout", p.putTimeout), - ) - - for { - select { - case <-ctx.Done(): - p.log.Warn("context is done", - zap.String("error", ctx.Err().Error()), - ) - - return - case task, ok := <-p.ch: - if !ok { - p.log.Warn("trigger channel is closed") - - return - } - - p.HandleTask(ctx, task) - } - } -} - // HandleTask executes replication task inside invoking goroutine. func (p *Replicator) HandleTask(ctx context.Context, task *Task) { defer func() { diff --git a/pkg/services/replicator/replicator.go b/pkg/services/replicator/replicator.go index 9fc1c1a82..54cdb4bd3 100644 --- a/pkg/services/replicator/replicator.go +++ b/pkg/services/replicator/replicator.go @@ -13,16 +13,12 @@ import ( // local objects to remote nodes. type Replicator struct { *cfg - - ch chan *Task } // Option is an option for Policer constructor. type Option func(*cfg) type cfg struct { - taskCap uint32 - putTimeout time.Duration log *logger.Logger diff --git a/pkg/services/replicator/task.go b/pkg/services/replicator/task.go index ad7178bd9..d40cde6b1 100644 --- a/pkg/services/replicator/task.go +++ b/pkg/services/replicator/task.go @@ -14,17 +14,6 @@ type Task struct { nodes netmap.Nodes } -// AddTask pushes replication task to Replicator queue. -// -// If task queue is full, log message is written. -func (p *Replicator) AddTask(t *Task) { - select { - case p.ch <- t: - default: - p.log.Warn("task queue is full") - } -} - // WithCopiesNumber sets number of copies to replicate. func (t *Task) WithCopiesNumber(v uint32) *Task { if t != nil {