Documentation
¶
Overview ¶
Package updater updates the vulnerability database periodically using the registered vulnerability fetchers.
Index ¶
- func RegisterFetcher(name string, f Fetcher)
- func RegisterMetadataFetcher(name string, f MetadataFetcher)
- func Run(config *config.UpdaterConfig, datastore database.Datastore, st *utils.Stopper)
- func Update(datastore database.Datastore, firstUpdate bool)
- type Fetcher
- type FetcherResponse
- type MetadataFetcher
- type VulnerabilityWithLock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterFetcher ¶
RegisterFetcher makes a Fetcher available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.
func RegisterMetadataFetcher ¶ added in v1.0.0
func RegisterMetadataFetcher(name string, f MetadataFetcher)
RegisterFetcher makes a Fetcher available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.
Types ¶
type Fetcher ¶
type Fetcher interface {
// FetchUpdate gets vulnerability updates.
FetchUpdate(database.Datastore) (FetcherResponse, error)
// Clean deletes any allocated resources.
// It is invoked when Clair stops.
Clean()
}
Fetcher represents anything that can fetch vulnerabilities.
type FetcherResponse ¶
type FetcherResponse struct {
FlagName string
FlagValue string
Notes []string
Vulnerabilities []database.Vulnerability
}
FetcherResponse represents the sum of results of an update.
type MetadataFetcher ¶ added in v1.0.0
type MetadataFetcher interface {
// Load runs right before the Updater calls AddMetadata for each vulnerabilities.
Load(database.Datastore) error
// AddMetadata adds metadata to the given database.Vulnerability.
// It is expected that the fetcher uses .Lock.Lock() when manipulating the Metadata map.
AddMetadata(*VulnerabilityWithLock) error
// Unload runs right after the Updater finished calling AddMetadata for every vulnerabilities.
Unload()
// Clean deletes any allocated resources.
// It is invoked when Clair stops.
Clean()
}
MetadataFetcher
type VulnerabilityWithLock ¶ added in v1.0.0
type VulnerabilityWithLock struct {
*database.Vulnerability
Lock sync.Mutex
}
Click to show internal directories.
Click to hide internal directories.