Documentation
¶
Overview ¶
Package systemd provides systemd unit management operations.
Index ¶
- func GetContext() context.Context
- func GetSystemdConnection() (*dbus.Conn, error)
- func GetUnitFailureDetails(unitName string) string
- func ReloadSystemd() error
- func RestartChangedUnits(changedUnits []UnitChange, ...) error
- func StartUnitDependencyAware(unitName string, unitType string, ...) error
- type BaseUnit
- func (u *BaseUnit) GetServiceName() string
- func (u *BaseUnit) GetStatus() (string, error)
- func (u *BaseUnit) GetUnitName() string
- func (u *BaseUnit) GetUnitType() string
- func (u *BaseUnit) ResetFailed() error
- func (u *BaseUnit) Restart() error
- func (u *BaseUnit) Show() error
- func (u *BaseUnit) Start() error
- func (u *BaseUnit) Stop() error
- type OrchestrationResult
- type Unit
- type UnitChange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContext ¶
GetContext returns the systemd operation context.
func GetSystemdConnection ¶
GetSystemdConnection returns a connection to systemd D-Bus.
func GetUnitFailureDetails ¶
GetUnitFailureDetails retrieves additional details about a unit failure using dbus.
func RestartChangedUnits ¶
func RestartChangedUnits(changedUnits []UnitChange, projectDependencyGraphs map[string]*dependency.ServiceDependencyGraph) error
RestartChangedUnits restarts all changed units in dependency-aware order.
func StartUnitDependencyAware ¶
func StartUnitDependencyAware(unitName string, unitType string, dependencyGraph *dependency.ServiceDependencyGraph) error
StartUnitDependencyAware starts or restarts a unit while being dependency-aware.
Types ¶
type BaseUnit ¶
BaseUnit provides common implementation for all systemd units.
func NewBaseUnit ¶
NewBaseUnit creates a new BaseUnit with the given name and type.
func (*BaseUnit) GetServiceName ¶
GetServiceName returns the full systemd service name based on unit type.
func (*BaseUnit) GetUnitName ¶
GetUnitName returns the name of the unit.
func (*BaseUnit) GetUnitType ¶
GetUnitType returns the type of the unit.
func (*BaseUnit) ResetFailed ¶
ResetFailed resets the failed state of the unit.
type OrchestrationResult ¶
OrchestrationResult represents the result of an orchestration operation.
type Unit ¶
type Unit interface {
// GetServiceName returns the full systemd service name
GetServiceName() string
// GetUnitType returns the type of the unit (container, volume, network, etc.)
GetUnitType() string
// GetUnitName returns the name of the unit
GetUnitName() string
// GetStatus returns the current status of the unit
GetStatus() (string, error)
// Start starts the unit
Start() error
// Stop stops the unit
Stop() error
// Restart restarts the unit
Restart() error
// Show displays the unit configuration and status
Show() error
// ResetFailed resets the failed state of the unit
ResetFailed() error
}
Unit defines the interface for managing systemd units.
type UnitChange ¶
UnitChange represents a unit that has changed and needs to be restarted.