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

     1  package datastore
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/google/uuid"
     7  
     8  	"github.com/quay/claircore/libvuln/driver"
     9  )
    10  
    11  // EnrichmentIter is an [Iter] of enrichment records.
    12  type EnrichmentIter Iter[*driver.EnrichmentRecord]
    13  
    14  // EnrichmentUpdater is an interface exporting the necessary methods
    15  // for storing and querying Enrichments.
    16  type EnrichmentUpdater interface {
    17  	// UpdateEnrichments creates a new EnrichmentUpdateOperation, inserts the provided
    18  	// EnrichmentRecord(s), and ensures enrichments from previous updates are not
    19  	// queries by clients.
    20  	UpdateEnrichments(ctx context.Context, kind string, fingerprint driver.Fingerprint, enrichments []driver.EnrichmentRecord) (uuid.UUID, error)
    21  	// UpdateEnrichmentsIter performs the same operation as UpdateEnrichments, but
    22  	// accepting an iterator function.
    23  	UpdateEnrichmentsIter(ctx context.Context, kind string, fingerprint driver.Fingerprint, enIter EnrichmentIter) (uuid.UUID, error)
    24  }
    25  
    26  // Enrichment is an interface for querying enrichments from the store.
    27  type Enrichment interface {
    28  	GetEnrichment(ctx context.Context, kind string, tags []string) ([]driver.EnrichmentRecord, error)
    29  }