github.com/quay/claircore@v1.5.28/datastore/vulnerability.go (about)

     1  package datastore
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/quay/claircore"
     7  	"github.com/quay/claircore/libvuln/driver"
     8  )
     9  
    10  // GetOpts provides instructions on how to match packages to vulnerabilities.
    11  type GetOpts struct {
    12  	// Matchers tells the Get method to limit the returned vulnerabilities by
    13  	// the provided [driver.MatchConstraint]s.
    14  	Matchers []driver.MatchConstraint
    15  	// Debug asks the database layer to log extra information.
    16  	//
    17  	// Deprecated: This does nothing.
    18  	Debug bool
    19  	// VersionFiltering enables filtering based on the normalized versions in
    20  	// the database.
    21  	VersionFiltering bool
    22  }
    23  
    24  // Vulnerability is the interface for querying stored Vulnerabilities.
    25  type Vulnerability interface {
    26  	// Get finds the vulnerabilities which match each package provided in the
    27  	// [IndexRecord]s. This may be a one-to-many relationship. A map of Package
    28  	// ID to Vulnerabilities is returned.
    29  	Get(ctx context.Context, records []*claircore.IndexRecord, opts GetOpts) (map[string][]*claircore.Vulnerability, error)
    30  }