HostKit.Runtime (host_kit v0.1.0-beta.0)

Copy Markdown View Source

Runtime controls for systemd-backed units and transient jobs.

Summary

Functions

Alias for status/2 kept for Unitctl API compatibility.

Restarts a systemd unit or Unitctl instance.

Starts a transient systemd service through Unitctl.

Reads runtime stats for a unit or Unitctl instance.

Reads common systemd state for a unit or Unitctl instance.

Stops a systemd unit or Unitctl instance.

Types

unit_ref()

@type unit_ref() :: Unitctl.Instance.t() | String.t()

Functions

inspect(instance_or_unit, opts \\ [])

@spec inspect(
  unit_ref(),
  keyword()
) :: {:ok, Systemd.UnitState.t()} | {:error, term()}

Alias for status/2 kept for Unitctl API compatibility.

restart(instance_or_unit, opts \\ [])

@spec restart(
  unit_ref(),
  keyword()
) :: :ok | {:ok, Systemd.Job.t()} | {:error, term()}

Restarts a systemd unit or Unitctl instance.

start(spec_or_attrs)

@spec start(Unitctl.Spec.t() | keyword() | map()) ::
  {:ok, Unitctl.Instance.t()} | {:error, term()}

Starts a transient systemd service through Unitctl.

stats(instance_or_unit, opts \\ [])

@spec stats(
  unit_ref(),
  keyword()
) :: {:ok, Unitctl.Stats.t()} | {:error, term()}

Reads runtime stats for a unit or Unitctl instance.

status(instance_or_unit, opts \\ [])

@spec status(
  unit_ref(),
  keyword()
) :: {:ok, Systemd.UnitState.t()} | {:error, term()}

Reads common systemd state for a unit or Unitctl instance.

stop(instance_or_unit, opts \\ [])

@spec stop(
  unit_ref(),
  keyword()
) :: :ok | {:ok, Systemd.Job.t()} | {:error, term()}

Stops a systemd unit or Unitctl instance.