25 lines
594 B
Go
25 lines
594 B
Go
|
|
// Package systemd defines the exact systemd boundary used by native executors.
|
||
|
|
package systemd
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"errors"
|
||
|
|
)
|
||
|
|
|
||
|
|
var ErrUnitNotFound = errors.New("systemd unit not found")
|
||
|
|
|
||
|
|
// Unit is the systemd state required for idempotent start and stop inspection.
|
||
|
|
type Unit struct {
|
||
|
|
Name string
|
||
|
|
LoadState string
|
||
|
|
ActiveState string
|
||
|
|
SubState string
|
||
|
|
}
|
||
|
|
|
||
|
|
// Manager performs direct systemd operations without invoking a shell.
|
||
|
|
type Manager interface {
|
||
|
|
Inspect(context.Context, string) (Unit, error)
|
||
|
|
Start(context.Context, string) error
|
||
|
|
Stop(context.Context, string) error
|
||
|
|
}
|