package events
import "github.com/mesos/mesos-go/api/v1/lib/scheduler/events"
Index ¶
- type Decorator
- func Metrics(harness xmetrics.Harness) Decorator
- func (d Decorator) Apply(h Handler) Handler
- func (d Decorator) If(b bool) Decorator
- func (d Decorator) When(f func() bool) Decorator
- type Decorators
- type Handler
- func AcknowledgeUpdates(callerGetter func() calls.Caller) Handler
- func Once(h Handler) Handler
- func OnceFunc(h HandlerFunc) Handler
- func When(p Happens, h Handler) Handler
- func WhenFunc(p Happens, h HandlerFunc) Handler
- type HandlerFunc
- type Handlers
- type Happens
- type Mux
- func NewMux(opts ...Option) *Mux
- func (m *Mux) HandleEvent(e *scheduler.Event) (err error)
- func (m *Mux) With(opts ...Option) Option
- type Option
- func DefaultHandler(eh Handler) Option
- func Handle(et scheduler.Event_Type, eh Handler) Option
- func Map(handlers map[scheduler.Event_Type]Handler) (option Option)
- func MapFuncs(handlers map[scheduler.Event_Type]HandlerFunc) (option Option)
- type PredicateBool
Types ¶
type Decorator ¶
Decorator functions typically modify behavior of the given delegate Handler.
func Metrics ¶
func (Decorator) Apply ¶
func (Decorator) If ¶
If returns the receiving Decorator if the given bool is true; otherwise returns a no-op Decorator instance.
func (Decorator) When ¶
When returns a Decorator that evaluates the bool func every time the Handler is invoked. When f returns true, the Decorated Handler is invoked, otherwise the original Handler is.
type Decorators ¶
type Decorators []Decorator
Decorators aggregates Decorator functions
func (Decorators) Apply ¶
func (ds Decorators) Apply(h Handler) Handler
Apply applies the Decorators in the order they're listed such that the last Decorator invoked generates the final (wrapping) Handler that is ultimately returned.
type Handler ¶
Handler is invoked upon the occurrence of some scheduler event that is generated by some other component in the Mesos ecosystem (e.g. master, agent, executor, etc.)
func AcknowledgeUpdates ¶
AcknowledgeUpdates generates a Handler that sends an Acknowledge call to Mesos for every UPDATE event that's received.
func Once ¶
func OnceFunc ¶
func OnceFunc(h HandlerFunc) Handler
func When ¶
func WhenFunc ¶
func WhenFunc(p Happens, h HandlerFunc) Handler
type HandlerFunc ¶
HandlerFunc is a functional adaptation of the Handler interface
func (HandlerFunc) HandleEvent ¶
func (f HandlerFunc) HandleEvent(e *scheduler.Event) error
HandleEvent implements Handler for HandlerFunc
type Handlers ¶
type Handlers []Handler
Handlers aggregates Handler things
func (Handlers) HandleEvent ¶
HandleEvent implements Handler for Handlers
type Happens ¶
type Happens interface { Happens() scheduler.EventPredicate }
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux maps event types to Handlers (only one Handler for each type). A "default" Handler implementation may be provided to handle cases in which there is no registered Handler for specific event type.
func NewMux ¶
NewMux generates and returns a new, empty Mux instance.
func (*Mux) HandleEvent ¶
HandleEvent implements Handler for Mux
func (*Mux) With ¶
With applies the given options to the Mux and returns the result of invoking the last Option func. If no options are provided then a no-op Option is returned.
type Option ¶
Option is a functional configuration option that returns an "undo" option that reverts the change made by the option.
func DefaultHandler ¶
DefaultHandler returns an option that configures the default handler that's invoked in cases where there is no Handler registered for specific event type.
func Handle ¶
func Handle(et scheduler.Event_Type, eh Handler) Option
Handle returns an option that configures a Handler to handle a specific event type. If the specified Handler is nil then any currently registered Handler for the given event type is deleted upon application of the returned Option.
func Map ¶
func Map(handlers map[scheduler.Event_Type]Handler) (option Option)
Map returns an Option that configures multiple Handler objects.
func MapFuncs ¶
func MapFuncs(handlers map[scheduler.Event_Type]HandlerFunc) (option Option)
MapFuncs is the functional adaptation of Map
type PredicateBool ¶
type PredicateBool func() bool
func (PredicateBool) Happens ¶
func (b PredicateBool) Happens() scheduler.EventPredicate
Source Files ¶
decorators.go events.go metrics.go predicates.go
- Version
- v0.0.3
- Published
- Jun 19, 2017
- Platform
- windows/amd64
- Imports
- 4 packages
- Last checked
- 1 hour ago –
Tools for package owners.