systemd

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package systemd contains the trusted target and transport implementation used by systemd-aware builtins.

Index

Constants

View Source
const MaxJournalDirs = 8

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client implements the trusted systemd backends for one resolved target. Target paths are copied at construction so runner configuration remains immutable while commands execute.

func NewClient

func NewClient(target Target) *Client

NewClient creates a client for one resolved systemd target.

func (*Client) DisableSystemServices

func (c *Client) DisableSystemServices(ctx context.Context, units []string) error

func (*Client) EnableSystemServices

func (c *Client) EnableSystemServices(ctx context.Context, units []string) error

func (*Client) InspectSystemServices

func (c *Client) InspectSystemServices(ctx context.Context, units []string) ([]builtins.SystemServiceState, error)

func (*Client) JournalDiskUsage

func (c *Client) JournalDiskUsage(ctx context.Context) (builtins.JournalUsage, error)

JournalDiskUsage reports allocated blocks, matching journalctl's disk-usage semantics more closely than summing logical file lengths.

func (*Client) ListSystemServices

func (c *Client) ListSystemServices(ctx context.Context, request builtins.SystemServiceListRequest) ([]builtins.SystemServiceState, error)

func (*Client) ReadJournal

func (c *Client) ReadJournal(ctx context.Context, query builtins.JournalQuery, yield func(builtins.JournalEntry) error) error

ReadJournal reads a bounded structured query from the configured journal files. Results are buffered until the file snapshot is stable, then yielded oldest first as required by builtins.JournalReader.

func (*Client) RotateJournal

func (c *Client) RotateJournal(ctx context.Context) error

RotateJournal asks journald to rotate active journals and waits for the daemon to report completion.

func (*Client) RunSystemServiceJobs

func (c *Client) RunSystemServiceJobs(ctx context.Context, action builtins.SystemServiceJobAction, units []string) error

func (*Client) VacuumJournal

VacuumJournal deletes only strictly recognized archived journals from the configured target while honoring the requested size and time thresholds.

type Target

type Target struct {
	JournalDirs          []string
	MachineIDPath        string
	JournalControlSocket string
	ManagerBusSocket     string
}

Target identifies one systemd host through journal paths supplied by the embedding application.

func LocalTarget

func LocalTarget() Target

LocalTarget returns the standard paths for the local systemd host.

func ResolveTarget

func ResolveTarget(target Target) (Target, error)

ResolveTarget validates and resolves a target. A zero target selects the local host. Once any explicit field is supplied, omitted fields remain empty and never fall back to local paths.

Jump to

Keyboard shortcuts

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