Documentation ¶
Index ¶
- type Params
- type Server
- func (svr *Server) Addr() string
- func (svr *Server) Bootstrap(clusterUUID string)
- func (svr *Server) Configuration() *pb.Configuration
- func (svr *Server) ForceElection()
- func (svr *Server) Id() uint32
- func (svr *Server) IsLeader() bool
- func (svr *Server) OnGainLeadership(fn func(*Server))
- func (svr *Server) OnLonely(fn func(*Server))
- func (svr *Server) OnLoseLeadership(fn func(*Server))
- func (svr *Server) OnNotLonely(fn func(*Server))
- func (svr *Server) Start() error
- func (svr *Server) Stop() error
- func (svr *Server) String() string
- func (svr *Server) Tick()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Params ¶
type Params struct { Storage storage.Storage StateMachine storage.StateMachine SecretsManager rpc.SecretsManager PeerSecretNum uint32 ServerId uint32 ServerAddr string }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Raft represents a single participant in a Raft cluster.
func (*Server) Configuration ¶
func (svr *Server) Configuration() *pb.Configuration
Configuration returns the Server's active Configuration.
func (*Server) ForceElection ¶
func (svr *Server) ForceElection()
ForceElection forces a new leadership election, nominating this Server as the proposed leader.
func (*Server) IsLeader ¶
IsLeader returns true if this Server is *probably* the leader. (The information may be stale.)
func (*Server) OnGainLeadership ¶
OnGainLeadership sets the callback which, if non-nil, will be executed when this Server becomes the leader.
The previous leader may believe it is still the leader for up to 150 ticks.
func (*Server) OnLoseLeadership ¶
OnLoseLeadership sets the callback which, if non-nil, will be executed when this Server is no longer the leader.
func (*Server) OnNotLonely ¶
Click to show internal directories.
Click to hide internal directories.