Documentation
¶
Index ¶
- Variables
- func AgentDone(logger loggo.Logger, err error) error
- func ConnectionIsFatal(logger loggo.Logger, conns ...Pinger) func(err error) bool
- func HookExecutionLock(dataDir string) (*fslock.Lock, error)
- func IsFatal(err error) bool
- func MoreImportant(err0, err1 error) bool
- func NewCloseWorker(logger loggo.Logger, worker worker.Worker, closer io.Closer) worker.Worker
- func NewEnsureServerParams(agentConfig agent.Config) (mongo.EnsureServerParams, error)
- func ParamsStateServingInfoToStateStateServingInfo(i params.StateServingInfo) state.StateServingInfo
- func RequiredError(name string) error
- type CloseWorker
- type FatalError
- type Pinger
Constants ¶
This section is empty.
Variables ¶
var ( DataDir = paths.MustSucceed(paths.DataDir(version.Current.Series)) EnsureMongoServer = mongo.EnsureServer )
var ConnectionIsDead = func(logger loggo.Logger, conn Pinger) bool { if err := conn.Ping(); err != nil { logger.Infof("error pinging %T: %v", conn, err) return true } return false }
ConnectionIsDead returns true if the given pinger fails to ping.
var NewRsyslogConfigWorker = func(st *apirsyslog.State, agentConfig agent.Config, mode rsyslog.RsyslogMode) (worker.Worker, error) { tag := agentConfig.Tag() namespace := agentConfig.Value(agent.Namespace) addrs, err := agentConfig.APIAddresses() if err != nil { return nil, err } return rsyslog.NewRsyslogConfigWorker(st, mode, tag, namespace, addrs) }
NewRsyslogConfigWorker creates and returns a new RsyslogConfigWorker based on the specified configuration parameters.
Functions ¶
func ConnectionIsFatal ¶
ConnectionIsFatal returns a function suitable for passing as the isFatal argument to worker.NewRunner, that diagnoses an error as fatal if the connection has failed or if the error is otherwise fatal.
func HookExecutionLock ¶
HookExecutionLock returns an *fslock.Lock suitable for use as a unit hook execution lock. Other workers may also use this lock if they require isolation from hook execution.
func MoreImportant ¶
MoreImportant returns whether err0 is more important than err1 - that is, whether we should act on err0 in preference to err1.
func NewCloseWorker ¶
NewCloseWorker returns a task that wraps the given task, closing the given closer when it finishes.
func NewEnsureServerParams ¶
func NewEnsureServerParams(agentConfig agent.Config) (mongo.EnsureServerParams, error)
NewEnsureServerParams creates an EnsureServerParams from an agent configuration.
func ParamsStateServingInfoToStateStateServingInfo ¶
func ParamsStateServingInfoToStateStateServingInfo(i params.StateServingInfo) state.StateServingInfo
ParamsStateServingInfoToStateStateServingInfo converts a params.StateServingInfo to a state.StateServingInfo.
func RequiredError ¶
requiredError is useful when complaining about missing command-line options.
Types ¶
type CloseWorker ¶
type CloseWorker struct {
// contains filtered or unexported fields
}
CloseWorker is a worker which closes the given closer when finished with a task.
func (*CloseWorker) Kill ¶
func (c *CloseWorker) Kill()
func (*CloseWorker) Wait ¶
func (c *CloseWorker) Wait() error
type FatalError ¶
type FatalError struct {
Err string
}
FatalError is an error type designated for fatal errors.