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) DeletePeer(pid uint64)
- func (n *Node) DoneConfChange(id uint64, err error)
- func (n *Node) InitFromWal(wal *raftwal.Wal) (idx uint64, restart bool, rerr error)
- func (n *Node) Peer(pid uint64) (string, bool)
- func (n *Node) ProposePeerRemoval(ctx context.Context, id uint64) error
- func (n *Node) Raft() raft.Node
- func (n *Node) SaveSnapshot(s raftpb.Snapshot)
- func (n *Node) SaveToStorage(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 *api.LinRead) error
- type Pool
- type Pools
- type RaftServer
- func (w *RaftServer) Echo(ctx context.Context, in *api.Payload) (*api.Payload, error)
- func (w *RaftServer) GetNode() *Node
- func (w *RaftServer) JoinCluster(ctx context.Context, rc *intern.RaftContext) (*api.Payload, error)
- func (w *RaftServer) RaftMessage(ctx context.Context, query *api.Payload) (*api.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 *intern.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 BadgerDB). Applied x.WaterMark // contains filtered or unexported fields }
func NewNode ¶ added in v0.8.3
func NewNode(rc *intern.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) DeletePeer ¶ added in v0.9.2
func (*Node) DoneConfChange ¶ added in v0.9.3
func (*Node) InitFromWal ¶ added in v0.8.3
func (*Node) ProposePeerRemoval ¶ added in v0.9.2
func (*Node) SaveSnapshot ¶ added in v1.0.2
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.
func (*Pool) UpdateHealthStatus ¶ added in v0.9.3
func (p *Pool) UpdateHealthStatus()
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 *intern.RaftContext) (*api.Payload, error)