Documentation ¶
Index ¶
- Constants
- Variables
- func AppendLog(logEntry *LogEntry) error
- func BroadcastHeartBeat() error
- func Init(id int32, ge []string, ps PersistentStore)
- func IsLeader() bool
- func LeaderID() int32
- func LockHolderID() int32
- func PendingApplyLogExist() bool
- func StartRPCServer(port int)
- type LogEntry
- type PersistentStore
- type RaftServerImpl
- type Role
- type StateMachine
- type VolatileLeaderState
- type VolatileState
Constants ¶
Variables ¶
View Source
var ( DemotedToFollower error LogMismatch error )
Functions ¶
func BroadcastHeartBeat ¶
func BroadcastHeartBeat() error
func Init ¶
func Init(id int32, ge []string, ps PersistentStore)
func LockHolderID ¶
func LockHolderID() int32
func PendingApplyLogExist ¶
func PendingApplyLogExist() bool
func StartRPCServer ¶
func StartRPCServer(port int)
Types ¶
type PersistentStore ¶
type RaftServerImpl ¶
type RaftServerImpl struct {
sfrpc.UnimplementedRaftServer
}
func (*RaftServerImpl) AppendEntries ¶
func (rsi *RaftServerImpl) AppendEntries(ctx context.Context, req *sfrpc.AppendEntriesRequest) (*sfrpc.AppendEntriesReply, error)
func (*RaftServerImpl) RequestVote ¶
func (rsi *RaftServerImpl) RequestVote(ctx context.Context, req *sfrpc.RequestVoteRequest) (*sfrpc.RequestVoteReply, error)
type StateMachine ¶
type StateMachine struct {
LockHolderID int32
}
type VolatileLeaderState ¶
type VolatileLeaderState struct {
// contains filtered or unexported fields
}
type VolatileState ¶
type VolatileState struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.