Documentation
¶
Index ¶
- Variables
- func APIManifold(config APIManifoldConfig, start APIStartFunc) dependency.Manifold
- func AgentAPIManifold(config AgentAPIManifoldConfig, start AgentAPIStartFunc) dependency.Manifold
- func AgentManifold(config AgentManifoldConfig, start AgentStartFunc) dependency.Manifold
- func DependencyEngineConfig(metrics dependency.Metrics, logger dependency.Logger) dependency.EngineConfig
- func FlagOutput(in worker.Worker, out interface{}) error
- func NewStaticFlagWorker(value bool) worker.Worker
- func NewValueWorker(value interface{}) (worker.Worker, error)
- func ValueWorkerOutput(in worker.Worker, out interface{}) error
- type APIManifoldConfig
- type APIStartFunc
- type AgentAPIManifoldConfig
- type AgentAPIStartFunc
- type AgentManifoldConfig
- type AgentStartFunc
- type Collector
- type Decorator
- type Flag
- type Housing
- type MetricSink
Constants ¶
This section is empty.
Variables ¶
var EngineErrorDelay = 3 * time.Second
EngineErrorDelay is the amount of time the dependency engine waits between getting an error from a worker, and restarting it. It is exposed here so tests can make it smaller.
Functions ¶
func APIManifold ¶
func APIManifold(config APIManifoldConfig, start APIStartFunc) dependency.Manifold
APIManifold returns a dependency.Manifold that calls the supplied start func with the API resource defined in the config (once it's present).
func AgentAPIManifold ¶
func AgentAPIManifold(config AgentAPIManifoldConfig, start AgentAPIStartFunc) dependency.Manifold
AgentAPIManifold returns a dependency.Manifold that calls the supplied start func with the API and agent resources defined in the config (once those resources are present).
func AgentManifold ¶
func AgentManifold(config AgentManifoldConfig, start AgentStartFunc) dependency.Manifold
AgentManifold returns a dependency.Manifold that calls the supplied start func with the agent resource defined in the config (once it's present).
func DependencyEngineConfig ¶
func DependencyEngineConfig(metrics dependency.Metrics, logger dependency.Logger) dependency.EngineConfig
DependencyEngineConfig returns a dependency engine config.
func FlagOutput ¶
FlagOutput will expose, as a Flag, any worker that implements Flag.
func NewStaticFlagWorker ¶
NewStaticFlagWorker returns a new Worker that implements Flag, whose Check method always returns the specified value.
func NewValueWorker ¶
NewValueWorker returns a degenerate worker that exposes the supplied value when passed into ValueWorkerOutput. Please do not supply values that have their own dependency or lifecycle considerations; such values will subvert the operation of any containing dependency.Engine by insulating it from the failures and dependency changes of the contained value.
func ValueWorkerOutput ¶
ValueWorkerOutput sets the value wrapped by the supplied valueWorker into the out pointer, if type-compatible, or fails.
Types ¶
type APIManifoldConfig ¶
type APIManifoldConfig struct {
APICallerName string
}
Some (hopefully growing number of) manifolds completely depend on an API connection; this type configures them.
type APIStartFunc ¶
APIStartFunc encapsulates the behaviour that varies among APIManifolds.
type AgentAPIManifoldConfig ¶
Many manifolds completely depend on an agent and an API connection; this type configures them.
type AgentAPIStartFunc ¶
AgentAPIStartFunc encapsulates the behaviour that varies among AgentAPIManifolds.
type AgentManifoldConfig ¶
type AgentManifoldConfig struct {
AgentName string
}
Some manifolds just depend on an agent; this type configures them.
type AgentStartFunc ¶
AgentStartFunc encapsulates the behaviour that varies among AgentManifolds.
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector defines a new metrics collector. This allows the collection of models for one model.
func (*Collector) Collect ¶
func (c *Collector) Collect(ch chan<- prometheus.Metric)
Collect is part of the prometheus.Collector interface.
func (*Collector) Describe ¶
func (c *Collector) Describe(ch chan<- *prometheus.Desc)
Describe is part of the prometheus.Collector interface.
type Decorator ¶
type Decorator interface {
// Decorate returns a new Manifold, based on the one supplied.
Decorate(dependency.Manifold) dependency.Manifold
}
Decorator creates copies of dependency.Manifolds with additional features.
type Flag ¶
type Flag interface {
// Check returns the flag's value. Check calls must *always* return
// the same value for a given instantiation of the type implementing
// Flag.
Check() bool
}
Flag represents a single boolean used to determine whether a given manifold worker should run.
type Housing ¶
type Housing struct {
// Flags contains a list of names of Flag manifolds, such
// that a decorated manifold will not start until all flags
// are both present and valid (and will be stopped when that
// is no longer true).
Flags []string
// Occupy is ignored if empty; otherwise it contains the name
// of a fortress.Guest manifold, such that a decorated manifold
// will never be run outside a Visit to that fortress.
//
// NOTE: this acquires a lock, and holds it for your manifold's
// worker's whole lifetime. It's fine in isolation, but multiple
// Occupy~s are almost certainly a Bad Idea.
Occupy string
// Filter is ignored if nil; otherwise it's unconditionally set
// as the manifold's Filter. Similarly to Occupy, attempted use
// of multiple filters is unlikely to be a great idea; it most
// likely indicates that either your Engine's IsFatal is too
// enthusiastic, or responsibility for termination is spread too
// widely across your installed manifolds, or both.
Filter dependency.FilterFunc
}
Housing is a Decorator that combines several common mechanisms for coordinating manifolds independently of their core concerns.
func (Housing) Decorate ¶
func (housing Housing) Decorate(base dependency.Manifold) dependency.Manifold
Decorate is part of the Decorator interface.
type MetricSink ¶
type MetricSink interface {
dependency.Metrics
Unregister() bool
}
MetricSink describes a way to unregister a model metrics collector. This ensures that we correctly tidy up after the removal of a model.