maintenance

package
v1.1.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidTask indicates that the task specified does not exist.
	ErrInvalidTask = errors.New("Invalid Task")

	// ErrInvalidOptions indicates that the options specified for a task are not valid.
	ErrInvalidOptions = errors.New("Invalid Options")
)
View Source
var (
	// ErrInvalidRate indicates that the rate specified for the task is not valid.
	ErrInvalidRate = errors.New("Invalid rate")
)

Functions

This section is empty.

Types

type ExpireFindingsTask

type ExpireFindingsTask struct {
	// contains filtered or unexported fields
}

ExpireFindingsTask is a maintenance task responsible for expiring the findings that are OPEN and have not been found for a configurable time span.

func (*ExpireFindingsTask) Execute

func (t *ExpireFindingsTask) Execute() (TaskResult, error)

Execute executes the ExpireFindingsTask.

func (*ExpireFindingsTask) Name

func (t *ExpireFindingsTask) Name() string

Name returns this task name.

func (*ExpireFindingsTask) Type

func (t *ExpireFindingsTask) Type() string

Type returns this task type.

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

Scheduler is responsible for scheduling and executing the maintenance tasks.

func NewScheduler

func NewScheduler(log *log.Logger, tasks []TaskSchedule) *Scheduler

NewScheduler creates a new maintenance scheduler with given tasks.

func (*Scheduler) AddTask

func (s *Scheduler) AddTask(task Task, rate int) error

AddTask adds a new task to the scheduler.

func (*Scheduler) Start

func (s *Scheduler) Start(ctx context.Context)

Start makes the scheduler start executing its tasks.

type Task

type Task interface {
	Name() string
	Type() string
	Execute() (TaskResult, error)
}

Task represents a maintenance task.

func NewTask

func NewTask(name, taskType string, opts interface{}, store store.VulnStore) (Task, error)

NewTask creates a new maintenance task given its name, rate and options.

type TaskResult

type TaskResult string

TaskResult is the resulting output from a task execution.

type TaskSchedule

type TaskSchedule struct {
	// contains filtered or unexported fields
}

TaskSchedule represents a task and its execution rate time in hours.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL