Documentation ¶
Index ¶
- Constants
- func AckStatusUpdates(caller calls.Caller) Rule
- func AckStatusUpdatesF(callerLookup func() calls.Caller) Rule
- func DefaultEventLogger(eventLabel string) func(*scheduler.Event)
- func LiftErrors() Rule
- func LogEvents(f func(*scheduler.Event)) Rule
- func Run(ctx context.Context, framework *mesos.FrameworkInfo, caller calls.Caller, ...) (lastErr error)
- func TrackSubscription(frameworkIDStore store.Singleton, failoverTimeout time.Duration) Rule
- type Config
- type ErrEvent
- type Option
- type StateError
Constants ¶
const DefaultEventLabel = "event"
DefaultEventLabel is, by default, logged as the first argument by DefaultEventLogger
const DefaultHandler = events.NoopHandler
DefaultHandler is invoked when no other handlers have been defined for the controller. The current implementation does nothing. TODO(jdef) a smarter default impl would decline all offers so as to avoid resource hoarding.
Variables ¶
This section is empty.
Functions ¶
func AckStatusUpdates ¶ added in v0.0.4
AckStatusUpdates sends an acknowledgement of a task status update back to mesos and drops the event if sending the ack fails. If successful, the specified err param (if any) is forwarded. Acknowledgements are only attempted for task status updates tagged with a UUID.
func AckStatusUpdatesF ¶ added in v0.0.4
AckStatusUpdatesF is a functional adapter for AckStatusUpdates, useful for cases where the caller may change over time. An error that occurs while ack'ing the status update is returned as a calls.AckError.
func DefaultEventLogger ¶ added in v0.0.4
DefaultEventLogger logs the event via the `log` package.
func LiftErrors ¶ added in v0.0.4
func LiftErrors() Rule
LiftErrors extract the error message from a scheduler error event and returns it as an ErrEvent so that downstream rules/handlers may continue processing.
func LogEvents ¶ added in v0.0.4
LogEvents returns a rule that logs scheduler events to the EventLogger
func Run ¶ added in v0.0.4
func Run(ctx context.Context, framework *mesos.FrameworkInfo, caller calls.Caller, options ...Option) (lastErr error)
Run executes a control loop that registers a framework with Mesos and processes the scheduler events that flow through the subscription. Upon disconnection, if the current configuration reports "not done" then the controller will attempt to re-register the framework and continue processing events.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is an opaque controller configuration. Properties are configured by applying Option funcs.
type ErrEvent ¶
type ErrEvent string
ErrEvent errors are generated by LiftErrors upon receiving an ERROR event from Mesos.
type Option ¶ added in v0.0.4
Option modifies a Config, returns an Option that acts as an "undo"
func WithEventHandler ¶ added in v0.0.4
WithEventHandler sets the consumer of 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.
func WithFrameworkID ¶ added in v0.0.4
WithFrameworkID sets a fetcher for the current Mesos-assigned framework ID. Frameworks are expected to track this ID (that comes from Mesos, in a SUBSCRIBED event). frameworkIDFunc is optional; nil tells the controller to always register as a new framework for each subscription attempt.
func WithRegistrationTokens ¶ added in v0.0.4
func WithRegistrationTokens(registrationTokens <-chan struct{}) Option
WithRegistrationTokens limits the rate at which a framework (re)registers with Mesos. A non-nil chan should yield a struct{} in order to allow the framework registration process to continue. When nil, there is no backoff delay between re-subscription attempts. A closed chan disables re-registration and terminates the Run control loop.
func WithSubscriptionTerminated ¶ added in v0.0.4
WithSubscriptionTerminated sets a handler that is invoked at the end of every subscription cycle; the given error may be nil if no error occurred. subscriptionTerminated is optional; if nil then errors are swallowed.
type StateError ¶ added in v0.0.4
type StateError string
StateError is returned when the system encounters an unresolvable state transition error and should likely exit.
func (StateError) Error ¶ added in v0.0.4
func (err StateError) Error() string