Documentation
¶
Index ¶
- type Gossip
- func (g *Gossip) Close() error
- func (g *Gossip) JoinOnBoot(addrs []string) ([]string, error)
- func (g *Gossip) JoinOnStartup(ctx context.Context, addrs []string) ([]string, error)
- func (g *Gossip) Leave(ctx context.Context) error
- func (g *Gossip) Metrics() *gossip.Metrics
- func (g *Gossip) NodeState(id string) (*gossip.NodeState, bool)
- func (g *Gossip) Nodes() []gossip.NodeMetadata
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gossip ¶
type Gossip struct {
// contains filtered or unexported fields
}
Gossip is responsible for maintaining this nodes local State and propagating the state of the local node to the rest of the cluster.
At the gossip layer, a nodes state is represented as key-value pairs which are propagated around the cluster. These key-value pairs are then used to gossip based anti-entropy protocol. These key-value pairs are then used to build the local State.
func (*Gossip) JoinOnBoot ¶
JoinOnBoot attempts to join an existing cluster by syncronising with the members at the given addresses.
This will only attempt to join once and won't retry.
func (*Gossip) JoinOnStartup ¶
JoinOnStartup attempts to join an existing cluster by syncronising with the members at the given addresses.
This will retry 5 times (with backoff).
func (*Gossip) Leave ¶
Leave notifies the known members that this node is leaving the cluster.
This will attempt to sync with up to 3 nodes to ensure the leave status is propagated.
Returns an error if no known members could be notified.
func (*Gossip) Nodes ¶
func (g *Gossip) Nodes() []gossip.NodeMetadata
Nodes returns the metadata of all known nodes in the cluster.