frostfs-node/pkg/services/audit/auditor/exec.go

38 lines
588 B
Go
Raw Normal View History

package auditor
import (
"context"
"fmt"
)
// Execute audits container data.
func (c *Context) Execute(ctx context.Context, onCompleted func()) {
defer onCompleted()
c.init()
checks := []struct {
name string
exec func(context.Context)
}{
{name: "PoR", exec: c.executePoR},
{name: "PoP", exec: c.executePoP},
{name: "PDP", exec: c.executePDP},
}
for i := range checks {
c.log.Debug(fmt.Sprintf("executing %s check...", checks[i].name))
if c.expired(ctx) {
break
}
checks[i].exec(ctx)
if i == len(checks)-1 {
c.complete()
}
}
c.writeReport()
}