Documentation ¶
Overview ¶
Package asset provides a mechanism for installing, managing, and utilizing Sensu Assets.
Access to assets are serialized. When an asset is first encountered, getting the asset from the manager blocks until the asset has been fetched, verified, and expanded on the host filesystem (or deemed unnecessary due to asset filters).
The first goroutine to get an asset will cause the installation, and subsequent calling goroutines will simply block while installation completes. If the initial installation fails, the next goroutine to unblock will attempt reinstallation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAssets ¶
GetAssets retrieves all Assets from the store if contained in the list of asset names
func NewFilteredManager ¶
NewFilteredManager returns an asset Getter that filters assets based on the given entity. Assets that aren't filtered get passed to the underlying getter, allowing composition with other asset managers.
Types ¶
type Expander ¶
type Expander interface {
Expand(archive io.ReadSeeker, targetDirectory string) error
}
An Expander expands the provided *os.File to the target direcrtory.
type Fetcher ¶
A Fetcher fetches a file from the specified source and returns an *os.File with the contents of the file found at source.
type Getter ¶
A Getter is responsible for fetching (based on fitler selection), verifying, and expanding an asset. Calls to the Get method block until the Asset has fetched, verified, and expanded or it returns an error indicating why getting the asset failed.
If the context is canceled while Get is in progress, then the operation will be canceled and the error from the context will be returned.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager ...
func NewManager ¶
NewManager ...
type RuntimeAsset ¶
type RuntimeAsset struct { // Path is the absolute path to the asset's base directory. Path string // SHA512 is the hash of the asset tarball. SHA512 string }
A RuntimeAsset is a locally expanded Asset.
func (*RuntimeAsset) BinDir ¶
func (r *RuntimeAsset) BinDir() string
BinDir returns the full path to the asset's bin directory.
func (*RuntimeAsset) IncludeDir ¶
func (r *RuntimeAsset) IncludeDir() string
IncludeDir returns the full path to the asset's include directory.
func (*RuntimeAsset) LibDir ¶
func (r *RuntimeAsset) LibDir() string
LibDir returns the full path to the asset's lib directory.
type RuntimeAssetSet ¶
type RuntimeAssetSet []*RuntimeAsset
RuntimeAssetSet is a set of runtime assets.
func (*RuntimeAssetSet) Env ¶
func (r *RuntimeAssetSet) Env() []string
Env returns a list of environment variables (e.g. 'PATH=...', 'CPATH=...') with asset-specific paths prepended to the parent environment paths for each variable, allowing an asset to be used during check execution.
func (RuntimeAssetSet) Key ¶
func (r RuntimeAssetSet) Key() string
Key gets a unique key for the RuntimeAssetSet.
func (RuntimeAssetSet) Scripts ¶
func (r RuntimeAssetSet) Scripts() (map[string]io.ReadCloser, error)
Scripts retrieves all the js files in the lib directory.