Documentation ¶
Index ¶
- type ClusterMember
- func (n *ClusterMember) Broadcast(ctx context.Context, listener func([]byte))
- func (n *ClusterMember) Emit(value []byte) error
- func (n *ClusterMember) EventLeader(isMaster bool, master string)
- func (n *ClusterMember) GetBroadcasts(overhead, limit int) [][]byte
- func (n *ClusterMember) Leave(node *memberlist.Node)
- func (n *ClusterMember) LocalState(join bool) []byte
- func (n *ClusterMember) MergeRemoteState(buf []byte, join bool)
- func (n *ClusterMember) NodeMeta(limit int) []byte
- func (n *ClusterMember) NotifyMsg(msg []byte)
- type Election
- type ElectionConfig
- type Notifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterMember ¶
type ClusterMember struct { Address string // contains filtered or unexported fields }
func NewClusterMember ¶
func NewClusterMember(address string) *ClusterMember
func (*ClusterMember) Broadcast ¶
func (n *ClusterMember) Broadcast(ctx context.Context, listener func([]byte))
func (*ClusterMember) Emit ¶
func (n *ClusterMember) Emit(value []byte) error
func (*ClusterMember) EventLeader ¶
func (n *ClusterMember) EventLeader(isMaster bool, master string)
func (*ClusterMember) GetBroadcasts ¶
func (n *ClusterMember) GetBroadcasts(overhead, limit int) [][]byte
Membership Delegate
func (*ClusterMember) Leave ¶
func (n *ClusterMember) Leave(node *memberlist.Node)
func (*ClusterMember) LocalState ¶
func (n *ClusterMember) LocalState(join bool) []byte
Membership Delegate
func (*ClusterMember) MergeRemoteState ¶
func (n *ClusterMember) MergeRemoteState(buf []byte, join bool)
Membership Delegate
func (*ClusterMember) NodeMeta ¶
func (n *ClusterMember) NodeMeta(limit int) []byte
Membership Delegate
type Election ¶
type Election struct { Client *api.Client // Consul client Checks []string // Slice of associated health checks Kv string // Key in Consul kv CheckTimeout time.Duration LogPrefix string // Prefix for a log Event Notifier Node string Master string sync.RWMutex Num int // contains filtered or unexported fields }
Election implements to detect a leader in a cluster of services
func NewElection ¶
func NewElection(c *ElectionConfig) *Election
Params: Consul client, slice of associated health checks, service name
func (*Election) NotifyJoin ¶
func (e *Election) NotifyJoin(node *memberlist.Node)
func (*Election) NotifyLeave ¶
func (e *Election) NotifyLeave(node *memberlist.Node)
func (*Election) NotifyUpdate ¶
func (e *Election) NotifyUpdate(node *memberlist.Node)
func (*Election) SetLogLevel ¶
SetLogLevel is setting level according constants LogDisable|LogError|LogInfo|LogDebug
type ElectionConfig ¶
type ElectionConfig struct { Client *api.Client // Consul client Checks []string // Slice of associated health checks Key string // Key in Consul KV LogLevel uint8 // Log level LogDisable|LogError|LogInfo|LogDebug LogPrefix string // Prefix for a log Event Notifier CheckTimeout time.Duration Node string }
ElectionConfig config for Election
Click to show internal directories.
Click to hide internal directories.