updater

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package updater is a generated GoMock package.

Package updater is a generated GoMock package.

Package updater is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	*Opts
	// contains filtered or unexported fields
}

Controller is a control structure for fetching, parsing, and updating a vulnstore.

func New

func New(opts *Opts) *Controller

New is a constructor for an Controller

func (*Controller) Start

func (u *Controller) Start(ctx context.Context) error

Start begins a long running update controller. cancel ctx to stop.

func (*Controller) Update

func (u *Controller) Update(ctx context.Context) error

Update triggers an update procedure. exported to make testing easier.

type Fetcher

type Fetcher interface {
	// Fetch should retrieve the target vulnerability data and return an io.ReadCloser
	// with the contents. Fetch should also return a string which can used to determine
	// if these contents should be applied to the vulnerability database. for example
	// a sha265 sum of a OVAL xml file.
	Fetch(context.Context) (io.ReadCloser, string, error)
}

Fetcher is an interface which is embedded into the Updater struct. When called the implementaiton should return an io.ReadCloser with contents of the target vulnerability data

type MockFetcher

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

MockFetcher is a mock of Fetcher interface

func NewMockFetcher

func NewMockFetcher(ctrl *gomock.Controller) *MockFetcher

NewMockFetcher creates a new mock instance

func (*MockFetcher) EXPECT

func (m *MockFetcher) EXPECT() *MockFetcherMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockFetcher) Fetch

func (m *MockFetcher) Fetch(arg0 context.Context) (io.ReadCloser, string, error)

Fetch mocks base method

type MockFetcherMockRecorder

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

MockFetcherMockRecorder is the mock recorder for MockFetcher

func (*MockFetcherMockRecorder) Fetch

func (mr *MockFetcherMockRecorder) Fetch(arg0 interface{}) *gomock.Call

Fetch indicates an expected call of Fetch

type MockParser

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

MockParser is a mock of Parser interface

func NewMockParser

func NewMockParser(ctrl *gomock.Controller) *MockParser

NewMockParser creates a new mock instance

func (*MockParser) EXPECT

func (m *MockParser) EXPECT() *MockParserMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockParser) Parse

func (m *MockParser) Parse(arg0 context.Context, arg1 io.ReadCloser) ([]*claircore.Vulnerability, error)

Parse mocks base method

type MockParserMockRecorder

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

MockParserMockRecorder is the mock recorder for MockParser

func (*MockParserMockRecorder) Parse

func (mr *MockParserMockRecorder) Parse(arg0, arg1 interface{}) *gomock.Call

Parse indicates an expected call of Parse

type MockUpdater

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

MockUpdater is a mock of Updater interface

func NewMockUpdater

func NewMockUpdater(ctrl *gomock.Controller) *MockUpdater

NewMockUpdater creates a new mock instance

func (*MockUpdater) EXPECT

func (m *MockUpdater) EXPECT() *MockUpdaterMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockUpdater) Fetch

func (m *MockUpdater) Fetch(arg0 context.Context) (io.ReadCloser, string, error)

Fetch mocks base method

func (*MockUpdater) Name

func (m *MockUpdater) Name() string

Name mocks base method

func (*MockUpdater) Parse

func (m *MockUpdater) Parse(arg0 context.Context, arg1 io.ReadCloser) ([]*claircore.Vulnerability, error)

Parse mocks base method

type MockUpdaterMockRecorder

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

MockUpdaterMockRecorder is the mock recorder for MockUpdater

func (*MockUpdaterMockRecorder) Fetch

func (mr *MockUpdaterMockRecorder) Fetch(arg0 interface{}) *gomock.Call

Fetch indicates an expected call of Fetch

func (*MockUpdaterMockRecorder) Name

func (mr *MockUpdaterMockRecorder) Name() *gomock.Call

Name indicates an expected call of Name

func (*MockUpdaterMockRecorder) Parse

func (mr *MockUpdaterMockRecorder) Parse(arg0, arg1 interface{}) *gomock.Call

Parse indicates an expected call of Parse

type Opts

type Opts struct {
	// an embedded updater interface
	driver.Updater
	// a unique name for this controller. must be unique between controllers
	Name string
	// store for persistence
	Store vulnstore.Updater
	// update interval
	Interval time.Duration
	// lock to ensure only process updating
	Lock distlock.Locker
	// immediately update on construction
	UpdateOnStart bool
}

Opts are options used to create an Updater

type Parser

type Parser interface {
	// Parse should take an io.ReadCloser, read the contents, parse the contents
	// into a list of claircore.Vulnerability structs and then return
	// the list. Parse should assume contents are uncompressed and ready for parsing.
	Parse(ctx context.Context, contents io.ReadCloser) ([]*claircore.Vulnerability, error)
}

Parser is an interface when called with an io.ReadCloser should parse the provided contents and return a list of *claircore.Vulnerabilities

type Updater

type Updater interface {
	Name() string
	Fetcher
	Parser
}

Updater is an aggregate interface combining the method set of a Fetcher and a Parser and forces a Name() to be provided

Jump to

Keyboard shortcuts

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