Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Applier ¶
type Applier interface { // Apply processes commit messages after being processed by Raft Apply(Commit) }
Applier applies either a snapshot or entries in a Commit object
type Cluster ¶
type Cluster interface { Notifier Applier Updater // ID represents the cluster ID. ID() uint64 // Name returns the Cluster's name. Name() string // GetMember returns a Member instance based on it's ID. GetMember(uint64) Member // IsBanished checks whether the given ID has been removed from this // cluster at some point in the past. IsBanished(id uint64) bool // LocalNode returns the RaftNode which represents the local node of the cluster. LocalNode() RaftNode // Stop stops the cluster and triggers the context when finished. Stop(context.Context) }
Cluster maintains an active list of nodes in the cluster. Cluster is also responsible for reporting and responding to changes in cluster membership.
type ClusterChangeEvent ¶
type ClusterChangeEvent struct { Type ClusterEventType Member Member }
ClusterChangeEvent is used to store details about a cluster change. It is sent when a new node is detected and after the change has been applied to a raft log.
type ClusterChangeHandler ¶
type ClusterChangeHandler interface { // HandleJoin is called when a node joins the cluster. HandleJoin(ClusterChangeEvent) // HandleJoin is called when a node leaves the cluster. HandleLeave(ClusterChangeEvent) // HandleJoin is called when a node is updated. HandleUpdate(ClusterChangeEvent) }
ClusterChangeHandler is used to process ClusterChangeEvents.
type ClusterConfig ¶
ClusterConfig helps to configure a RaftNode
type ClusterEventType ¶
type ClusterEventType uint8
ClusterEventType is an enum describing how the cluster is changing.
const ( // AddMember is used to describe a cluster change when a node is added. AddMember ClusterEventType = iota // RemoveMember is used to describe a cluster change when a node is removed. RemoveMember // UpdateMember is used to describe a cluster change when a node is updated. UpdateMember )
type Commit ¶
type Commit struct { State RaftState Entries []raftpb.Entry Snapshot raftpb.Snapshot Messages []raftpb.Message Context context.Context }
Commit is used to send to the cluster to save either a snapshot or log entries.
type Notifier ¶
type Notifier interface { // Notify returns a read-only channel of ClusterChangeEvents which can be read when a node joins, leaves or is updated in the cluster. Notify(ClusterChangeEvent) }
Notifier notifies the receiver of the cluster change.
type RaftState ¶
type RaftState struct { CommitID uint64 Vote uint64 Term uint64 Lead uint64 LastLeadElectionTime time.Time RaftState raft.StateType }
RaftState describes the state of the Raft cluster for each commit
type Stopper ¶
type Stopper interface {
Stop() <-chan struct{}
}
Stopper stops whatever you need to be stopped. It is meant to be used inside a select statement.
type Updater ¶
type Updater interface { // Update is called after the ClusterChangeEvent has been processed and stored by Raft. Update(ClusterChangeEvent) }
Updater applies cluster change events
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/github.com/coreos/etcd/raft
Package raft provides an implementation of the raft consensus algorithm.
|
Package raft provides an implementation of the raft consensus algorithm. |
_workspace/src/github.com/coreos/etcd/raft/raftpb
Package raftpb is a generated protocol buffer package.
|
Package raftpb is a generated protocol buffer package. |
_workspace/src/github.com/gogo/protobuf/proto
Package proto converts data structures to and from the wire format of protocol buffers.
|
Package proto converts data structures to and from the wire format of protocol buffers. |
_workspace/src/github.com/gogo/protobuf/proto/proto3_proto
Package proto3_proto is a generated protocol buffer package.
|
Package proto3_proto is a generated protocol buffer package. |
_workspace/src/golang.org/x/net/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
|
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes. |
pkg
|
|
memberlist
Package memberlist implements the raftor.ClusterChangeNotifier interface along with the memberlist.EventDelegate interface.
|
Package memberlist implements the raftor.ClusterChangeNotifier interface along with the memberlist.EventDelegate interface. |