Documentation ¶
Index ¶
Constants ¶
const (
DefaultInterval = time.Duration(30 * time.Minute)
)
Variables ¶
var (
DefaultBatchSize = runtime.NumCPU()
)
Functions ¶
This section is empty.
Types ¶
type Configs ¶
type Configs map[string]driver.ConfigUnmarshaler
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager oversees the configuration and invocation of vulstore updaters.
The Manager may be used in a one-shot fashion, configured to run background jobs, or both.
func NewManager ¶
func NewManager(ctx context.Context, store vulnstore.Updater, pool *pgxpool.Pool, client *http.Client, opts ...ManagerOption) (*Manager, error)
NewManager will return a manager ready to have its Start or Run methods called.
type ManagerOption ¶
type ManagerOption func(m *Manager)
ManagerOption specify optional configuration for a Manager. Defaults will be used where options are not provided to the constructor.
func WithBatchSize ¶
func WithBatchSize(n int) ManagerOption
WithBatchSize sets the max number of parallel updaters that will run during an update interval.
func WithConfigs ¶
func WithConfigs(cfgs Configs) ManagerOption
WithConfigs tells the Manager to configure each updater where a configuration is provided.
Configuration of individual updaters is delegated to updater/registry.go Note: this option is optimal when ran after WithEnabled option. However, this option has no strict depedency on others.
func WithEnabled ¶
func WithEnabled(enabled []string) ManagerOption
WithEnabled configures the Manager to only run the specified updater sets.
If enabled == nil all default updater sets will run (same as not providing this option to the constructor at all). If len(enabled) == 0 no default updater sets will run. If len(enabled) > 0 only provided updater sets will be ran.
func WithGC ¶
func WithGC(retention int) ManagerOption
WithGC instructs the manager to run garbage collection at the end of an update interval.
The provided retention value informs the manager how many update operations to keep.
func WithInterval ¶
func WithInterval(interval time.Duration) ManagerOption
WithInterval configures the interval at which updaters will be ran. The manager runs all configured updaters during an interval. Setting this duration too low may cause missed update intervals.
func WithOutOfTree ¶
func WithOutOfTree(outOfTree []driver.Updater) ManagerOption
WithOutOfTree allows callers to provide their own out-of-tree updaters.
note: currently we will never configure the outOfTree updater factory. if this changes consider making this option a required to avoid missing configuration