Documentation ¶
Overview ¶
Package unit defines unit types, which system.Interface can supervise
Index ¶
- Variables
- func IsActive(u Subber) bool
- func ParseDefinition(r io.Reader, v interface{}) (err error)
- type Activation
- type ActivationStatus
- type Definer
- type Definition
- func (def Definition) After() []string
- func (def Definition) Before() []string
- func (def Definition) Conflicts() []string
- func (def Definition) Description() string
- func (def Definition) Documentation() string
- func (def Definition) RequiredBy() []string
- func (def Definition) Requires() []string
- func (def Definition) WantedBy() []string
- func (def Definition) Wants() []string
- type Dependency
- type Enable
- type Interface
- type Load
- type LoadStatus
- type MultiError
- type ParseError
- type Reloader
- type StartStopper
- type Starter
- type Status
- type Stopper
- type Subber
Constants ¶
This section is empty.
Variables ¶
var ErrNotExist = errors.New("Does not exist")
var ErrNotParsed = errors.New("Unit definition is not parsed properly")
var ErrNotSet = errors.New("Field not specified")
var ErrNotStarted = errors.New("Unit not started")
var ErrNotSupported = errors.New("Not supported")
var ErrPathNotAbs = errors.New("Path specified is not absolute")
var ErrUnknownType = errors.New("Unknown type")
var ErrWrongVal = errors.New("Wrong value received")
Functions ¶
func ParseDefinition ¶
ParseDefinition parses the data in Systemd unit-file format and stores the result in value pointed by Definition
Types ¶
type Activation ¶
type Activation int
Activation status of a unit -- https://goo.gl/XHBVuC
const ( Inactive Activation = iota Active Reloading Failed Activating Deactivating )
type ActivationStatus ¶
type ActivationStatus struct { State Activation `json:"State"` Sub string `json:"Sub"` }
type Definition ¶
type Definition struct { Unit struct { Description string Documentation string Wants, Requires, Conflicts, Before, After []string } Install struct { WantedBy, RequiredBy []string } }
Definition of a unit matching the fields found in unit-file
func (Definition) After ¶
func (def Definition) After() []string
After returns a slice of unit names as found in Definition
func (Definition) Before ¶
func (def Definition) Before() []string
Before returns a slice of unit names as found in Definition
func (Definition) Conflicts ¶
func (def Definition) Conflicts() []string
Conflicts returns a slice of unit names as found in Definition
func (Definition) Description ¶
func (def Definition) Description() string
Description returns a string as found in Definition
func (Definition) Documentation ¶
func (def Definition) Documentation() string
Documentation returns a string as found in Definition
func (Definition) RequiredBy ¶
func (def Definition) RequiredBy() []string
RequiredBy returns a slice of unit names as found in Definition
func (Definition) Requires ¶
func (def Definition) Requires() []string
Requires returns a slice of unit names as found in Definition
func (Definition) WantedBy ¶
func (def Definition) WantedBy() []string
WantedBy returns a slice of unit names as found in Definition
func (Definition) Wants ¶
func (def Definition) Wants() []string
Wants returns a slice of unit names as found in Definition
type Dependency ¶
type Interface ¶
type Interface interface { Definer Subber Description() string Documentation() string Dependency }
type LoadStatus ¶
type MultiError ¶
type MultiError []error
func (MultiError) Error ¶
func (m MultiError) Error() string
func (MultiError) Errors ¶
func (m MultiError) Errors() (errs []string)
type ParseError ¶
func ParseErr ¶
func ParseErr(source string, err error) ParseError
func (ParseError) Error ¶
func (err ParseError) Error() string
type Reloader ¶
type Reloader interface {
Reload() error
}
Reloader is implemented by any value capable of reloading itself(or its definition)
type StartStopper ¶
StartStopper is implemented by any value that has Start and Stop methods
type Starter ¶
type Starter interface {
Start() error
}
Starter is implemented by any value that has a Start method
type Status ¶
type Status struct { Load LoadStatus `json:"Load"` Activation ActivationStatus `json:"Activation"` Log []byte `json:"Log,omitempty"` }
type Stopper ¶
type Stopper interface {
Stop() error
}
Stopper is implemented by any value that has a Stop method
type Subber ¶
type Subber interface { Active() Activation Sub() string }
Subber is implemented by any value that has Sub and Active methods