lbengine

package
v0.0.0-...-391ac19 Latest Latest
Warning

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

Go to latest
Published: May 5, 2025 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NumberOfRunningProcesses

func NumberOfRunningProcesses(match lbdeploy.ProcessMatch) (n int, err error)

NumberOfRunningProcesses returns the number of processes running on the local system that match the given criteria.

Types

type AppEngine

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

AppEngine is responsible for evaluating the status of applications on the local system.

func NewAppEngine

func NewAppEngine(dep lbdeploy.Deployment) AppEngine

NewAppEngine prepares an app engine for the given deployment.

func (AppEngine) EvaluateAppChanges

func (engine AppEngine) EvaluateAppChanges(installs, uninstalls lbdeploy.AppList) (changes lbdeploy.AppEvaluation, err error)

EvaluateAppChanges evaluates the changes needed to effect the given set of application installs and uninstalls.

func (AppEngine) InstalledApps

func (engine AppEngine) InstalledApps(list lbdeploy.AppList) (installed lbdeploy.AppList, err error)

InstalledApps returns any of the apps in the list that are installed on the local system.

func (AppEngine) IsInstalled

func (engine AppEngine) IsInstalled(app lbdeploy.AppID) (bool, error)

IsInstalled returns true if the application is installed on the local system.

If it is unable to make a determination, it returns an error.

func (AppEngine) MissingApps

func (engine AppEngine) MissingApps(list lbdeploy.AppList) (missing lbdeploy.AppList, err error)

MissingApps returns any of the apps in the list that are not installed on the local system.

func (AppEngine) SummarizeAppChanges

func (engine AppEngine) SummarizeAppChanges(evaluation lbdeploy.AppEvaluation) (changes lbdeploy.AppSummary, err error)

SummarizeAppChanges summarizes the effectiveness of application installs and uninstalls anticipated by a previous evaluation.

func (AppEngine) Version

func (engine AppEngine) Version(app lbdeploy.AppID) (datatype.Version, error)

Version returns the version number of the application if it is installed on the local system. If it is not present, it returns an empty string.

If it is unable to make a determination, it returns an error.

type ConditionEngine

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

ConditionEngine is responsible for evaluating conditions on the local system.

func NewConditionEngine

func NewConditionEngine(dep lbdeploy.Deployment) ConditionEngine

NewConditionEngine prepares a condition engine for the given deployment.

func (ConditionEngine) Evaluate

func (engine ConditionEngine) Evaluate(condition lbdeploy.ConditionID) (bool, error)

Evaluate returns true if the given condition is currently true.

TODO: Consider returning some sort of evaluation struct that describes the condition (or subconditions) that failed.

type DeploymentEngine

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

DeploymentEngine is a LeafBridge engine that is responsible for invocation of deployments.

func NewDeploymentEngine

func NewDeploymentEngine(deployment lbdeploy.Deployment, opts Options) DeploymentEngine

NewDeploymentEngine returns a new LeafBridge deployment engine for the given deployment and options.

func (DeploymentEngine) Invoke

func (engine DeploymentEngine) Invoke(ctx context.Context, flow lbdeploy.FlowID) error

Invoke executes a flow within a LeafBridge deployment.

type FileVerifier

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

FileVerifier is capable of absorbing file content as a file is read or downloaded. When finished, it can produce a set of attributes for the file, including its cryptographic hash sums.

func NewFileVerifier

func NewFileVerifier(hashTypes ...filehash.Type) (*FileVerifier, error)

NewFileVerifier returns a file verifier that will generate the provided file hash types.

It returns an error if any of the file hash types are not recognized.

func (*FileVerifier) HashTypes

func (v *FileVerifier) HashTypes() []filehash.Type

HashTypes returns an ordered list of hash types that the verifier is producing.

func (*FileVerifier) ReadFrom

func (v *FileVerifier) ReadFrom(r io.Reader) (n int64, err error)

ReadFrom reads data from r until it encounters io.EOF or an error.

It returns the total number of bytes read.

func (*FileVerifier) Reset

func (v *FileVerifier) Reset()

Reset resets the verifier to its initial state.

func (*FileVerifier) Size

func (v *FileVerifier) Size() int64

Size returns the number of bytes that have been written to the verifier so far.

func (*FileVerifier) State

State returns the current attributes of the file being verified.

func (*FileVerifier) Write

func (v *FileVerifier) Write(p []byte) (n int, err error)

Write absorbs more file data into the file verifier's state.

type Lock

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

Lock is a lockable resource.

type LockError

type LockError struct {
	LockID lbdeploy.LockID
	Lock   lbdeploy.Lock
}

LockError is an error returned when a lock cannot be acquired.

func (LockError) Error

func (e LockError) Error() string

Error returns a string describing the error.

type LockGroup

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

LockGroup facilitates locking and unlocking a group of lockable resources together.

func (LockGroup) Lock

func (group LockGroup) Lock() error

Lock attempts to lock all entries in the group.

If any member of the group fails to acquire its lock, all locks in the group are released and it returns an error of type LockError.

func (LockGroup) Unlock

func (group LockGroup) Unlock()

Unlock unlocks all members of the lock group.

type Options

type Options struct {
	Events lbevent.Recorder
	Force  bool
}

Options hold configuration options for a LeafBridge deployment engine.

Jump to

Keyboard shortcuts

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