Documentation ¶
Index ¶
- Constants
- func FilterMembers(memberType NodeType, list *memberlist.Memberlist) []*memberlist.Node
- func FilterMembersByFn(filter MemberFilter, list *memberlist.Memberlist) []*memberlist.Node
- func SearchForCluster() *zeroconf.ServiceEntry
- type Delegate
- type EventDelegate
- type MemberFilter
- type NodeMeta
- type NodeType
Constants ¶
const (
// ServiceType is the type used to advertise the cluster to join
ServiceType = "_bobcaygeon._tcp"
)
Variables ¶
This section is empty.
Functions ¶
func FilterMembers ¶
func FilterMembers(memberType NodeType, list *memberlist.Memberlist) []*memberlist.Node
FilterMembers filters down the memberlist to return only nodes of the given type
func FilterMembersByFn ¶
func FilterMembersByFn(filter MemberFilter, list *memberlist.Memberlist) []*memberlist.Node
FilterMembersByFn provides more flexibility in using a filtering function
func SearchForCluster ¶
func SearchForCluster() *zeroconf.ServiceEntry
SearchForCluster searches for a cluster to join
Types ¶
type Delegate ¶
type Delegate struct {
MetaData *NodeMeta
}
Delegate handles memberlist events
func (Delegate) GetBroadcasts ¶
GetBroadcasts is called when user data messages can be broadcast.
func (Delegate) LocalState ¶
LocalState is used for a TCP Push/Pull. This is sent to the remote side in addition to the membership information.
func (Delegate) MergeRemoteState ¶
MergeRemoteState is invoked after a TCP Push/Pull.
type EventDelegate ¶
type EventDelegate struct {
// contains filtered or unexported fields
}
EventDelegate handles the delgate functions from the memberlist
func NewEventDelegate ¶
func NewEventDelegate(d []memberlist.EventDelegate) *EventDelegate
NewEventDelegate instantiates a new EventDelegate struct
func (*EventDelegate) NotifyJoin ¶
func (ed *EventDelegate) NotifyJoin(node *memberlist.Node)
NotifyJoin is invoked when a node is detected to have joined. The Node argument must not be modified.
func (*EventDelegate) NotifyLeave ¶
func (ed *EventDelegate) NotifyLeave(node *memberlist.Node)
NotifyLeave is invoked when a node is detected to have left. The Node argument must not be modified.
func (*EventDelegate) NotifyUpdate ¶
func (ed *EventDelegate) NotifyUpdate(node *memberlist.Node)
NotifyUpdate is invoked when a node is detected to have updated, usually involving the meta data. The Node argument must not be modified.
type MemberFilter ¶
type MemberFilter func(*memberlist.Node) bool
MemberFilter function used to filter the list down
type NodeMeta ¶
NodeMeta is metadata passed to other members about this node
func DecodeNodeMeta ¶
DecodeNodeMeta decodes node meta data from bytes into something useful