Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultHandler ¶
DefaultHandler provides the minimum implementation required for correct controller behavior.
Types ¶
type Config ¶
type Config struct {
Context Context // Context is required
Framework *mesos.FrameworkInfo // FrameworkInfo is required
Caller calls.Caller // Caller is required
// Handler (optional) processes scheduler events. The controller's internal event processing
// loop is aborted if a Handler returns a non-nil error, after which the controller may attempt
// to re-register (subscribe) with Mesos.
Handler events.Handler
// RegistrationTokens (optional) limits the rate at which a framework (re)registers with Mesos.
// The returned chan should either be non-blocking (nil/closed), or should yield a struct{} in
// order to allow the framework registration process to continue. May be nil.
RegistrationTokens <-chan struct{}
}
type Context ¶
type Context interface {
// Done returns true when the controller should exit
Done() bool
// FrameworkID returns the current Mesos-assigned framework ID. Frameworks are expected to
// track this ID (that comes from Mesos, in a SUBSCRIBED event).
FrameworkID() string
// Error is an error handler that is invoked at the end of every subscription cycle; the given
// error may be nil (if no errors occurred).
Error(error)
}
type ContextAdapter ¶
type ContextAdapter struct {
// FrameworkIDFunc is optional; nil tells the controller to always register as a new framework
// for each subscription attempt.
FrameworkIDFunc func() string
// Done is optional; nil equates to a func that always returns false
DoneFunc func() bool
// ErrorFunc is optional; if nil then errors are swallowed
ErrorFunc func(error)
}
func (*ContextAdapter) Done ¶
func (ca *ContextAdapter) Done() bool
func (*ContextAdapter) Error ¶
func (ca *ContextAdapter) Error(err error)
func (*ContextAdapter) FrameworkID ¶
func (ca *ContextAdapter) FrameworkID() (id string)
type Controller ¶
type Controller interface {
// Run executes the controller using the given Config
Run(Config) error
}
func New ¶
func New() Controller
type ControllerFunc ¶
ControllerFunc is a functional adaptation of a Controller
func (ControllerFunc) Run ¶
func (cf ControllerFunc) Run(config Config) error
Run implements Controller for ControllerFunc
Click to show internal directories.
Click to hide internal directories.