system

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PtmxPathEnv     = "PTMX_PATH"
	DefaultPtmxPath = "/dev/ptmx"
)
View Source
const (
	UnitNewMethod           = "org.freedesktop.systemd1.Manager.UnitNew"
	UnitRemovedMethod       = "org.freedesktop.systemd1.Manager.UnitRemoved"
	PropertiesChangedMethod = "org.freedesktop.DBus.Properties.PropertiesChanged"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DbusConn

type DbusConn interface {
	Object(dest string, path dbus.ObjectPath) dbus.BusObject
	Signal(ch chan<- *dbus.Signal)
	Close() error
}

DbusConn is a wrapper for the dbus.Conn external type

type DbusExecStart

type DbusExecStart struct {
	Path             string
	Args             []string
	UncleanIsFailure bool
}

DbusExecStart property for systemd services

type DbusObject

type DbusObject interface {
	Go(method string, flags dbus.Flags, ch chan *dbus.Call, args ...interface{}) *dbus.Call
}

DbusObject is a wrapper for dbus.BusObject external type

type DbusProperty

type DbusProperty struct {
	Name  string
	Value interface{}
}

DbusProperty is used for dbus arguments that are arrays of key value pairs

type DbusPropertySet

type DbusPropertySet struct {
	Name  string
	Value []DbusProperty
}

type ExecConfig

type ExecConfig struct {
	Name        string
	Description string
	ExecPath    string
	Args        []string
	Env         []string
}

func (*ExecConfig) ToDbus

func (ec *ExecConfig) ToDbus(ptsN int, serviceType string) []DbusProperty

type OsPts

type OsPts struct{}

Real os implementation of the Pts interface

func (*OsPts) NewPts

func (p *OsPts) NewPts() (io.ReadCloser, int, error)

Create a new pseudo terminal (pts). Returns a ReaderCloser for the master device and a pts number

type Pts

type Pts interface {
	NewPts() (io.ReadCloser, int, error)
}

Interface for creating new private terminal session. See man pts(4)

func NewOsPts

func NewOsPts() Pts

type SystemdConnection

type SystemdConnection interface {
	ListUnits(ctx context.Context) ([]*Unit, error)
	StopUnit(ctx context.Context, unitName string) error
	StartTransientUnit(ctx context.Context, name string, mode string,
		props []DbusProperty) (dbus.ObjectPath, error)
	Signal(ch chan<- *dbus.Signal)
	Close() error
}

type SystemdOsConnection

type SystemdOsConnection struct {
	Conn   DbusConn
	Object DbusObject
}

SystemdOsConnection is a low level api thinly wrapping the systemd dbus calls See https://www.freedesktop.org/wiki/Software/systemd/dbus/ for the DBus API

func NewSystemdOsConnection

func NewSystemdOsConnection() (*SystemdOsConnection, error)

Connect to the systemd dbus socket and return a SystemdOsConnection

func (*SystemdOsConnection) Close

func (sc *SystemdOsConnection) Close() error

func (*SystemdOsConnection) ListUnits

func (sc *SystemdOsConnection) ListUnits(ctx context.Context) ([]*Unit, error)

func (*SystemdOsConnection) Signal

func (sc *SystemdOsConnection) Signal(ch chan<- *dbus.Signal)

func (*SystemdOsConnection) StartTransientUnit

func (sc *SystemdOsConnection) StartTransientUnit(ctx context.Context, name string, mode string,
	props []DbusProperty) (dbus.ObjectPath, error)

func (*SystemdOsConnection) StopUnit

func (sc *SystemdOsConnection) StopUnit(ctx context.Context, unitName string) error

type SystemdSupervisor

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

func NewSystemdSupervisor

func NewSystemdSupervisor(conn SystemdConnection, pts Pts) *SystemdSupervisor

func StartOsSystemdSupervisor

func StartOsSystemdSupervisor() (*SystemdSupervisor, error)

func (*SystemdSupervisor) AddServiceWatcher

func (s *SystemdSupervisor) AddServiceWatcher(serviceName string, ch chan<- *UnitProperties)

func (*SystemdSupervisor) RemoveServiceWatcher

func (s *SystemdSupervisor) RemoveServiceWatcher(serviceName string, ch chan<- *UnitProperties)

func (*SystemdSupervisor) RunOneshot

func (sd *SystemdSupervisor) RunOneshot(ctx context.Context, config *ExecConfig) (string, error)

func (*SystemdSupervisor) Start

func (s *SystemdSupervisor) Start()

func (*SystemdSupervisor) StartService

func (sd *SystemdSupervisor) StartService(ctx context.Context, config *ExecConfig) (string, error)

func (*SystemdSupervisor) Stop

func (s *SystemdSupervisor) Stop() error

type Unit

type Unit struct {
	Name        string
	Description string
	LoadState   string
	ActiveState string
	SubState    string
	Followed    string
	Path        dbus.ObjectPath
	JobId       uint32
	JobType     string
	JobPath     dbus.ObjectPath
}

type UnitProperties

type UnitProperties struct {
	ActiveState    string
	ExecMainCode   int
	ExecMainStatus int
}

Directories

Path Synopsis
Package mock_system is a generated GoMock package.
Package mock_system is a generated GoMock package.

Jump to

Keyboard shortcuts

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