Documentation ¶
Index ¶
- Variables
- type Node
- func (n *Node) AddToCluster(ctx context.Context, pid uint64) error
- func (n *Node) BatchAndSendMessages()
- func (n *Node) ConfState() *raftpb.ConfState
- func (n *Node) Connect(pid uint64, addr string)
- func (n *Node) InitFromWal(wal *raftwal.Wal) (idx uint64, restart bool, rerr error)
- func (n *Node) Peer(pid uint64) (string, bool)
- func (n *Node) Raft() raft.Node
- func (n *Node) SaveToStorage(s raftpb.Snapshot, h raftpb.HardState, es []raftpb.Entry)
- func (n *Node) Send(m raftpb.Message)
- func (n *Node) SetConfState(cs *raftpb.ConfState)
- func (n *Node) SetPeer(pid uint64, addr string)
- func (n *Node) SetRaft(r raft.Node)
- func (n *Node) WaitForMinProposal(ctx context.Context, read *protos.LinRead) error
- type Pool
- type Pools
- type RaftServer
- func (w *RaftServer) Echo(ctx context.Context, in *protos.Payload) (*protos.Payload, error)
- func (w *RaftServer) GetNode() *Node
- func (w *RaftServer) JoinCluster(ctx context.Context, rc *protos.RaftContext) (*protos.Payload, error)
- func (w *RaftServer) RaftMessage(ctx context.Context, query *protos.Payload) (*protos.Payload, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoConnection = fmt.Errorf("No connection exists") ErrUnhealthyConnection = fmt.Errorf("Unhealthy connection") )
var (
ErrDuplicateRaftId = x.Errorf("Node is already part of group")
)
Functions ¶
This section is empty.
Types ¶
type Node ¶ added in v0.8.3
type Node struct { x.SafeMutex // Fields which are never changed after init. Cfg *raft.Config MyAddr string Id uint64 RaftContext *protos.RaftContext Store *raft.MemoryStorage Wal *raftwal.Wal // applied is used to keep track of the applied RAFT proposals. // The stages are proposed -> committed (accepted by cluster) -> // applied (to PL) -> synced (to RocksDB). Applied x.WaterMark // contains filtered or unexported fields }
func NewNode ¶ added in v0.8.3
func NewNode(rc *protos.RaftContext) *Node
func (*Node) AddToCluster ¶ added in v0.8.3
func (*Node) BatchAndSendMessages ¶ added in v0.8.3
func (n *Node) BatchAndSendMessages()
func (*Node) ConfState ¶ added in v0.8.3
ConfState would return the latest ConfState stored in node.
func (*Node) Connect ¶ added in v0.8.3
Connects the node and makes its peerPool refer to the constructed pool and address (possibly updating ourselves from the old address.) (Unless pid is ourselves, in which case this does nothing.)
func (*Node) InitFromWal ¶ added in v0.8.3
func (*Node) SaveToStorage ¶ added in v0.8.3
func (*Node) SetConfState ¶ added in v0.8.3
SetConfState would store the latest ConfState generated by ApplyConfChange.
type Pool ¶
"Pool" is used to manage the grpc client connection(s) for communicating with other worker instances. Right now it just holds one of them.
func (*Pool) Get ¶
func (p *Pool) Get() *grpc.ClientConn
Get returns the connection to use from the pool of connections.
func (*Pool) MonitorHealth ¶ added in v0.8.3
func (p *Pool) MonitorHealth()
MonitorHealth monitors the health of the connection via Echo. This function blocks forever.
type RaftServer ¶ added in v0.8.3
type RaftServer struct { Node *Node // contains filtered or unexported fields }
func (*RaftServer) Echo ¶ added in v0.8.3
Hello rpc call is used to check connection with other workers after worker tcp server for this instance starts.
func (*RaftServer) GetNode ¶ added in v0.8.3
func (w *RaftServer) GetNode() *Node
func (*RaftServer) JoinCluster ¶ added in v0.8.3
func (w *RaftServer) JoinCluster(ctx context.Context, rc *protos.RaftContext) (*protos.Payload, error)