github.com/quay/claircore@v1.5.28/updater/interfaces.go (about) 1 package updater 2 3 import ( 4 "context" 5 6 "github.com/google/uuid" 7 8 driver "github.com/quay/claircore/updater/driver/v1" 9 ) 10 11 // Store is the common interface to a data store that Updater expects. 12 type Store interface { 13 // UpdateEnrichments creates a new EnrichmentUpdateOperation, inserts the 14 // provided EnrichmentRecord(s), and ensures enrichments from previous 15 // updates are not queries by clients. 16 UpdateEnrichments(ctx context.Context, ref uuid.UUID, kind string, fp driver.Fingerprint, es []driver.EnrichmentRecord) error 17 18 // UpdateVulnerabilities creates a new UpdateOperation, inserts the provided 19 // vulnerabilities, and ensures vulnerabilities from previous updates are 20 // not queried by clients. 21 UpdateVulnerabilities(ctx context.Context, ref uuid.UUID, updater string, fp driver.Fingerprint, vs *driver.ParsedVulnerabilities) error 22 23 // GetLatestUpdateOperations reports the latest update operations. It must 24 // report at least one per updater, if it exists. 25 GetLatestUpdateOperations(ctx context.Context) ([]driver.UpdateOperation, error) 26 } 27 28 // Locker is the Context-based locking Updater expects. 29 type Locker interface { 30 // TryLock returns a cancelled Context if it would need to wait to acquire 31 // the named lock. 32 TryLock(context.Context, string) (context.Context, context.CancelFunc) 33 // Lock waits to acquire the named lock. The returned Context may be 34 // cancelled if the process loses confidence that the lock is valid. 35 Lock(context.Context, string) (context.Context, context.CancelFunc) 36 }