Documentation ¶
Index ¶
- Constants
- func IsConfigNotExists(err error) bool
- type Appendable
- type Caretakerd
- func (instance *Caretakerd) Close()
- func (instance *Caretakerd) ConfigObject() interface{}
- func (instance *Caretakerd) Control() *control.Control
- func (instance Caretakerd) IsOpen() bool
- func (instance *Caretakerd) KeyStore() *keyStore.KeyStore
- func (instance Caretakerd) Logger() *logger.Logger
- func (instance *Caretakerd) Run() (values.ExitCode, error)
- func (instance *Caretakerd) Services() *service.Services
- func (instance *Caretakerd) Stop()
- type Config
- type ConfigDoesNotExistError
- type Executable
- type Execution
- func (instance *Execution) GetCountOfActiveExecutions() int
- func (instance *Execution) GetFor(s *service.Service) (*service.Execution, bool)
- func (instance *Execution) Information() map[string]service.Information
- func (instance *Execution) InformationFor(s *service.Service) service.Information
- func (instance *Execution) Kill(target *service.Service) error
- func (instance *Execution) Restart(target *service.Service) error
- func (instance *Execution) Run() (values.ExitCode, error)
- func (instance *Execution) Signal(target *service.Service, what values.Signal) error
- func (instance *Execution) Start(target *service.Service) error
- func (instance *Execution) Stop(target *service.Service) error
- func (instance *Execution) StopAll()
- type Putable
Constants ¶
const ( // BaseName indicates the base name of the caretaker executable BaseName = "caretaker" // DaemonName indicates the name of the caretakerd executable DaemonName = "caretakerd" // ControlName indicates the name of the caretakerctl executable ControlName = "caretakerctl" // Description indicates the description of caretakerd. Description = "" /* 164-byte string literal not displayed */ // URL indicates the URL of the caretakerd project page. URL = "https://caretakerd.echocat.org" )
Variables ¶
This section is empty.
Functions ¶
func IsConfigNotExists ¶ added in v0.2.0
IsConfigNotExists returns true if err matches ConfigDoesNotExistError
Types ¶
type Appendable ¶
Appendable indicates an instance where a string can be appended.
type Caretakerd ¶
type Caretakerd struct {
// contains filtered or unexported fields
}
Caretakerd instance structure
func NewCaretakerd ¶
func NewCaretakerd(conf *Config, syncGroup *usync.Group) (*Caretakerd, error)
NewCaretakerd creates a new Caretakerd instance from the given config
func (*Caretakerd) Close ¶
func (instance *Caretakerd) Close()
Close closes the caretakerd instance and clears resources. After calling this method it is no longer possible to use this instance.
func (*Caretakerd) ConfigObject ¶
func (instance *Caretakerd) ConfigObject() interface{}
ConfigObject returns the config that was used to create this instances.
func (*Caretakerd) Control ¶
func (instance *Caretakerd) Control() *control.Control
Control returns the instantiated control that belongs to this instance.
func (Caretakerd) IsOpen ¶
func (instance Caretakerd) IsOpen() bool
IsOpen returns "true" if caretakerd is still open. This should return "false" after Close() was called.
func (*Caretakerd) KeyStore ¶
func (instance *Caretakerd) KeyStore() *keyStore.KeyStore
KeyStore returns the instantiated keyStore that belongs to this instance.
func (Caretakerd) Logger ¶
func (instance Caretakerd) Logger() *logger.Logger
Logger returns the instantiated logger that belongs to this instance.
func (*Caretakerd) Run ¶
func (instance *Caretakerd) Run() (values.ExitCode, error)
Run starts every services and required resources of caretakerd. This is a blocking method.
func (*Caretakerd) Services ¶
func (instance *Caretakerd) Services() *service.Services
Services returns the instantiated services that belong to this instance.
func (*Caretakerd) Stop ¶
func (instance *Caretakerd) Stop()
Stop stops this instance (if it is running). This method is blocking until every service and resource is stopped.
type Config ¶
type Config struct { // Defines how the encryption of caretakerd works. // This is especially important if {@ref #RPC RPC} is used. // // For details see {@ref github.com/echocat/caretakerd/keyStore.Config}. KeyStore keyStore.Config `json:"keyStore" yaml:"keyStore,omitempty"` // Defines how caretaker can controlled remotely. // // For details see {@ref github.com/echocat/caretakerd/rpc.Config}. RPC rpc.Config `json:"rpc" yaml:"rpc,omitempty"` // Defines the access rights of caretakerctl to caretakerd. // This requires {@ref #RPC RPC} enabled. // // For details see {@ref github.com/echocat/caretakerd/control.Config}. Control control.Config `json:"control" yaml:"control,omitempty"` // Configures the logger for caretakerd itself. // This does not include output of services. // // For details see {@ref github.com/echocat/caretakerd/logger.Config}. Logger logger.Config `json:"logger" yaml:"logger,omitempty"` // Services configuration to run with caretakerd. // // > **Important**: This is a map and requires exact one service // > configured as {@ref github.com/echocat/caretakerd/service.Config#Type type} = {@ref github.com/echocat/caretakerd/service.Type#Master master}. // // For details see {@ref github.com/echocat/caretakerd/service.Config}. Services service.Configs `json:"services" yaml:"services,omitempty"` // Contains the source where this config comes from. Source values.String `json:"-" yaml:"-"` }
Root configuration of caretakerd.
func LoadFromYamlFile ¶
LoadFromYamlFile loads the caretakerd config from the given yaml file.
func NewConfigFor ¶ added in v0.2.0
NewConfigFor create a new config instance.
func (Config) EnrichFromEnvironment ¶
EnrichFromEnvironment enriches the current Config instance with configuration from the environment variables.
func (*Config) UnmarshalYAML ¶ added in v1.0.0
UnmarshalYAML is used by yaml unmarshalling. Do not call direct.
func (Config) Validate ¶
Validate do validate action on this object and return an error object if any.
func (Config) ValidateMaster ¶
ValidateMaster return an error instance on every validation problem of the master service config instance.
type ConfigDoesNotExistError ¶
type ConfigDoesNotExistError struct {
// contains filtered or unexported fields
}
ConfigDoesNotExistError descripts an error if a config does not exists.
func (ConfigDoesNotExistError) Error ¶
func (instance ConfigDoesNotExistError) Error() string
Error returns the error message.
type Executable ¶
type Executable interface { Services() *service.Services KeyStore() *keyStore.KeyStore Logger() *logger.Logger }
Executable indicates an object that could be executed.
type Execution ¶
type Execution struct {
// contains filtered or unexported fields
}
Execution is an instance of an execution of every service of caretakerd.
func NewExecution ¶
func NewExecution(executable Executable) *Execution
NewExecution creates a new Execution instance of caretakerd.
Hint: A caretakerd Execution instance could only be called once.
func (*Execution) GetCountOfActiveExecutions ¶
GetCountOfActiveExecutions returns the number of active executions of all services.
func (*Execution) GetFor ¶
GetFor queries the current active service execution for the given service. Returns "false" if no current execution matches.
func (*Execution) Information ¶
func (instance *Execution) Information() map[string]service.Information
Information returns an information object that contains information for every configured service.
func (*Execution) InformationFor ¶
func (instance *Execution) InformationFor(s *service.Service) service.Information
InformationFor returns an information object for the given service.
func (*Execution) Run ¶
Run starts the caretakerd execution, every service and required resource. This is a blocking method.