Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MinimumElectionTimeoutMS int32 = 250 MaximumElectionTimeoutMS = 2 * MinimumElectionTimeoutMS )
论文里写的好象是 150ms ~ 300ms
View Source
var ( // IDPath is where the ID handler (GET) will be installed by the // HTTPTransport. IDPath = "/raft/id" // AppendEntriesPath is where the AppendEntries RPC handler (POST) will be // installed by the HTTPTransport. AppendEntriesPath = "/raft/appendentries" // RequestVotePath is where the requestVote RPC handler (POST) will be // installed by the HTTPTransport. RequestVotePath = "/raft/requestvote" // CommandPath is where the Command RPC handler (POST) will be installed by // the HTTPTransport. CommandPath = "/raft/command" // SetConfigurationPath is where the SetConfiguration RPC handler (POST) // will be installed by the HTTPTransport. SetConfigurationPath = "/raft/setconfiguration" )
Functions ¶
func HTTPTransport ¶
HTTPTransport creates an ingress bridge from the outside world to the passed server, by installing handlers for all the necessary RPCs to the passed mux.
func MaximumElectionTimeout ¶
Types ¶
type Peer ¶
type Peer interface {
// contains filtered or unexported methods
}
Peer is the local representation of a remote node. It's an interface that may be backed by any concrete transport: local, HTTP, net/rpc, etc. Peers must be encoding/gob encodable.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the agent that perform all raft logic
func (*Server) SetConfiguration ¶
Click to show internal directories.
Click to hide internal directories.