forked from TrueCloudLab/frostfs-node
[#1680] replicator: Work with netmap.NodeInfo
in TaskResult
Make `replicator.TaskResult` to accept `netmap.NodeInfo` type instead of uint64 in order to clarify the meaning and prevent passing the random numbers. Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
This commit is contained in:
parent
e6f8904040
commit
df5d7bf729
4 changed files with 20 additions and 11 deletions
|
@ -6,15 +6,15 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
|
||||
putsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/put"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/netmap"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// TaskResult is a replication result interface.
|
||||
type TaskResult interface {
|
||||
// SubmitSuccessfulReplication must save successful
|
||||
// replication result. ID is a netmap identification
|
||||
// of a node that accepted the replica.
|
||||
SubmitSuccessfulReplication(id uint64)
|
||||
// SubmitSuccessfulReplication submits the successful object replication
|
||||
// to the given node.
|
||||
SubmitSuccessfulReplication(netmap.NodeInfo)
|
||||
}
|
||||
|
||||
// HandleTask executes replication task inside invoking goroutine.
|
||||
|
@ -68,7 +68,7 @@ func (p *Replicator) HandleTask(ctx context.Context, task Task, res TaskResult)
|
|||
|
||||
task.quantity--
|
||||
|
||||
res.SubmitSuccessfulReplication(task.nodes[i].Hash())
|
||||
res.SubmitSuccessfulReplication(task.nodes[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue