[#271] service/audit: Add netmap structure to audit task

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-12-23 12:51:37 +03:00 committed by Alex Vanin
parent 64b022a5ed
commit dd5e67ff0c
2 changed files with 18 additions and 1 deletions

View file

@ -90,7 +90,8 @@ func (ap *Processor) processStartAudit(epoch uint64) {
WithContainerID(containers[i]). WithContainerID(containers[i]).
WithStorageGroupList(storageGroups). WithStorageGroupList(storageGroups).
WithContainerStructure(cnr). WithContainerStructure(cnr).
WithContainerNodes(nodes) WithContainerNodes(nodes).
WithNetworkMap(nm)
if err := ap.taskManager.PushTask(auditTask); err != nil { if err := ap.taskManager.PushTask(auditTask); err != nil {
ap.log.Error("could not push audit task", ap.log.Error("could not push audit task",

View file

@ -18,6 +18,8 @@ type Task struct {
cnr *container.Container cnr *container.Container
nm *netmap.Netmap
cnrNodes netmap.ContainerNodes cnrNodes netmap.ContainerNodes
sgList []*object.ID sgList []*object.ID
@ -88,6 +90,20 @@ func (t *Task) WithContainerNodes(cnrNodes netmap.ContainerNodes) *Task {
return t return t
} }
// NetworkMap returns network map of audit epoch.
func (t *Task) NetworkMap() *netmap.Netmap {
return t.nm
}
// WithNetworkMap sets network map of audit epoch.
func (t *Task) WithNetworkMap(nm *netmap.Netmap) *Task {
if t != nil {
t.nm = nm
}
return t
}
// ContainerNodes returns nodes in the container under audit. // ContainerNodes returns nodes in the container under audit.
func (t *Task) ContainerNodes() netmap.ContainerNodes { func (t *Task) ContainerNodes() netmap.ContainerNodes {
return t.cnrNodes return t.cnrNodes