Documentation
¶
Overview ¶
A gossip-based discovery service.
This package is based on some of the ideas found in the paper "A Gossip-Style Failure Detection Service" by van Renesse, Minsky, Hayden[1].
[1] http://www.cs.cornell.edu/home/rvr/papers/GossipFD.pdf
(c) 2014 <ale@incal.net>. See the file COPYING for details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // How many propagation constants one node must miss in order // for it to be considered dead (scales with the observed // cluster size). Nfailures = 3 // How often to broadcast to other nodes (default). Tgossip = 1 * time.Second // RPC deadline (default). Trpc = 5 * time.Second )
Functions ¶
This section is empty.
Types ¶
type GetMembersRequest ¶
type GetMembersRequest struct{}
type GetMembersResponse ¶
type GetMembersResponse struct {
Members []Member
}
type Gossip ¶
type Gossip struct {
// Updates channel.
C chan bool
// Set to true to enable debug output.
DebugOutput bool
// Timeouts.
Tgossip time.Duration
Trpc time.Duration
// contains filtered or unexported fields
}
Gossip represents a participant in the protocol. It contains the full connection state and membership information.
Example:
g = New(...)
go g.Run()
for {
<-g.C
// do something with the member list
}
A separate goroutine should periodically call gossip.SetData() to update the application-specific local state which is shared with the other peers.
func (*Gossip) FailureTime ¶
FailureTime returns the current time after which a node is considered dead. It is based on the gossip tick interval and the observed cluster size.
func (*Gossip) GetMembers ¶
Return the list of active members.
type GossipRequest ¶
type GossipRequest struct {
Members []Member
}
type GossipResponse ¶
type GossipResponse struct{}
type Member ¶
type Member struct {
// Address of this node (host:port).
Addr string
// Heartbeat counter.
Heartbeat int64
// Application-specific data.
Data interface{}
}
Member represents a participant in the gossip protocol. Applications can provide opaque data, which will be broadcasted to all the other participants.