package events
import "github.com/mesos/mesos-go/api/v1/lib/executor/events"
Index ¶
- type 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
- type HandlerFunc
- type Mux
- func NewMux(opts ...Option) *Mux
- func (m *Mux) HandleEvent(e *executor.Event) (err error)
- func (m *Mux) With(opts ...Option) Option
- type Option
Types ¶
type Decorator ¶
Decorator functions typically modify behavior of the given delegate Handler.
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 executor event that is generated by some other component in the Mesos ecosystem (e.g. master, agent, executor, etc.)
type HandlerFunc ¶
HandlerFunc is a functional adaptation of the Handler interface
func (HandlerFunc) HandleEvent ¶
func (f HandlerFunc) HandleEvent(e *executor.Event) error
HandleEvents implements Handler for HandlerFunc
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 executor.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.
Source Files ¶
- Version
- v0.0.3
- Published
- Jun 19, 2017
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 1 hour ago –
Tools for package owners.