Documentation ¶
Index ¶
- func ApplyOnLeader(node *Node, payload []byte) (interface{}, error)
- func GetPeerDetails(address string) (*grpc.GetDetailsResponse, error)
- type ClientGrpcServices
- type Node
- func (n *Node) NotifyJoin(node *memberlist.Node)
- func (n *Node) NotifyLeave(node *memberlist.Node)
- func (n *Node) NotifyUpdate(_ *memberlist.Node)
- func (n *Node) RaftApply(request interface{}, timeout time.Duration) (interface{}, error)
- func (n *Node) Start() (chan interface{}, error)
- func (n *Node) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyOnLeader ¶
func GetPeerDetails ¶
func GetPeerDetails(address string) (*grpc.GetDetailsResponse, error)
Types ¶
type ClientGrpcServices ¶
type ClientGrpcServices struct { Node *Node rgrpc.UnimplementedRaftServer }
func NewClientGrpcService ¶
func NewClientGrpcService(node *Node) *ClientGrpcServices
func (*ClientGrpcServices) ApplyLog ¶
func (s *ClientGrpcServices) ApplyLog(ctx context.Context, request *rgrpc.ApplyRequest) (*rgrpc.ApplyResponse, error)
func (*ClientGrpcServices) GetDetails ¶
func (s *ClientGrpcServices) GetDetails(context.Context, *rgrpc.GetDetailsRequest) (*rgrpc.GetDetailsResponse, error)
type Node ¶
type Node struct { ID string RaftPort int DiscoveryPort int Raft *raft.Raft GrpcServer *ggrpc.Server DiscoveryMethod discovery.DiscoveryMethod TransportManager *transport.Manager Serializer serializer.Serializer // contains filtered or unexported fields }
func NewNode ¶
func NewNode(raftPort, discoveryPort int, dataDir string, services []fsm.FSMService, serializer serializer.Serializer, discoveryMethod discovery.DiscoveryMethod, snapshotEnabled bool) (*Node, error)
NewNode returns an EasyRaft node
func (*Node) NotifyJoin ¶
func (n *Node) NotifyJoin(node *memberlist.Node)
NotifyJoin triggered when a new Node has been joined to the cluster (discovery only) and capable of joining the Node to the raft cluster
func (*Node) NotifyLeave ¶
func (n *Node) NotifyLeave(node *memberlist.Node)
NotifyLeave triggered when a Node becomes unavailable after a period of time it will remove the unavailable Node from the Raft cluster
func (*Node) NotifyUpdate ¶
func (n *Node) NotifyUpdate(_ *memberlist.Node)
func (*Node) RaftApply ¶
RaftApply is used to apply any new logs to the raft cluster this method does automatic forwarding to Leader Node
Click to show internal directories.
Click to hide internal directories.