Help us shape the future of Go! Take the 2026 Go Developer Survey

unitconv

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package unitconv holds the boot-unit convergence shared by the network planes that replay their state via a systemd oneshot. See docs/dev/traffic-shaper.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableIfDisabled

func EnableIfDisabled(ctx context.Context, service string) error

EnableIfDisabled re-enables service if systemd would not start it at boot. Reads the same probe NeedsConverge gates on, so the two cannot disagree. Failures only warn; the drift probe reports the host again next time.

func EnabledAtBoot

func EnabledAtBoot(service string) (bool, error)

EnabledAtBoot reports whether systemd will start service at boot, via one Lstat rather than a DBus call. Cheap, not authoritative — see docs/dev/traffic-shaper.md.

func EnsureUnit

func EnsureUnit(ctx context.Context, unitPath, service string, embedded []byte) error

EnsureUnit installs embedded at unitPath, daemon-reloads systemd, and enables service for boot. Write-side counterpart of NeedsConverge; a unit that is already current and enabled is a no-op, and a failed enable only warns. See docs/dev/traffic-shaper.md for why the bytes are compared, not stat-ed.

func NeedsConverge

func NeedsConverge(unitPath string, embedded []byte, guards []string, enabled EnabledProbe) (bool, error)

NeedsConverge reports, read-only, whether the unit at unitPath needs writing or enabling. guards are the persisted artifacts a missing unit would replay. See docs/dev/traffic-shaper.md.

Types

type EnabledProbe

type EnabledProbe func() (bool, error)

EnabledProbe reports whether systemd will start a unit at boot. Injectable so tests need no /etc.

Jump to

Keyboard shortcuts

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