var ErrStepLocalMsg … var ErrStepPeerNotFound … type RawNode … // NewRawNode instantiates a RawNode from the given configuration. // // See Bootstrap() for bootstrapping an initial state; this replaces the former // 'peers' argument to this method (with identical behavior). However, It is // recommended that instead of calling Bootstrap, applications bootstrap their // state manually by setting up a Storage that has a first index > 1 and which // stores the desired ConfState as its InitialState. func NewRawNode(config *Config) (*RawNode, error) { … } // Tick advances the internal logical clock by a single tick. func (rn *RawNode) Tick() { … } // TickQuiesced advances the internal logical clock by a single tick without // performing any other state machine processing. It allows the caller to avoid // periodic heartbeats and elections when all of the peers in a Raft group are // known to be at the same state. Expected usage is to periodically invoke Tick // or TickQuiesced depending on whether the group is "active" or "quiesced". // // WARNING: Be very careful about using this method as it subverts the Raft // state machine. You should probably be using Tick instead. func (rn *RawNode) TickQuiesced() { … } // Campaign causes this RawNode to transition to candidate state. func (rn *RawNode) Campaign() error { … } // Propose proposes data be appended to the raft log. func (rn *RawNode) Propose(data []byte) error { … } // ProposeConfChange proposes a config change. See (Node).ProposeConfChange for // details. func (rn *RawNode) ProposeConfChange(cc pb.ConfChangeI) error { … } // ApplyConfChange applies a config change to the local node. The app must call // this when it applies a configuration change, except when it decides to reject // the configuration change, in which case no call must take place. func (rn *RawNode) ApplyConfChange(cc pb.ConfChangeI) *pb.ConfState { … } // Step advances the state machine using the given message. func (rn *RawNode) Step(m pb.Message) error { … } // Ready returns the outstanding work that the application needs to handle. This // includes appending and applying entries or a snapshot, updating the HardState, // and sending messages. The returned Ready() *must* be handled and subsequently // passed back via Advance(). func (rn *RawNode) Ready() Ready { … } // readyWithoutAccept returns a Ready. This is a read-only operation, i.e. there // is no obligation that the Ready must be handled. func (rn *RawNode) readyWithoutAccept() Ready { … } // acceptReady is called when the consumer of the RawNode has decided to go // ahead and handle a Ready. Nothing must alter the state of the RawNode between // this call and the prior call to Ready(). func (rn *RawNode) acceptReady(rd Ready) { … } // HasReady called when RawNode user need to check if any Ready pending. // Checking logic in this method should be consistent with Ready.containsUpdates(). func (rn *RawNode) HasReady() bool { … } // Advance notifies the RawNode that the application has applied and saved progress in the // last Ready results. func (rn *RawNode) Advance(rd Ready) { … } // Status returns the current status of the given group. This allocates, see // BasicStatus and WithProgress for allocation-friendlier choices. func (rn *RawNode) Status() Status { … } // BasicStatus returns a BasicStatus. Notably this does not contain the // Progress map; see WithProgress for an allocation-free way to inspect it. func (rn *RawNode) BasicStatus() BasicStatus { … } type ProgressType … const ProgressTypePeer … const ProgressTypeLearner … // WithProgress is a helper to introspect the Progress for this node and its // peers. func (rn *RawNode) WithProgress(visitor func(id uint64, typ ProgressType, pr tracker.Progress)) { … } // ReportUnreachable reports the given node is not reachable for the last send. func (rn *RawNode) ReportUnreachable(id uint64) { … } // ReportSnapshot reports the status of the sent snapshot. func (rn *RawNode) ReportSnapshot(id uint64, status SnapshotStatus) { … } // TransferLeader tries to transfer leadership to the given transferee. func (rn *RawNode) TransferLeader(transferee uint64) { … } // ReadIndex requests a read state. The read state will be set in ready. // Read State has a read index. Once the application advances further than the read // index, any linearizable read requests issued before the read request can be // processed safely. The read state will have the same rctx attached. func (rn *RawNode) ReadIndex(rctx []byte) { … }