Documentation ¶
Index ¶
Constants ¶
Variables ¶
var PullPolicyValues = map[string]PullPolicy{
"UNSPECIFIED_POLICY": 0,
"IfNotPresent": 1,
"Always": 2,
}
Functions ¶
Types ¶
type Cache ¶
type Cache interface { Get(url string, opts GetOptions) (string, error) Cleanup() }
Cache models a Wasm module cache.
type GetOptions ¶
type GetOptions struct { Checksum string ResourceName string ResourceVersion string RequestTimeout time.Duration PullSecret []byte PullPolicy PullPolicy }
GetOptions is a struct for providing options to Get method of Cache.
type HTTPFetcher ¶
type HTTPFetcher struct {
// contains filtered or unexported fields
}
HTTPFetcher fetches remote wasm module with HTTP get.
func NewHTTPFetcher ¶
func NewHTTPFetcher(requestTimeout time.Duration, requestMaxRetry int) *HTTPFetcher
NewHTTPFetcher create a new HTTP remote wasm module fetcher. requestTimeout is a timeout for each HTTP/HTTPS request. requestMaxRetry is # of maximum retries of HTTP/HTTPS requests.
type ImageFetcher ¶
type ImageFetcher struct {
// contains filtered or unexported fields
}
func NewImageFetcher ¶
func NewImageFetcher(ctx context.Context, opt ImageFetcherOption) *ImageFetcher
func (*ImageFetcher) PrepareFetch ¶
func (o *ImageFetcher) PrepareFetch(url string) (binaryFetcher func() ([]byte, error), actualDigest string, err error)
PrepareFetch is the entrypoint for fetching Wasm binary from Wasm Image Specification compatible images. Wasm binary is not fetched immediately, but returned by `binaryFetcher` function, which is returned by PrepareFetch. By this way, we can have another chance to check cache with `actualDigest` without downloading the OCI image.
type ImageFetcherOption ¶
type ImageFetcherOption struct { // TODO(mathetake) Add signature verification stuff. PullSecret []byte Insecure bool }
func (ImageFetcherOption) String ¶
func (o ImageFetcherOption) String() string
type LocalFileCache ¶
type LocalFileCache struct {
// contains filtered or unexported fields
}
LocalFileCache for downloaded Wasm modules. Currently it stores the Wasm module as local file.
func NewLocalFileCache ¶
func NewLocalFileCache(dir string, options Options) *LocalFileCache
NewLocalFileCache create a new Wasm module cache which downloads and stores Wasm module files locally.
func (*LocalFileCache) Cleanup ¶
func (c *LocalFileCache) Cleanup()
Cleanup closes background Wasm module purge routine.
func (*LocalFileCache) Get ¶
func (c *LocalFileCache) Get(downloadURL string, opts GetOptions) (string, error)
Get returns path the local Wasm module file.
type Options ¶
type Options struct { PurgeInterval time.Duration ModuleExpiry time.Duration InsecureRegistries sets.String HTTPRequestTimeout time.Duration HTTPRequestMaxRetries int }
Options contains configurations to create a Cache instance.
type PullPolicy ¶
type PullPolicy int32
const ( Unspecified PullPolicy = 0 IfNotPresent PullPolicy = 1 Always PullPolicy = 2 )