Documentation
¶
Overview ¶
Package statuses provides an interface and implementation for managing workload statuses.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StatusManager ¶
type StatusManager interface { // GetWorkload retrieves details of a workload by its name. GetWorkload(ctx context.Context, workloadName string) (core.Workload, error) // ListWorkloads returns details of all workloads. ListWorkloads(ctx context.Context, listAll bool, labelFilters []string) ([]core.Workload, error) // SetWorkloadStatus sets the status of a workload by its name. // Note that this does not return errors, but logs them instead. // This method will do nothing if the workload does not exist. // This method will preserve the PID of the workload if it was previously set. SetWorkloadStatus(ctx context.Context, workloadName string, status rt.WorkloadStatus, contextMsg string) error // DeleteWorkloadStatus removes the status of a workload by its name. DeleteWorkloadStatus(ctx context.Context, workloadName string) error // SetWorkloadPID sets the PID of a workload by its name. // This method will do nothing if the workload does not exist. SetWorkloadPID(ctx context.Context, workloadName string, pid int) error // ResetWorkloadPID resets the PID of a workload to 0. // This method will do nothing if the workload does not exist. ResetWorkloadPID(ctx context.Context, workloadName string) error }
StatusManager is an interface for fetching and retrieving workload statuses.
func NewFileStatusManager ¶
func NewFileStatusManager(runtime rt.Runtime) (StatusManager, error)
NewFileStatusManager creates a new file-based StatusManager. Status files will be stored in the XDG data directory under "statuses/".
func NewStatusManager ¶
func NewStatusManager(runtime rt.Runtime) (StatusManager, error)
NewStatusManager creates a new status manager instance using the appropriate implementation based on the runtime environment. If running in Kubernetes, it returns the runtime-based implementation. Otherwise, it returns the file-based implementation.
func NewStatusManagerFromRuntime ¶
func NewStatusManagerFromRuntime(runtime rt.Runtime) StatusManager
NewStatusManagerFromRuntime creates a new instance of StatusManager from an existing runtime.
func NewStatusManagerWithEnv ¶ added in v0.2.13
NewStatusManagerWithEnv creates a new status manager instance using the provided environment reader. This allows for dependency injection of environment variable access for testing.