Documentation
¶
Overview ¶
Package systemd provides systemd-specific platform implementations.
Index ¶
- Constants
- type Lifecycle
- func (l *Lifecycle) Exists(ctx context.Context, name string) (bool, error)
- func (l *Lifecycle) Name() string
- func (l *Lifecycle) Reload(ctx context.Context) error
- func (l *Lifecycle) Restart(ctx context.Context, name string) error
- func (l *Lifecycle) RestartMany(ctx context.Context, names []string) map[string]error
- func (l *Lifecycle) SetUnitGenerationTimeout(timeout time.Duration)
- func (l *Lifecycle) Start(ctx context.Context, name string) error
- func (l *Lifecycle) StartMany(ctx context.Context, names []string) map[string]error
- func (l *Lifecycle) Status(ctx context.Context, name string) (*platform.ServiceStatus, error)
- func (l *Lifecycle) Stop(ctx context.Context, name string) error
- func (l *Lifecycle) StopMany(ctx context.Context, names []string) map[string]error
- type QuadletWriter
- func (w *QuadletWriter) Append(sectionName, key string, values ...string)
- func (w *QuadletWriter) AppendKVMap(sectionName, key string, m map[string]string)
- func (w *QuadletWriter) AppendMap(sectionName, key string, m map[string]string, ...)
- func (w *QuadletWriter) AppendSorted(sectionName, key string, values ...string)
- func (w *QuadletWriter) Set(sectionName, key, value string)
- func (w *QuadletWriter) SetBool(sectionName, key string, value bool)
- func (w *QuadletWriter) String() string
- type Renderer
Constants ¶
const ( UnitSuffixContainer = ".container" UnitSuffixNetwork = ".network" UnitSuffixVolume = ".volume" UnitSuffixBuild = ".build" UnitSuffixService = ".service" )
Unit type suffix constants for Quadlet unit files. These suffixes distinguish different types of managed resources in systemd dependencies.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lifecycle ¶
type Lifecycle struct {
// contains filtered or unexported fields
}
Lifecycle implements the platform.Lifecycle interface for systemd.
func NewLifecycle ¶
func NewLifecycle( unitManager systemd.UnitManager, connectionFactory systemd.ConnectionFactory, userMode bool, logger log.Logger, ) *Lifecycle
NewLifecycle creates a new systemd Lifecycle implementation.
func (*Lifecycle) RestartMany ¶
RestartMany restarts multiple services in dependency order. Services are processed sequentially to ensure dependencies are restarted before dependents.
func (*Lifecycle) SetUnitGenerationTimeout ¶ added in v0.24.7
SetUnitGenerationTimeout sets the timeout for waiting for units to be generated. This is primarily useful for testing.
type QuadletWriter ¶ added in v0.25.0
type QuadletWriter struct {
// contains filtered or unexported fields
}
QuadletWriter provides a minimal INI writer for Quadlet unit files. It preserves exact formatting, ordering, and behavior of the current renderer. Uses manual formatting instead of go-ini to ensure precise control over output.
func NewQuadletWriter ¶ added in v0.25.0
func NewQuadletWriter() *QuadletWriter
NewQuadletWriter creates a new Quadlet INI writer.
func (*QuadletWriter) Append ¶ added in v0.25.0
func (w *QuadletWriter) Append(sectionName, key string, values ...string)
Append adds a key multiple times with different values (for multi-value directives). Values are appended in the order provided.
func (*QuadletWriter) AppendKVMap ¶ added in v0.25.0
func (w *QuadletWriter) AppendKVMap(sectionName, key string, m map[string]string)
AppendKVMap adds key=k=v pairs from a map in sorted key order (for --env, --label, etc).
func (*QuadletWriter) AppendMap ¶ added in v0.25.0
func (w *QuadletWriter) AppendMap(sectionName, key string, m map[string]string, formatter func(k, v string) string)
AppendMap adds key=value pairs from a map in sorted key order.
func (*QuadletWriter) AppendSorted ¶ added in v0.25.0
func (w *QuadletWriter) AppendSorted(sectionName, key string, values ...string)
AppendSorted adds multiple values for a key in sorted order.
func (*QuadletWriter) Set ¶ added in v0.25.0
func (w *QuadletWriter) Set(sectionName, key, value string)
Set adds a single key=value pair to a section.
func (*QuadletWriter) SetBool ¶ added in v0.25.0
func (w *QuadletWriter) SetBool(sectionName, key string, value bool)
SetBool adds a boolean directive as yes/no.
func (*QuadletWriter) String ¶ added in v0.25.0
func (w *QuadletWriter) String() string
String renders the INI file to a string with proper Quadlet formatting.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer implements platform.Renderer for systemd/Quadlet.
func NewRenderer ¶
NewRenderer creates a new systemd renderer.