Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyAckCommand ¶
ApplyAckCommand applies a command to save ack a task to the Raft log.
func ApplySaveTaskCommand ¶
ApplySaveTaskCommand applies a command to save a task to the Raft log.
Types ¶
type LeaderHandle ¶
type LeaderHandle struct {
// contains filtered or unexported fields
}
func NewHandle ¶
func NewHandle(tracker *LeaderTracker, grpcPort int) (*LeaderHandle, error)
func (*LeaderHandle) AdminClient ¶
func (lh *LeaderHandle) AdminClient() (proto.AdminClient, error)
func (*LeaderHandle) IsLeader ¶
func (lh *LeaderHandle) IsLeader() bool
func (*LeaderHandle) LeaderAddress ¶
func (lh *LeaderHandle) LeaderAddress() string
func (*LeaderHandle) QueueClient ¶
func (lh *LeaderHandle) QueueClient() (proto.QueueClient, error)
type LeaderTracker ¶
type LeaderTracker struct {
// contains filtered or unexported fields
}
func NewTracker ¶
func NewTracker(raft *raft.Raft, selfServerID string) *LeaderTracker
func (*LeaderTracker) AddObserver ¶
func (lsc *LeaderTracker) AddObserver(handler leaderObserver)
AddObserver adds a handler to be called when leadership changes.
func (*LeaderTracker) IsLeader ¶
func (lsc *LeaderTracker) IsLeader() bool
func (*LeaderTracker) LeaderAddress ¶
func (lsc *LeaderTracker) LeaderAddress() string
type Peer ¶
Peer controls a node's membership in the raft cluster.
func NewPeer ¶
func NewPeer(config PeerConfig) (*Peer, error)
func (*Peer) Close ¶
Close stops the raft server and flushes writes to disk.
This method must be called before the application terminates.
func (*Peer) LoadHandle ¶ added in v0.2.0
func (p *Peer) LoadHandle(handle *LeaderHandle)
type PeerConfig ¶
type PeerConfig struct { ID string Port int AdvertiseAddr string DataDir string LogBatchSize int BootstrapCluster bool DB *storage.PebbleClient Tasks *storage.TaskStore Settings *storage.SettingStore Writer q.TaskWriter SQLPort int QueuePort int }
PeerConfig defines how a node will take part in the raft cluster.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.