go_raft_grpc

package module
v0.0.0-...-1c1f771 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2023 License: MIT Imports: 9 Imported by: 0

README

go-raft-grpc

go-raft-grpc is based on go-raft[https://github.com/goraft/raft/], using grpc other than http as the transporter, nothing else changed.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RaftServer

type RaftServer struct {
	protobuf.UnimplementedRaftServerServer
	// contains filtered or unexported fields
}

func NewRaftServer

func NewRaftServer(peers []string, httpAddr string, dataDir string, pulseSeconds int) *RaftServer

func StartRaftServer

func StartRaftServer(ip, peerIps, port, dataDir string) *RaftServer

StartRaftServer start a raft server

func (*RaftServer) DeathNotify

func (s *RaftServer) DeathNotify()

DeathNotify If a node is about to die, notify other nodes to elect a new leader as soon as possible before the node dies

func (*RaftServer) IsLeader

func (s *RaftServer) IsLeader() bool

IsLeader i am the leader?

func (*RaftServer) Join

func (s *RaftServer) Join(peers []string) error

Join joins an existing cluster.

func (*RaftServer) Leader

func (s *RaftServer) Leader() string

Leader cluster leader

func (*RaftServer) Nodes

func (s *RaftServer) Nodes() (members []string)

Nodes all nodes

func (*RaftServer) Peers

func (s *RaftServer) Peers() (members []string)

Peers my partner nodes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL