Documentation ¶
Overview ¶
Serfer is a simple library which provides interfaces for handling various Serf events.
This allows for an encapsulation of more complex event processing logic by using separate event handlers based on event type.
Index ¶
- Constants
- type EventHandler
- type IsLeaderFunc
- type LeaderElectionHandler
- type MemberEventHandler
- type MemberFailureHandler
- type MemberJoinHandler
- type MemberLeaveHandler
- type MemberReapHandler
- type MemberUpdateHandler
- type QueryEventHandler
- type Reconciler
- type SerfEventHandler
- type Serfer
- type UnknownEventHandler
- type UserEventHandler
Constants ¶
const ( // StatusReap is used to update the status of a node if we // are handling a EventMemberReap StatusReap = serf.MemberStatus(-1) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventHandler ¶
EventHandler processes generic Serf events. Depending on the event type, more processing may be needed.
type IsLeaderFunc ¶
type IsLeaderFunc func() bool
IsLeaderFunc should return true if the local node is the cluster leader.
type LeaderElectionHandler ¶
LeaderElectionHandler handles leader election events.
type MemberEventHandler ¶
type MemberEventHandler interface {
HandleMemberEvent(serf.MemberEvent)
}
MemberEventHandler handles membership change events.
type MemberFailureHandler ¶
type MemberFailureHandler interface {
HandleMemberFailure(serf.MemberEvent)
}
MemberFailureHandler handles member failure events.
type MemberJoinHandler ¶
type MemberJoinHandler interface {
HandleMemberJoin(serf.MemberEvent)
}
MemberJoinHandler handles member join events.
type MemberLeaveHandler ¶
type MemberLeaveHandler interface {
HandleMemberLeave(serf.MemberEvent)
}
MemberLeaveHandler handles member leave events.
type MemberReapHandler ¶
type MemberReapHandler interface {
HandleMemberReap(serf.MemberEvent)
}
MemberReapHandler handles member reap events.
type MemberUpdateHandler ¶
type MemberUpdateHandler interface {
HandleMemberUpdate(serf.MemberEvent)
}
MemberUpdateHandler handles member update events.
type QueryEventHandler ¶
QueryEventHandler handles Serf query events.
type Reconciler ¶
Reconciler is used to reconcile Serf events wilth an external process, like Raft.
type SerfEventHandler ¶
type SerfEventHandler struct { // ServicePrefix is used to filter out unknown events. ServicePrefix string // ReconcileOnJoin determines if the Reconiler is called when a node joins the cluster. ReconcileOnJoin bool // ReconcileOnLeave determines if the Reconiler is called when a node leaves the cluster. ReconcileOnLeave bool // ReconcileOnFail determines if the Reconiler is called when a node fails. ReconcileOnFail bool // ReconcileOnUpdate determines if the Reconiler is called when a node updates. ReconcileOnUpdate bool // ReconcileOnReap determines if the Reconiler is called when a node is reaped from the cluster. ReconcileOnReap bool // IsLeader determines if the local node is the cluster leader. IsLeader IsLeaderFunc // IsLeaderEventFunc determines if an event is a leader election event based on the event name. IsLeaderEvent func(string) bool // LeaderElectionHandler processes leader election events. LeaderElectionHandler LeaderElectionHandler // UserEvent processes known, non-leader election events. UserEvent UserEventHandler // UnknownEventHandler processes unkown events. UnknownEventHandler UnknownEventHandler // Called when a Member joins the cluster. NodeJoined MemberJoinHandler // Called when a Member leaves the cluster by sending a leave message. NodeLeft MemberLeaveHandler // Called when a Member has been detected as failed. NodeFailed MemberFailureHandler // Called when a Member has been Readed from the cluster. NodeReaped MemberReapHandler // Called when a Member has been updated. NodeUpdated MemberUpdateHandler // Called when a membership event occurs. Reconciler Reconciler // Called when a serf.Query is received. QueryHandler QueryEventHandler // Logs output Logger log.Logger }
SerfEventHandler is used to dispatch various Serf events to separate event handlers.
func (SerfEventHandler) HandleEvent ¶
func (s SerfEventHandler) HandleEvent(e serf.Event)
HandleEvent processes a generic Serf event and dispatches it to the appropriate destination.
type Serfer ¶
type Serfer interface { // Start starts the serfer goroutine. Start() // Stop stops all event processing and blocks until finished. Stop() error }
Serfer processes Serf.Events and is meant to be ran in a goroutine.
type UnknownEventHandler ¶
UnknownEventHandler handles unknown events.
type UserEventHandler ¶
UserEventHandler handles user events.
Directories ¶
Path | Synopsis |
---|---|
Godeps
|
|
+build go1.3 | |
_workspace/src/github.com/hashicorp/go-msgpack/codec
High Performance, Feature-Rich Idiomatic Go encoding library for msgpack and binc .
|
High Performance, Feature-Rich Idiomatic Go encoding library for msgpack and binc . |
_workspace/src/github.com/hashicorp/memberlist
memberlist is a library that manages cluster membership and member failure detection using a gossip based protocol.
|
memberlist is a library that manages cluster membership and member failure detection using a gossip based protocol. |
_workspace/src/github.com/mattn/go-isatty
Package isatty implements interface to isatty
|
Package isatty implements interface to isatty |
_workspace/src/github.com/mgutz/ansi
Package ansi is a small, fast library to create ANSI colored strings and codes.
|
Package ansi is a small, fast library to create ANSI colored strings and codes. |
_workspace/src/github.com/stretchr/objx
objx - Go package for dealing with maps, slices, JSON and other data.
|
objx - Go package for dealing with maps, slices, JSON and other data. |
_workspace/src/github.com/stretchr/testify/assert
A set of comprehensive testing tools for use with the normal Go testing system.
|
A set of comprehensive testing tools for use with the normal Go testing system. |
_workspace/src/github.com/stretchr/testify/mock
Provides a system by which it is possible to mock your objects and verify calls are happening as expected.
|
Provides a system by which it is possible to mock your objects and verify calls are happening as expected. |
_workspace/src/github.com/stretchr/testify/suite
The suite package contains logic for creating testing suite structs and running the methods on those structs as tests.
|
The suite package contains logic for creating testing suite structs and running the methods on those structs as tests. |
_workspace/src/golang.org/x/net/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
|
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes. |
_workspace/src/gopkg.in/tomb.v2
The tomb package handles clean goroutine tracking and termination.
|
The tomb package handles clean goroutine tracking and termination. |