1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/pkg/engine/context/loader.go
Charles-Edouard Brétéché e5ceebe4a9
refactor: add specific loaders from #7597 (#7671)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-06-26 13:31:40 +00:00

16 lines
880 B
Go

package context
// Loader fetches or produces data and loads it into the context. A loader is created for each
// context entry (e.g. `context.variable`, `context.apiCall`, etc.)
// Loaders are invoked lazily based on variable lookups. Loaders may be invoked multiple times to
// handle checkpoints and restores that occur when processing loops. A loader that fetches remote
// data should be able to handle multiple invocations in an optimal manner by mantaining internal
// state and caching remote data. For example, if an API call is made the data retrieved can be
// stored so that it can be saved in the outer context when a restore is performed.
type Loader interface {
// Load data fetches or produces data and stores it in the context
LoadData() error
// Has loaded indicates if the loader has previously
// executed and stored data in a context
HasLoaded() bool
}