controller

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeSR

func MergeSR(source *claircore.IndexReport, merge []*claircore.IndexReport) *claircore.IndexReport

MergeSR merges IndexReports.

source is the IndexReport that the indexer is working on. merge is an array IndexReports returned from coalescers

Types

type Controller

type Controller struct {
	// holds dependencies for a indexer.controller
	*indexer.Opts
	// contains filtered or unexported fields
}

Controller is a control structure for scanning a manifest.

Controller is implemented as an FSM.

func New

func New(opts *indexer.Opts) *Controller

New constructs a controller given an Opts struct

func (*Controller) Index added in v0.0.8

func (s *Controller) Index(ctx context.Context, manifest *claircore.Manifest) (*claircore.IndexReport, error)

Index kicks off an index of a particular manifest. Initial state set in constructor.

type State

type State int

State is a specific state in the indexer fsm

const (
	// Terminal is the state which halts the fsm and returns the current s.result to the caller
	Terminal State = iota
	// CheckManifest determines if the manifest should be scanned.
	// if no Terminal is returned and we return the existing IndexReport.
	// Transitions: FetchLayers, Terminal
	CheckManifest
	// FetchLayers retrieves all the layers in a manifest and stacks them the same obtain the file image contents.
	// creates the "image" layer
	// Transitions: LayerScan
	FetchLayers
	// ScanLayers scans each image including the image layer and indexes the contents
	// Transitions: BuildLayerResult
	ScanLayers
	// Coalesce runs each provided ecosystem's coalescer and merges their scan results
	// Transitions: IndexManifest
	Coalesce
	// IndexManifest evaluates a coalesced IndexReport and writes it's contents
	// to the the persistence layer where it maybe searched.
	// Transitions: IndexFinished
	IndexManifest
	// IndexError state indicates a impassable error has occurred.
	// returns a ScanResult with the error field
	// Transitions: Terminal
	IndexError
	// IndexFinished state is the terminal state and should return a IndexReport
	// to the caller of Scan()
	// Transitions: Terminal
	IndexFinished
)

States and their explanations. Each state is implemented by a stateFunc implemented in their own files.

func (*State) FromString

func (ss *State) FromString(state string)

func (State) MarshalJSON

func (ss State) MarshalJSON() ([]byte, error)

func (State) String

func (ss State) String() string

func (*State) UnmarshalJSON

func (ss *State) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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