Documentation ¶
Index ¶
- Constants
- func GetGRPCPortFromBindPort(bindPort int) int
- func GetRaftPortFromBindPort(bindPort int) int
- func NewOptions(opts ...Option) *memberlist.Config
- type Broadcast
- type Delegate
- func (d *Delegate) BindMqttServer(server *mqtt.Server)
- func (d *Delegate) Broadcast(data []byte)
- func (d *Delegate) GetBroadcasts(overhead, limit int) [][]byte
- func (d *Delegate) InitBroadcasts(list *memberlist.Memberlist)
- func (d *Delegate) LocalState(join bool) []byte
- func (d *Delegate) MergeRemoteState(buf []byte, join bool)
- func (d *Delegate) NodeMeta(limit int) []byte
- func (d *Delegate) NotifyMsg(msg []byte)
- func (d *Delegate) Stop()
- type Membership
- func (m *Membership) BindMqttServer(server *mqtt.Server)
- func (m *Membership) Broadcast(msg []byte)
- func (m *Membership) EventChan() <-chan *mb.Event
- func (m *Membership) GetNodeByIP(ipAddr net.IP) *memberlist.Node
- func (m *Membership) Join(existing []string) (int, error)
- func (m *Membership) Leave() error
- func (m *Membership) LocalAddr() string
- func (m *Membership) LocalName() string
- func (m *Membership) LocalNode() *memberlist.Node
- func (m *Membership) Members() []mb.Member
- func (m *Membership) NumMembers() int
- func (m *Membership) SendToNode(nodeName string, msg []byte) error
- func (m *Membership) SendToOthers(msg []byte)
- func (m *Membership) Setup() error
- func (m *Membership) Stat() map[string]int64
- func (m *Membership) Stop()
- type NodeEvents
- type Option
- func WithAdvertiseAddr(advertiseAddr string) Option
- func WithAdvertisePort(advertisePort int) Option
- func WithBindAddr(bindAddr string) Option
- func WithBindPort(bindPort int) Option
- func WithCIDRsAllowed(ips []net.IPNet) Option
- func WithDelegate(delegate memberlist.Delegate) Option
- func WithEvent(event memberlist.EventDelegate) Option
- func WithHandoffQueueDepth(depth int) Option
- func WithLogOutput(writer io.Writer, level string) Option
- func WithNodeName(name string) Option
- func WithPushPullInterval(interval int) Option
- func WithSecretKey(secretKey []byte) Option
- func WithUDPBufferSize(size int) Option
- type RoundRobinBalancer
Constants ¶
View Source
const ( LogLevelWarn = "WARN" LogLevelError = "ERROR" LogLevelInfo = "INFO" )
Variables ¶
This section is empty.
Functions ¶
func GetGRPCPortFromBindPort ¶ added in v2.6.0
func GetRaftPortFromBindPort ¶ added in v2.6.0
func NewOptions ¶
func NewOptions(opts ...Option) *memberlist.Config
Types ¶
type Broadcast ¶
type Broadcast struct {
// contains filtered or unexported fields
}
func (*Broadcast) Invalidates ¶
func (b *Broadcast) Invalidates(other memberlist.Broadcast) bool
type Delegate ¶
type Delegate struct { sync.RWMutex State map[string]int64 Broadcasts *memberlist.TransmitLimitedQueue LocalNode *memberlist.Node // contains filtered or unexported fields }
func NewDelegate ¶
func (*Delegate) BindMqttServer ¶
func (*Delegate) GetBroadcasts ¶
func (*Delegate) InitBroadcasts ¶
func (d *Delegate) InitBroadcasts(list *memberlist.Memberlist)
func (*Delegate) LocalState ¶
func (*Delegate) MergeRemoteState ¶
type Membership ¶
type Membership struct {
// contains filtered or unexported fields
}
func (*Membership) BindMqttServer ¶
func (m *Membership) BindMqttServer(server *mqtt.Server)
func (*Membership) Broadcast ¶
func (m *Membership) Broadcast(msg []byte)
func (*Membership) EventChan ¶
func (m *Membership) EventChan() <-chan *mb.Event
func (*Membership) GetNodeByIP ¶
func (m *Membership) GetNodeByIP(ipAddr net.IP) *memberlist.Node
func (*Membership) Join ¶ added in v2.3.7
func (m *Membership) Join(existing []string) (int, error)
Join joins an existing Serf cluster. Returns the number of nodes successfully contacted. The returned error will be non-nil only in the case that no nodes could be contacted. The format of an existing node is nodename/ip:port or ip:port
func (*Membership) Leave ¶ added in v2.3.7
func (m *Membership) Leave() error
Leave gracefully exits the cluster.
func (*Membership) LocalAddr ¶
func (m *Membership) LocalAddr() string
func (*Membership) LocalName ¶
func (m *Membership) LocalName() string
func (*Membership) LocalNode ¶
func (m *Membership) LocalNode() *memberlist.Node
func (*Membership) Members ¶
func (m *Membership) Members() []mb.Member
func (*Membership) NumMembers ¶
func (m *Membership) NumMembers() int
func (*Membership) SendToNode ¶
func (m *Membership) SendToNode(nodeName string, msg []byte) error
SendToNode send message to a node
func (*Membership) SendToOthers ¶
func (m *Membership) SendToOthers(msg []byte)
SendToOthers send message to all nodes except yourself
func (*Membership) Setup ¶
func (m *Membership) Setup() error
func (*Membership) Stat ¶
func (m *Membership) Stat() map[string]int64
func (*Membership) Stop ¶
func (m *Membership) Stop()
type NodeEvents ¶
type NodeEvents struct {
// contains filtered or unexported fields
}
func NewEvents ¶
func NewEvents() *NodeEvents
func (*NodeEvents) NotifyJoin ¶
func (n *NodeEvents) NotifyJoin(node *memberlist.Node)
func (*NodeEvents) NotifyLeave ¶
func (n *NodeEvents) NotifyLeave(node *memberlist.Node)
func (*NodeEvents) NotifyUpdate ¶
func (n *NodeEvents) NotifyUpdate(node *memberlist.Node)
type Option ¶
type Option func(conf *memberlist.Config)
func WithAdvertiseAddr ¶
WithAdvertiseAddr "" default "0.0.0.0"
func WithAdvertisePort ¶
WithAdvertisePort 0 dynamically bind a port
func WithCIDRsAllowed ¶
func WithDelegate ¶
func WithDelegate(delegate memberlist.Delegate) Option
func WithEvent ¶
func WithEvent(event memberlist.EventDelegate) Option
func WithHandoffQueueDepth ¶
func WithNodeName ¶
WithNodeName the name of this node. This must be unique in the cluster.
func WithPushPullInterval ¶
func WithSecretKey ¶
func WithUDPBufferSize ¶
type RoundRobinBalancer ¶
func NewRoundRobinBalancer ¶
func NewRoundRobinBalancer(m *Membership) *RoundRobinBalancer
func (*RoundRobinBalancer) Get ¶
func (r *RoundRobinBalancer) Get() *memberlist.Node
Click to show internal directories.
Click to hide internal directories.