Documentation
¶
Overview ¶
Package systemd provides utilities for interacting with systemd units.
Index ¶
- func CollectBindMountHashes(svc *types.ServiceConfig, workingDir, repoPath string) map[string]string
- func ComputeUnitState(unit Unit, svc *types.ServiceConfig, workingDir, repoPath string) state.UnitState
- func WriteUnits(units []Unit, quadletDir string) error
- type Client
- type Error
- type RepositoryMeta
- type Scope
- type Unit
- func BuildContainer(projectName, serviceName string, svc *types.ServiceConfig, ...) Unit
- func BuildNetwork(projectName, netName string, net *types.NetworkConfig, repo RepositoryMeta) Unit
- func BuildVolume(projectName, volName string, vol *types.VolumeConfig, repo RepositoryMeta) Unit
- func Convert(project *types.Project, repo RepositoryMeta) ([]Unit, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectBindMountHashes ¶ added in v0.31.1
func CollectBindMountHashes(svc *types.ServiceConfig, workingDir, repoPath string) map[string]string
CollectBindMountHashes computes SHA256 hashes for bind-mounted regular files within the project directory for a single service. Files outside the project dir, directories, and unreadable files are skipped.
func ComputeUnitState ¶ added in v0.31.1
func ComputeUnitState(unit Unit, svc *types.ServiceConfig, workingDir, repoPath string) state.UnitState
ComputeUnitState computes content and bind mount hashes for change detection. It hashes the rendered unit file content and any bind-mounted regular files whose source paths are within the project directory.
func WriteUnits ¶ added in v0.31.1
WriteUnits writes each unit to a separate file in the quadlet directory.
Types ¶
type Client ¶ added in v0.30.0
type Client interface {
Start(ctx context.Context, units ...string) error
Stop(ctx context.Context, units ...string) error
Restart(ctx context.Context, units ...string) error
Reload(ctx context.Context, units ...string) error
DaemonReload(ctx context.Context) error
Enable(ctx context.Context, units ...string) error
Disable(ctx context.Context, units ...string) error
Close() error
}
Client provides operations for managing systemd units via D-Bus.
type RepositoryMeta ¶ added in v0.32.0
RepositoryMeta holds repository metadata used to generate fixed labels on all Quadlet unit types (containers, volumes, networks).
type Unit ¶
Unit represents a systemd unit file.
func BuildContainer ¶ added in v0.30.0
func BuildContainer(projectName, serviceName string, svc *types.ServiceConfig, projectNetworks types.Networks, projectVolumes types.Volumes, repo RepositoryMeta) Unit
BuildContainer converts a compose service into a container unit file. projectNetworks provides the project-level network configs so that external networks can be referenced by name rather than as Quadlet unit files.
func BuildNetwork ¶ added in v0.30.0
func BuildNetwork(projectName, netName string, net *types.NetworkConfig, repo RepositoryMeta) Unit
BuildNetwork converts a compose network into a network unit file.
func BuildVolume ¶ added in v0.30.0
func BuildVolume(projectName, volName string, vol *types.VolumeConfig, repo RepositoryMeta) Unit
BuildVolume converts a compose volume into a volume unit file.