postgres

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GCThrottle sets a limit for the number of deleted update operations
	// (and subsequent cascade deletes in the uo_vuln table) that can occur in a GC run.
	GCThrottle = 50
)

Variables

This section is empty.

Functions

func TestDB added in v0.1.0

func TestDB(ctx context.Context, t testing.TB) *pgxpool.Pool

Types

type Store

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

store implements all interfaces in the vulnstore package

func NewVulnStore

func NewVulnStore(pool *pgxpool.Pool) *Store

func (*Store) DeleteUpdateOperations added in v0.0.18

func (s *Store) DeleteUpdateOperations(ctx context.Context, id ...uuid.UUID) (int64, error)

DeleteUpdateOperations implements vulnstore.Updater.

func (*Store) GC added in v0.2.0

func (s *Store) GC(ctx context.Context, keep int) (int64, error)

GC is split into two phases, first it will identify any update operations which are older then the provided keep value and delete these.

Next it will perform updater based deletions of any vulns from the vuln table which are not longer referenced by update operations.

The GC is throttled to not overload the database with cascade deletes. If a full GC is required run this method until the returned int64 value is 0.

func (*Store) Get

func (s *Store) Get(ctx context.Context, records []*claircore.IndexRecord, opts vulnstore.GetOpts) (map[string][]*claircore.Vulnerability, error)

Get implements vulnstore.Vulnerability.

func (*Store) GetEnrichment added in v0.5.0

func (s *Store) GetEnrichment(ctx context.Context, name string, tags []string) (res []driver.EnrichmentRecord, err error)

func (*Store) GetLatestUpdateRef added in v0.0.18

func (s *Store) GetLatestUpdateRef(ctx context.Context, kind driver.UpdateKind) (uuid.UUID, error)

GetLatestUpdateRef implements driver.Updater.

func (*Store) GetLatestUpdateRefs added in v0.0.18

func (s *Store) GetLatestUpdateRefs(ctx context.Context, kind driver.UpdateKind) (map[string][]driver.UpdateOperation, error)

func (*Store) GetUpdateDiff added in v0.0.18

func (s *Store) GetUpdateDiff(ctx context.Context, prev, cur uuid.UUID) (*driver.UpdateDiff, error)

func (*Store) GetUpdateOperations added in v0.0.18

func (s *Store) GetUpdateOperations(ctx context.Context, kind driver.UpdateKind, updater ...string) (map[string][]driver.UpdateOperation, error)

func (*Store) Initialized added in v0.3.0

func (s *Store) Initialized(ctx context.Context) (bool, error)

func (*Store) RecordUpdaterSetStatus added in v1.4.3

func (s *Store) RecordUpdaterSetStatus(ctx context.Context, updaterSet string, updateTime time.Time) error

RecordUpdaterSetStatus records that all updaters from a updater set are up to date with vulnerabilities at this time

func (*Store) RecordUpdaterStatus added in v1.4.3

func (s *Store) RecordUpdaterStatus(ctx context.Context, updaterName string, updateTime time.Time, fingerprint driver.Fingerprint, updaterError error) error

RecordUpdaterStatus records that an updater is up to date with vulnerabilities at this time

func (*Store) UpdateEnrichments added in v0.5.0

func (s *Store) UpdateEnrichments(ctx context.Context, name string, fp driver.Fingerprint, es []driver.EnrichmentRecord) (uuid.UUID, error)

UpdateEnrichments creates a new UpdateOperation, inserts the provided EnrichmentRecord(s), and ensures enrichments from previous updates are not queried by clients.

func (*Store) UpdateVulnerabilities added in v0.0.18

func (s *Store) UpdateVulnerabilities(ctx context.Context, updater string, fingerprint driver.Fingerprint, vulns []*claircore.Vulnerability) (uuid.UUID, error)

UpdateVulnerabilities implements vulnstore.Updater.

Jump to

Keyboard shortcuts

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