Documentation ¶
Index ¶
- Constants
- func OversizedMessage(b []byte) bool
- type Channel
- type ClusterChannel
- type ClusterMember
- type ClusterPeer
- type Member
- type Peer
- func (p *Peer) AddState(key string, s State, reg prometheus.Registerer) ClusterChannel
- func (p *Peer) ClusterSize() int
- func (p *Peer) Info() map[string]interface{}
- func (p *Peer) Join(reconnectInterval time.Duration, reconnectTimeout time.Duration) error
- func (p *Peer) Leave(timeout time.Duration) error
- func (p *Peer) Name() string
- func (p *Peer) Peers() []ClusterMember
- func (p *Peer) Position() int
- func (p *Peer) Ready() bool
- func (p *Peer) Self() *memberlist.Node
- func (p *Peer) Settle(ctx context.Context, interval time.Duration)
- func (p *Peer) Status() string
- func (p *Peer) WaitReady(ctx context.Context) error
- type PeerStatus
- type State
Constants ¶
const ( DefaultPushPullInterval = 60 * time.Second DefaultGossipInterval = 200 * time.Millisecond DefaultTcpTimeout = 10 * time.Second DefaultProbeTimeout = 500 * time.Millisecond DefaultProbeInterval = 1 * time.Second DefaultReconnectInterval = 10 * time.Second DefaultReconnectTimeout = 6 * time.Hour DefaultRefreshInterval = 15 * time.Second MaxGossipPacketSize = 1400 )
Variables ¶
This section is empty.
Functions ¶
func OversizedMessage ¶
OversizedMessage indicates whether or not the byte payload should be sent via TCP.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel allows clients to send messages for a specific state type that will be broadcasted in a best-effort manner.
func NewChannel ¶
func NewChannel( key string, send func([]byte), peers func() []*memberlist.Node, sendOversize func(*memberlist.Node, []byte) error, logger log.Logger, stopc chan struct{}, reg prometheus.Registerer, ) *Channel
NewChannel creates a new Channel struct, which handles sending normal and oversize messages to peers.
type ClusterChannel ¶
type ClusterChannel interface {
Broadcast([]byte)
}
ClusterChannel supports state broadcasting across peers.
type ClusterMember ¶
type ClusterMember interface { // Name returns the name of the node Name() string // Address returns the IP address of the node Address() string }
ClusterMember interface that represents node peers in a cluster
type ClusterPeer ¶
type ClusterPeer interface { // Name returns the unique identifier of this peer in the cluster. Name() string // Status returns a status string representing the peer state. Status() string // Peers returns the peer nodes in the cluster. Peers() []ClusterMember }
ClusterPeer represents a single Peer in a gossip cluster.
type Member ¶
type Member struct {
// contains filtered or unexported fields
}
Member represents a member in the cluster.
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
Peer is a single peer in a gossip cluster.
func (*Peer) AddState ¶
func (p *Peer) AddState(key string, s State, reg prometheus.Registerer) ClusterChannel
AddState adds a new state that will be gossiped. It returns a channel to which broadcast messages for the state can be sent.
func (*Peer) ClusterSize ¶
ClusterSize returns the current number of alive members in the cluster.
func (*Peer) Self ¶
func (p *Peer) Self() *memberlist.Node
Self returns the node information about the peer itself.
func (*Peer) Settle ¶
Settle waits until the mesh is ready (and sets the appropriate internal state when it is). The idea is that we don't want to start "working" before we get a chance to know most of the alerts and/or silences. Inspired from https://github.com/apache/cassandra/blob/7a40abb6a5108688fb1b10c375bb751cbb782ea4/src/java/org/apache/cassandra/gms/Gossiper.java This is clearly not perfect or strictly correct but should prevent the alertmanager to send notification before it is obviously not ready. This is especially important for those that do not have persistent storage.
type PeerStatus ¶
type PeerStatus int
PeerStatus is the state that a peer is in.
const ( StatusNone PeerStatus = iota StatusAlive StatusFailed )
func (PeerStatus) String ¶
func (s PeerStatus) String() string