wasm

package
Version: v0.0.0-...-75e95db Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultWasmModulePurgeInterval is the default interval for periodic stale Wasm module clean up.
	DefaultWasmModulePurgeInterval = 10 * time.Minute

	// DefaultWasmModuleExpiry is the default duration for least recently touched Wasm module to become stale.
	DefaultWasmModuleExpiry = 24 * time.Hour
)

Variables

This section is empty.

Functions

func MaybeConvertWasmExtensionConfig

func MaybeConvertWasmExtensionConfig(resources []*any.Any, cache Cache) bool

MaybeConvertWasmExtensionConfig converts any presence of module remote download to local file. It downloads the Wasm module and stores the module locally in the file system.

func MaybeConvertWasmExtensionConfigDelta

func MaybeConvertWasmExtensionConfigDelta(resources []*discovery.Resource, cache Cache) bool

MaybeConvertWasmExtensionConfigDelta converts any presence of module remote download to local file. It downloads the Wasm module and stores the module locally in the file system.

Types

type Cache

type Cache interface {
	Get(url, checksum string, timeout time.Duration) (string, error)
	Cleanup()
}

Cache models a Wasm module cache.

type HTTPFetcher

type HTTPFetcher struct {
	// contains filtered or unexported fields
}

HTTPFetcher fetches remote wasm module with HTTP get.

func NewHTTPFetcher

func NewHTTPFetcher() *HTTPFetcher

NewHTTPFetcher create a new HTTP remote wasm module fetcher.

func (*HTTPFetcher) Fetch

func (f *HTTPFetcher) Fetch(url string, timeout time.Duration) ([]byte, error)

Fetch downloads a wasm module with HTTP get.

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, purgeInterval, moduleExpiry time.Duration) *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, checksum string, timeout time.Duration) (string, error)

Get returns path the local Wasm module file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to