2020-10-21 11:49:02 +00:00
|
|
|
package replicator
|
|
|
|
|
|
|
|
import (
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
|
|
|
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
|
|
|
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
2020-10-21 11:49:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Task represents group of Replicator task parameters.
|
|
|
|
type Task struct {
|
|
|
|
quantity uint32
|
|
|
|
|
2022-05-31 17:00:41 +00:00
|
|
|
addr oid.Address
|
2020-10-21 11:49:02 +00:00
|
|
|
|
2022-09-19 10:57:59 +00:00
|
|
|
obj *objectSDK.Object
|
|
|
|
|
2022-06-08 23:18:26 +00:00
|
|
|
nodes []netmap.NodeInfo
|
2020-10-21 11:49:02 +00:00
|
|
|
}
|
|
|
|
|
2022-09-19 11:01:19 +00:00
|
|
|
// SetCopiesNumber sets number of copies to replicate.
|
|
|
|
func (t *Task) SetCopiesNumber(v uint32) {
|
|
|
|
t.quantity = v
|
2020-10-21 11:49:02 +00:00
|
|
|
}
|
|
|
|
|
2022-09-19 11:01:19 +00:00
|
|
|
// SetObjectAddress sets address of local object.
|
|
|
|
func (t *Task) SetObjectAddress(v oid.Address) {
|
|
|
|
t.addr = v
|
2020-10-21 11:49:02 +00:00
|
|
|
}
|
|
|
|
|
2022-09-19 11:01:19 +00:00
|
|
|
// SetObject sets object to avoid fetching it from the local storage.
|
|
|
|
func (t *Task) SetObject(obj *objectSDK.Object) {
|
|
|
|
t.obj = obj
|
2022-09-19 10:57:59 +00:00
|
|
|
}
|
|
|
|
|
2022-09-19 11:01:19 +00:00
|
|
|
// SetNodes sets a list of potential object holders.
|
|
|
|
func (t *Task) SetNodes(v []netmap.NodeInfo) {
|
|
|
|
t.nodes = v
|
2020-10-21 11:49:02 +00:00
|
|
|
}
|