Documentation ¶
Overview ¶
Package asset facilitates the retrieval of remote runtime assets.
Largely inspired and adapted from the source of `github.com/sensu/sensu-go`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fetcher ¶
type Fetcher interface { // Fetch a payload from the URL given as the argument, and save it in a // temporary file. Fetch(ctx context.Context, URL string) (*os.File, error) }
func NewFetcher ¶
func NewFetcher(log *zap.SugaredLogger, client *http.Client) Fetcher
NewFetcher creates a new HTTP based Fetcher.
Uses an exponential backoff to retry failed requests.
type Manager ¶
type Manager struct { // Fetcher for downloading assets Fetcher Fetcher // StoragePath directory where assets will be unpacked and referenced StoragePath string Logger *zap.SugaredLogger }
func (*Manager) InstallAll ¶
InstallAll runtime assets on the host file system under the StoragePath directory.
Loops through the provided asset Specs and ensures they are installed at the Manager's StoragePath. Returns the first error encountered in the install.
type Reference ¶
Reference to an installed runtime asset
func (Reference) MergeEnvironment ¶
MergeEnvironment merges the environment variables associated with a runtime asset into an existing set of environment variables.
Includes executables in the PATH, shared libraries in LD_LIBRARY_PATH and include source in CPATH. Also introduces an {{ asset name }}_PATH variable pointing at the installation directory.