goraft

package module
v0.0.0-...-77c9e9d Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

GoRaft

A Go implementation of the Raft algorithm.

Documentation

Index

Constants

View Source
const DebugRaft = true

Variables

This section is empty.

Functions

This section is empty.

Types

type AppendEntriesArgs

type AppendEntriesArgs struct {
}

type AppendEntriesReply

type AppendEntriesReply struct {
}

type Raft

type Raft struct {
	// contains filtered or unexported fields
}

func NewRaft

func NewRaft(id int, peerIds []int, server *Server, applyCh <-chan interface{}) *Raft

func (*Raft) AppendEntries

func (rf *Raft) AppendEntries(args AppendEntriesArgs, reply *AppendEntriesReply) error

func (*Raft) RequestVote

func (rf *Raft) RequestVote(args RequestVoteArgs, reply *RequestVoteReply) error

func (*Raft) Stop

func (rf *Raft) Stop()

type RequestVoteArgs

type RequestVoteArgs struct {
}

type RequestVoteReply

type RequestVoteReply struct {
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(serverId int, peerIds []int, applyCh <-chan interface{}) *Server

func (*Server) Call

func (s *Server) Call(id int, serviceMethod string, args interface{}, reply interface{}) error

func (*Server) ConnectToPeer

func (s *Server) ConnectToPeer(peerId int, addr net.Addr) error

func (*Server) DisconnectAll

func (s *Server) DisconnectAll()

func (*Server) DisconnectPeer

func (s *Server) DisconnectPeer(peerId int) error

func (*Server) GetListenAddr

func (s *Server) GetListenAddr() net.Addr

func (*Server) Serve

func (s *Server) Serve()

func (*Server) Shutdown

func (s *Server) Shutdown()

Jump to

Keyboard shortcuts

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