Documentation ¶
Overview ¶
Package peer describes a ckit peer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AllStates = [...]State{ StateViewer, StateParticipant, StateTerminating, }
AllStates holds a list of all valid states.
Functions ¶
This section is empty.
Types ¶
type Peer ¶
type Peer struct { Name string // Name of the Peer. Unique across the cluster. Addr string // host:port address of the peer. Self bool // True if Peer is the local Node. State State // State of the peer. }
Peer is a discovered node within the cluster.
func (Peer) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Peer) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type State ¶
type State uint
State is used by Nodes to inform their peers what their role is as part of gossip.
const ( // StateViewer is the default state. Nodes in the Viewer state have a // read-only view of the cluster, and are never considered owners when // hashing. StateViewer State = iota // StateParticipant marks a node as available to receive writes. It will be // considered a potential owner while hashing read or write operations. StateParticipant // StateTerminating is used when a Participant node is shutting down. // Terminating nodes are considered potential owners while hashing read // operations. StateTerminating )
Click to show internal directories.
Click to hide internal directories.