executablecache

package
v0.0.0-...-c4341c9 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoCacheDir = status.New(status.FileAccessError, `Executable cache directory not available.
Make sure binaries can be executed from $HOME/.chef-automate/executable-cache
or set CHEF_AUTOMATE_HOME to a suitable directory.`)

ErrNoCacheDir is returned if a suitable cache directory was not found

Functions

This section is empty.

Types

type ExecutableCache

type ExecutableCache interface {
	// Store stores the data given as an executable. It can be retrieved
	// using version as the key.
	Store(version string, data []byte) (*exec.Cmd, error)
	// Exists returns true if the given executable exists
	Exists(version string) (bool, error)
	// AsCmd returns the command for the executable version. The caller
	// is responsible for checking if it exists before making this call
	AsCmd(version string) *exec.Cmd
	// Latest returns the latest version available
	Latest() (*exec.Cmd, string)
}

ExecutableCache represents something that can cache chef-automate executables

func New

func New(opts ...Opt) ExecutableCache

New creates a new ExecutableCache

type Opt

type Opt func(*executableCache)

Opt are functional options for executableCache

func WithCacheDir

func WithCacheDir(cacheDir string) Opt

WithCacheDir sets the cache directory for the executable cache This function is used by the tests. It is up to the caller to make sure that the directory exists before calling Store

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL