raft

package
v0.0.0-...-5e3b6f7 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PeerSetConfigurationPath = "/raft/setconfiguration"
	PeerAppendEntriesPath    = "/raft/appendentries"
	PeerIDPath               = "/raft/id"
	PeerCommandPath          = "/raft/command"
	PeerRequestVotePath      = "/raft/requestvote"
)

Variables

View Source
var (
	MinimumElectionTimeoutMS int32 = 250
)

Functions

func SetupServeMux

func SetupServeMux(mux *http.ServeMux, s *Server)

Types

type ApplyFunc

type ApplyFunc func(commitIndex uint64, cmd []byte) []byte

type HTTPPeer

type HTTPPeer struct {
	RemoteID uint64
	URL      *url.URL
}

type Peer

type Peer interface {
	// contains filtered or unexported methods
}

type Server

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

func NewServer

func NewServer(id uint64, store io.ReadWriter, a ApplyFunc) *Server

func (*Server) Command

func (s *Server) Command(cmd []byte, response chan<- []byte) error

func (*Server) SetConfiguration

func (s *Server) SetConfiguration(peers ...Peer) error

func (*Server) Start

func (s *Server) Start()

func (*Server) Stop

func (s *Server) Stop()

Jump to

Keyboard shortcuts

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