indexer

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package indexer is a generated GoMock package.

Package indexer is a generated GoMock package.

Package indexer is a generated GoMock package.

Package indexer is a generated GoMock package.

Package indexer is a generated GoMock package.

Package indexer is a generated GoMock package.

Package indexer is a generated GoMock package.

Package indexer is a generated GoMock package.

Index

Constants

View Source
const (
	Package = "package"
)

Variables

This section is empty.

Functions

func EcosystemsToScanners

func EcosystemsToScanners(ctx context.Context, ecosystems []*Ecosystem, disallowRemote bool) ([]PackageScanner, []DistributionScanner, []RepositoryScanner, error)

EcosystemsToScanners extracts and dedupes multiple ecosystems and returns their discrete scanners

Types

type Coalescer

type Coalescer interface {
	Coalesce(ctx context.Context, artifacts []*LayerArtifacts) (*claircore.IndexReport, error)
}

Coalescer takes a set of layers and creates coalesced IndexReport.

A coalesced IndexReport should provide only the packages present in the final container image once all layers were applied.

type ConfigDeserializer added in v0.0.24

type ConfigDeserializer func(interface{}) error

ConfigDeserializer can be thought of as an Unmarshal function with the byte slice provided.

This will typically be something like (*json.Decoder).Decode.

type ConfigurableScanner added in v0.0.24

type ConfigurableScanner interface {
	Configure(context.Context, ConfigDeserializer) error
}

ConfigurableScanner is an interface scanners can implement to receive configuration.

type DistributionScanner

type DistributionScanner interface {
	VersionedScanner
	Scan(context.Context, *claircore.Layer) ([]*claircore.Distribution, error)
}

type Ecosystem

type Ecosystem struct {
	Name                 string
	PackageScanners      func(ctx context.Context) ([]PackageScanner, error)
	DistributionScanners func(ctx context.Context) ([]DistributionScanner, error)
	RepositoryScanners   func(ctx context.Context) ([]RepositoryScanner, error)
	Coalescer            func(ctx context.Context) (Coalescer, error)
}

Ecosystems group together scanners and a Coalescer which are commonly used together.

A typical ecosystem is "DPKG" which will use the DPKG package indexer, the "OS-Release" distribution scanner and the "APT" repository scanner.

A Controller will scan layers with all scanners present in its configured ecosystems.

type Fetcher

type Fetcher interface {
	Fetch(ctx context.Context, layers []*claircore.Layer) error
	Close() error
}

Fetcher is responsible for downloading a layer, uncompressing if ncessary, and making the uncompressed tar contents availble for reading.

type Indexer added in v0.0.24

type Indexer interface {
	// IndexPackages indexes a package into the persistence layer.
	IndexPackages(ctx context.Context, pkgs []*claircore.Package, layer *claircore.Layer, scnr VersionedScanner) error
	// IndexDistributions indexes distributions into the persistence layer.
	IndexDistributions(ctx context.Context, dists []*claircore.Distribution, layer *claircore.Layer, scnr VersionedScanner) error
	// IndexRepositories indexes repositories into the persistence layer.
	IndexRepositories(ctx context.Context, repos []*claircore.Repository, layer *claircore.Layer, scnr VersionedScanner) error
	// IndexManifest should index the coalesced manifest's content given an IndexReport.
	IndexManifest(ctx context.Context, ir *claircore.IndexReport) error
}

Indexer interface provide the method set required for indexing layer and manifest contents into a persistent store.

type LayerArtifacts added in v0.0.14

type LayerArtifacts struct {
	Hash  claircore.Digest
	Pkgs  []*claircore.Package
	Dist  []*claircore.Distribution // each layer can only have a single distribution
	Repos []*claircore.Repository
}

layerArifact aggregates the any artifacts found within a layer

type LayerFetchOpt

type LayerFetchOpt string

LayerFetchOpt tells libindex where to store fetched layers

const (
	// OnDisk - layers will be fetched via HTTP and writen to disk. When scanned the contents will be read from a fd.
	OnDisk LayerFetchOpt = "ondisk"
	// InMem - layers will be fetched via HTTP and writen to the layer's in memory byte array. When scanned the contents will be read from this in memory byte array
	InMem LayerFetchOpt = "inmem"
	// Tee - layers will be fetched via HTTP and written both the layer's in memory byte array and onto disk.
	Tee LayerFetchOpt = "tee"
)

type LayerScanner

type LayerScanner interface {
	Scan(ctx context.Context, manifest claircore.Digest, layers []*claircore.Layer) error
}

LayerScanner is an interface for scanning a set of layer's contents and indexing discovered items into the persistence layer. scanning mechanics (concurrency, ordering, etc...) will be defined by implementations.

type MockCoalescer

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

MockCoalescer is a mock of Coalescer interface

func NewMockCoalescer

func NewMockCoalescer(ctrl *gomock.Controller) *MockCoalescer

NewMockCoalescer creates a new mock instance

func (*MockCoalescer) Coalesce

func (m *MockCoalescer) Coalesce(arg0 context.Context, arg1 []*LayerArtifacts) (*claircore.IndexReport, error)

Coalesce mocks base method

func (*MockCoalescer) EXPECT

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

type MockCoalescerMockRecorder

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

MockCoalescerMockRecorder is the mock recorder for MockCoalescer

func (*MockCoalescerMockRecorder) Coalesce

func (mr *MockCoalescerMockRecorder) Coalesce(arg0, arg1 interface{}) *gomock.Call

Coalesce indicates an expected call of Coalesce

type MockDistributionScanner

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

MockDistributionScanner is a mock of DistributionScanner interface

func NewMockDistributionScanner

func NewMockDistributionScanner(ctrl *gomock.Controller) *MockDistributionScanner

NewMockDistributionScanner creates a new mock instance

func (*MockDistributionScanner) EXPECT

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

func (*MockDistributionScanner) Kind

func (m *MockDistributionScanner) Kind() string

Kind mocks base method

func (*MockDistributionScanner) Name

func (m *MockDistributionScanner) Name() string

Name mocks base method

func (*MockDistributionScanner) Scan

Scan mocks base method

func (*MockDistributionScanner) Version

func (m *MockDistributionScanner) Version() string

Version mocks base method

type MockDistributionScannerMockRecorder

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

MockDistributionScannerMockRecorder is the mock recorder for MockDistributionScanner

func (*MockDistributionScannerMockRecorder) Kind

Kind indicates an expected call of Kind

func (*MockDistributionScannerMockRecorder) Name

Name indicates an expected call of Name

func (*MockDistributionScannerMockRecorder) Scan

func (mr *MockDistributionScannerMockRecorder) Scan(arg0, arg1 interface{}) *gomock.Call

Scan indicates an expected call of Scan

func (*MockDistributionScannerMockRecorder) Version

Version indicates an expected call of Version

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) Close added in v0.0.13

func (m *MockFetcher) Close() error

Close mocks base method

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, arg1 []*claircore.Layer) error

Fetch mocks base method

type MockFetcherMockRecorder

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

MockFetcherMockRecorder is the mock recorder for MockFetcher

func (*MockFetcherMockRecorder) Close added in v0.0.13

func (mr *MockFetcherMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockFetcherMockRecorder) Fetch

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

Fetch indicates an expected call of Fetch

type MockLayerScanner

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

MockLayerScanner is a mock of LayerScanner interface

func NewMockLayerScanner

func NewMockLayerScanner(ctrl *gomock.Controller) *MockLayerScanner

NewMockLayerScanner creates a new mock instance

func (*MockLayerScanner) EXPECT

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

func (*MockLayerScanner) Scan

func (m *MockLayerScanner) Scan(arg0 context.Context, arg1 claircore.Digest, arg2 []*claircore.Layer) error

Scan mocks base method

type MockLayerScannerMockRecorder

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

MockLayerScannerMockRecorder is the mock recorder for MockLayerScanner

func (*MockLayerScannerMockRecorder) Scan

func (mr *MockLayerScannerMockRecorder) Scan(arg0, arg1, arg2 interface{}) *gomock.Call

Scan indicates an expected call of Scan

type MockPackageScanner

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

MockPackageScanner is a mock of PackageScanner interface

func NewMockPackageScanner

func NewMockPackageScanner(ctrl *gomock.Controller) *MockPackageScanner

NewMockPackageScanner creates a new mock instance

func (*MockPackageScanner) EXPECT

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

func (*MockPackageScanner) Kind

func (m *MockPackageScanner) Kind() string

Kind mocks base method

func (*MockPackageScanner) Name

func (m *MockPackageScanner) Name() string

Name mocks base method

func (*MockPackageScanner) Scan

Scan mocks base method

func (*MockPackageScanner) Version

func (m *MockPackageScanner) Version() string

Version mocks base method

type MockPackageScannerMockRecorder

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

MockPackageScannerMockRecorder is the mock recorder for MockPackageScanner

func (*MockPackageScannerMockRecorder) Kind

Kind indicates an expected call of Kind

func (*MockPackageScannerMockRecorder) Name

Name indicates an expected call of Name

func (*MockPackageScannerMockRecorder) Scan

func (mr *MockPackageScannerMockRecorder) Scan(arg0, arg1 interface{}) *gomock.Call

Scan indicates an expected call of Scan

func (*MockPackageScannerMockRecorder) Version

Version indicates an expected call of Version

type MockRepositoryScanner

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

MockRepositoryScanner is a mock of RepositoryScanner interface

func NewMockRepositoryScanner

func NewMockRepositoryScanner(ctrl *gomock.Controller) *MockRepositoryScanner

NewMockRepositoryScanner creates a new mock instance

func (*MockRepositoryScanner) EXPECT

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

func (*MockRepositoryScanner) Kind

func (m *MockRepositoryScanner) Kind() string

Kind mocks base method

func (*MockRepositoryScanner) Name

func (m *MockRepositoryScanner) Name() string

Name mocks base method

func (*MockRepositoryScanner) Scan

Scan mocks base method

func (*MockRepositoryScanner) Version

func (m *MockRepositoryScanner) Version() string

Version mocks base method

type MockRepositoryScannerMockRecorder

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

MockRepositoryScannerMockRecorder is the mock recorder for MockRepositoryScanner

func (*MockRepositoryScannerMockRecorder) Kind

Kind indicates an expected call of Kind

func (*MockRepositoryScannerMockRecorder) Name

Name indicates an expected call of Name

func (*MockRepositoryScannerMockRecorder) Scan

func (mr *MockRepositoryScannerMockRecorder) Scan(arg0, arg1 interface{}) *gomock.Call

Scan indicates an expected call of Scan

func (*MockRepositoryScannerMockRecorder) Version

Version indicates an expected call of Version

type MockStore

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

MockStore is a mock of Store interface

func NewMockStore

func NewMockStore(ctrl *gomock.Controller) *MockStore

NewMockStore creates a new mock instance

func (*MockStore) AffectedManifests added in v0.0.24

func (m *MockStore) AffectedManifests(arg0 context.Context, arg1 claircore.Vulnerability) ([]claircore.Digest, error)

AffectedManifests mocks base method

func (*MockStore) Close added in v0.0.16

func (m *MockStore) Close(arg0 context.Context) error

Close mocks base method

func (*MockStore) DistributionsByLayer

func (m *MockStore) DistributionsByLayer(arg0 context.Context, arg1 claircore.Digest, arg2 VersionedScanners) ([]*claircore.Distribution, error)

DistributionsByLayer mocks base method

func (*MockStore) EXPECT

func (m *MockStore) EXPECT() *MockStoreMockRecorder

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

func (*MockStore) IndexDistributions

func (m *MockStore) IndexDistributions(arg0 context.Context, arg1 []*claircore.Distribution, arg2 *claircore.Layer, arg3 VersionedScanner) error

IndexDistributions mocks base method

func (*MockStore) IndexManifest added in v0.0.24

func (m *MockStore) IndexManifest(arg0 context.Context, arg1 *claircore.IndexReport) error

IndexManifest mocks base method

func (*MockStore) IndexPackages

func (m *MockStore) IndexPackages(arg0 context.Context, arg1 []*claircore.Package, arg2 *claircore.Layer, arg3 VersionedScanner) error

IndexPackages mocks base method

func (*MockStore) IndexReport

func (m *MockStore) IndexReport(arg0 context.Context, arg1 claircore.Digest) (*claircore.IndexReport, bool, error)

IndexReport mocks base method

func (*MockStore) IndexRepositories

func (m *MockStore) IndexRepositories(arg0 context.Context, arg1 []*claircore.Repository, arg2 *claircore.Layer, arg3 VersionedScanner) error

IndexRepositories mocks base method

func (*MockStore) LayerScanned

func (m *MockStore) LayerScanned(arg0 context.Context, arg1 claircore.Digest, arg2 VersionedScanner) (bool, error)

LayerScanned mocks base method

func (*MockStore) ManifestScanned

func (m *MockStore) ManifestScanned(arg0 context.Context, arg1 claircore.Digest, arg2 VersionedScanners) (bool, error)

ManifestScanned mocks base method

func (*MockStore) PackagesByLayer

func (m *MockStore) PackagesByLayer(arg0 context.Context, arg1 claircore.Digest, arg2 VersionedScanners) ([]*claircore.Package, error)

PackagesByLayer mocks base method

func (*MockStore) PersistManifest added in v0.0.21

func (m *MockStore) PersistManifest(arg0 context.Context, arg1 claircore.Manifest) error

PersistManifest mocks base method

func (*MockStore) RegisterScanners

func (m *MockStore) RegisterScanners(arg0 context.Context, arg1 VersionedScanners) error

RegisterScanners mocks base method

func (*MockStore) RepositoriesByLayer

func (m *MockStore) RepositoriesByLayer(arg0 context.Context, arg1 claircore.Digest, arg2 VersionedScanners) ([]*claircore.Repository, error)

RepositoriesByLayer mocks base method

func (*MockStore) SetIndexFinished

func (m *MockStore) SetIndexFinished(arg0 context.Context, arg1 *claircore.IndexReport, arg2 VersionedScanners) error

SetIndexFinished mocks base method

func (*MockStore) SetIndexReport

func (m *MockStore) SetIndexReport(arg0 context.Context, arg1 *claircore.IndexReport) error

SetIndexReport mocks base method

func (*MockStore) SetLayerScanned added in v0.0.21

func (m *MockStore) SetLayerScanned(arg0 context.Context, arg1 claircore.Digest, arg2 VersionedScanner) error

SetLayerScanned mocks base method

type MockStoreMockRecorder

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

MockStoreMockRecorder is the mock recorder for MockStore

func (*MockStoreMockRecorder) AffectedManifests added in v0.0.24

func (mr *MockStoreMockRecorder) AffectedManifests(arg0, arg1 interface{}) *gomock.Call

AffectedManifests indicates an expected call of AffectedManifests

func (*MockStoreMockRecorder) Close added in v0.0.16

func (mr *MockStoreMockRecorder) Close(arg0 interface{}) *gomock.Call

Close indicates an expected call of Close

func (*MockStoreMockRecorder) DistributionsByLayer

func (mr *MockStoreMockRecorder) DistributionsByLayer(arg0, arg1, arg2 interface{}) *gomock.Call

DistributionsByLayer indicates an expected call of DistributionsByLayer

func (*MockStoreMockRecorder) IndexDistributions

func (mr *MockStoreMockRecorder) IndexDistributions(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

IndexDistributions indicates an expected call of IndexDistributions

func (*MockStoreMockRecorder) IndexManifest added in v0.0.24

func (mr *MockStoreMockRecorder) IndexManifest(arg0, arg1 interface{}) *gomock.Call

IndexManifest indicates an expected call of IndexManifest

func (*MockStoreMockRecorder) IndexPackages

func (mr *MockStoreMockRecorder) IndexPackages(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

IndexPackages indicates an expected call of IndexPackages

func (*MockStoreMockRecorder) IndexReport

func (mr *MockStoreMockRecorder) IndexReport(arg0, arg1 interface{}) *gomock.Call

IndexReport indicates an expected call of IndexReport

func (*MockStoreMockRecorder) IndexRepositories

func (mr *MockStoreMockRecorder) IndexRepositories(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

IndexRepositories indicates an expected call of IndexRepositories

func (*MockStoreMockRecorder) LayerScanned

func (mr *MockStoreMockRecorder) LayerScanned(arg0, arg1, arg2 interface{}) *gomock.Call

LayerScanned indicates an expected call of LayerScanned

func (*MockStoreMockRecorder) ManifestScanned

func (mr *MockStoreMockRecorder) ManifestScanned(arg0, arg1, arg2 interface{}) *gomock.Call

ManifestScanned indicates an expected call of ManifestScanned

func (*MockStoreMockRecorder) PackagesByLayer

func (mr *MockStoreMockRecorder) PackagesByLayer(arg0, arg1, arg2 interface{}) *gomock.Call

PackagesByLayer indicates an expected call of PackagesByLayer

func (*MockStoreMockRecorder) PersistManifest added in v0.0.21

func (mr *MockStoreMockRecorder) PersistManifest(arg0, arg1 interface{}) *gomock.Call

PersistManifest indicates an expected call of PersistManifest

func (*MockStoreMockRecorder) RegisterScanners

func (mr *MockStoreMockRecorder) RegisterScanners(arg0, arg1 interface{}) *gomock.Call

RegisterScanners indicates an expected call of RegisterScanners

func (*MockStoreMockRecorder) RepositoriesByLayer

func (mr *MockStoreMockRecorder) RepositoriesByLayer(arg0, arg1, arg2 interface{}) *gomock.Call

RepositoriesByLayer indicates an expected call of RepositoriesByLayer

func (*MockStoreMockRecorder) SetIndexFinished

func (mr *MockStoreMockRecorder) SetIndexFinished(arg0, arg1, arg2 interface{}) *gomock.Call

SetIndexFinished indicates an expected call of SetIndexFinished

func (*MockStoreMockRecorder) SetIndexReport

func (mr *MockStoreMockRecorder) SetIndexReport(arg0, arg1 interface{}) *gomock.Call

SetIndexReport indicates an expected call of SetIndexReport

func (*MockStoreMockRecorder) SetLayerScanned added in v0.0.21

func (mr *MockStoreMockRecorder) SetLayerScanned(arg0, arg1, arg2 interface{}) *gomock.Call

SetLayerScanned indicates an expected call of SetLayerScanned

type MockVersionedScanner

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

MockVersionedScanner is a mock of VersionedScanner interface

func NewMockVersionedScanner

func NewMockVersionedScanner(ctrl *gomock.Controller) *MockVersionedScanner

NewMockVersionedScanner creates a new mock instance

func (*MockVersionedScanner) EXPECT

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

func (*MockVersionedScanner) Kind

func (m *MockVersionedScanner) Kind() string

Kind mocks base method

func (*MockVersionedScanner) Name

func (m *MockVersionedScanner) Name() string

Name mocks base method

func (*MockVersionedScanner) Version

func (m *MockVersionedScanner) Version() string

Version mocks base method

type MockVersionedScannerMockRecorder

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

MockVersionedScannerMockRecorder is the mock recorder for MockVersionedScanner

func (*MockVersionedScannerMockRecorder) Kind

Kind indicates an expected call of Kind

func (*MockVersionedScannerMockRecorder) Name

Name indicates an expected call of Name

func (*MockVersionedScannerMockRecorder) Version

Version indicates an expected call of Version

type Opts

type Opts struct {
	Store         Store
	ScanLock      distlock.Locker
	LayerScanner  LayerScanner
	Fetcher       Fetcher
	Ecosystems    []*Ecosystem
	Vscnrs        VersionedScanners
	Airgap        bool
	Client        *http.Client
	ScannerConfig struct {
		Package, Dist, Repo map[string]func(interface{}) error
	}
}

Opts are options to instantiate a indexer

type PackageScanner

type PackageScanner interface {
	VersionedScanner
	// Scan performs a package scan on the given layer and returns all
	// the found packages
	Scan(context.Context, *claircore.Layer) ([]*claircore.Package, error)
}

PackageScanner provides an interface for unique identification or a PackageScanner and a Scan method for extracting installed packages from an individual container layer

func NewPackageScannerMock

func NewPackageScannerMock(name, version, kind string) PackageScanner

type Querier added in v0.0.24

type Querier interface {
	// ManifestScanned returns whether the given manifest was scanned by the provided scanners.
	ManifestScanned(ctx context.Context, hash claircore.Digest, scnrs VersionedScanners) (bool, error)
	// LayerScanned returns whether the given layer was scanned by the provided scanner.
	LayerScanned(ctx context.Context, hash claircore.Digest, scnr VersionedScanner) (bool, error)
	// PackagesByLayer gets all the packages found in a layer limited by the provided scanners.
	PackagesByLayer(ctx context.Context, hash claircore.Digest, scnrs VersionedScanners) ([]*claircore.Package, error)
	// DistributionsByLayer gets all the distributions found in a layer limited by the provided scanners.
	DistributionsByLayer(ctx context.Context, hash claircore.Digest, scnrs VersionedScanners) ([]*claircore.Distribution, error)
	// RepositoriesByLayer gets all the repositories found in a layer limited by the provided scanners.
	RepositoriesByLayer(ctx context.Context, hash claircore.Digest, scnrs VersionedScanners) ([]*claircore.Repository, error)
	// IndexReport attempts to retrieve a persisted IndexReport.
	IndexReport(ctx context.Context, hash claircore.Digest) (*claircore.IndexReport, bool, error)
	// AffectedManifests returns a list of manifest digests which the target vulnerability
	// affects.
	AffectedManifests(ctx context.Context, v claircore.Vulnerability) ([]claircore.Digest, error)
}

Querier interface provides the method set to ascertain indexed artifacts and query whether a layer or manifest has been scanned.

type RPCScanner added in v0.0.24

type RPCScanner interface {
	Configure(context.Context, ConfigDeserializer, *http.Client) error
}

RPCScanner is an interface scanners can implement to receive configuration and denote that they expect to be able to talk to the network at run time.

type RepositoryScanner

type RepositoryScanner interface {
	VersionedScanner
	Scan(context.Context, *claircore.Layer) ([]*claircore.Repository, error)
}

type Setter added in v0.0.24

type Setter interface {
	// PersistManifest must store the presence of a manifest and it's layers into the system.
	//
	// Typically this will write into identity tables so later methods have a foreign key
	// to reference and data integrity is applied.
	PersistManifest(ctx context.Context, manifest claircore.Manifest) error
	// SetLayerScanned marks the provided layer hash successfully scanned by the provided versioned scanner.
	//
	// After this method is returned a call to Querier.LayerScanned with the same arguments must return true.
	SetLayerScanned(ctx context.Context, hash claircore.Digest, scnr VersionedScanner) error
	// RegisterPackageScanners registers the provided scanners with the persistence layer.
	RegisterScanners(ctx context.Context, scnrs VersionedScanners) error
	// SetIndexReport persists the current state of the IndexReport.
	//
	// IndexReports maybe in intermediate states to provide feedback for clients. this method should be
	// used to communicate scanning state updates. to signal the scan has completely successfully
	// see SetIndexFinished.
	SetIndexReport(context.Context, *claircore.IndexReport) error
	// SetIndexFinished marks a scan successfully completed.
	//
	// After this method returns a call to Querier.ManifestScanned with the manifest hash represted in the provided IndexReport
	// must return true.
	//
	// Also a call to Querier.IndexReport with the manifest hash represted in the provided IndexReport must return the IndexReport
	// in finished state.
	SetIndexFinished(ctx context.Context, sr *claircore.IndexReport, scnrs VersionedScanners) error
}

Setter interface provides the method set for required marking events, or registering components, associated with an Index operation.

type Store

type Store interface {
	Setter
	Querier
	Indexer
	// Close frees any resources associated with the Store.
	Close(context.Context) error
}

Store is an interface for dealing with objects libindex needs to persist. Stores may be implemented per storage backend.

type VersionedScanner

type VersionedScanner interface {
	// unique name of the distribution scanner.
	Name() string
	// version of this scanner. this information will be persisted with the scan.
	Version() string
	// the kind of scanner. currently only package is implemented
	Kind() string
}

VersionedScanner can be embedded into specific scanner types. This allows for methods and functions which only need to compare names and versions of scanners not to require each scanner type as an argument.

type VersionedScanners

type VersionedScanners []VersionedScanner

VersionedScanners implements a list with construction methods not concurrency safe

func MergeVS

func MergeVS(pscnr []PackageScanner, dscnr []DistributionScanner, rscnr []RepositoryScanner) VersionedScanners

MergeVS merges lists of scanners into a single list of VersionedScanner types

func (*VersionedScanners) DStoVS

func (vs *VersionedScanners) DStoVS(scnrs []DistributionScanner)

DStoVS takes an array of DistributionScanners and appends VersionedScanners with VersionScanner types.

func (*VersionedScanners) PStoVS

func (vs *VersionedScanners) PStoVS(scnrs []PackageScanner)

func (*VersionedScanners) RStoVS

func (vs *VersionedScanners) RStoVS(scnrs []RepositoryScanner)

RStoVS takes an array of RepositoryScanners and appends VersionedScanners with VersionScanner types.

func (VersionedScanners) VStoDS

func (vs VersionedScanners) VStoDS() []DistributionScanner

VStoDS returns an array of DistributionScanners

func (VersionedScanners) VStoPS

func (vs VersionedScanners) VStoPS() []PackageScanner

VStoPS returns an array of PackageScanners

func (VersionedScanners) VStoRS

func (vs VersionedScanners) VStoRS() []RepositoryScanner

VStoRS returns an array of RepositoryScanners

Directories

Path Synopsis
Package postgres implements the indexer store interface for a PostgreSQL database.
Package postgres implements the indexer store interface for a PostgreSQL database.

Jump to

Keyboard shortcuts

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