Documentation ¶
Index ¶
- Constants
- Variables
- type LeadershipState
- type Node
- func (n *Node) IsIDRemoved(id uint64) bool
- func (n *Node) IsLeader() bool
- func (n *Node) IsMember() bool
- func (n *Node) Leader() (uint64, error)
- func (n *Node) LoadSnapshot()
- func (n *Node) Process(ctx context.Context, m raftpb.Message) error
- func (n *Node) ProposeValue(ctx context.Context, storeAction []*ztypes.StoreAction, cb func()) error
- func (n *Node) ReportSnapshot(id uint64, status raft.SnapshotStatus)
- func (n *Node) ReportUnreachable(id uint64)
- func (n *Node) Run(ctx context.Context) error
- func (n *Node) StartRaft(ctx context.Context) error
- func (n *Node) Status() raft.Status
- func (n *Node) SubscribeLeaderShip() (q chan events.Event, cancel func())
- func (n *Node) WaitForLeader(ctx context.Context) error
- func (n *Node) WithContext(ctx context.Context) (context.Context, context.CancelFunc)
Constants ¶
View Source
const (
MaxTransactionBytes = 1.5 * 1024 * 1024
)
Variables ¶
View Source
var ( // returns when an operation was submitted but the node was stopped in the meantime ErrStopped = errors.New("raft: failed to process the request: node is stopped") // returns when an operation was submitted but the node lost leader status before it became committed ErrLostLeadership = errors.New("raft: failed to process the request: node lots leader status") // retuns when a raft internal message is too large to be sent ErrRequestTooLarge = errors.New("raft: raft messahe is too large and can't be send") // returns when the node is not yet part of a raft cluster ErrNoRaftMember = errors.New("raft: node is not yet part of a raft cluster") // returns when the cluster has no elected leader ErrNoClusterLeader = errors.New("raft: no elected cluster leader") )
Functions ¶
This section is empty.
Types ¶
type LeadershipState ¶
type LeadershipState int
const ( // IsLeader indicates that the node is a raft leader IsLeader LeadershipState = iota // IsFollower indicates that the node is a raft follower IsFollower )
type Node ¶
func (*Node) IsIDRemoved ¶
func (*Node) LoadSnapshot ¶
func (n *Node) LoadSnapshot()
func (*Node) ProposeValue ¶
func (*Node) ReportSnapshot ¶
func (n *Node) ReportSnapshot(id uint64, status raft.SnapshotStatus)
func (*Node) ReportUnreachable ¶
func (*Node) Run ¶
Run is the main loop for a Raft node it goes along the state machine action on the messages received from other Raft nodes in the cluster. TODO (upccup) Before running the main loop it first starts the raft node based on saved cluster sate. If no saved sater exists. it starts a single-node cluster
func (*Node) SubscribeLeaderShip ¶
func (*Node) WithContext ¶
Click to show internal directories.
Click to hide internal directories.