Documentation ¶
Overview ¶
Package liveness provides a failure detecter (Fd), leader detector (Ld) and heartbeat emitter (HbEm).
The failure detector algorithm is based on the eventually perfect failure detector algorithm described in the Introduction to Reliable and Secure Distributed Programming textbook.
The leader detector algorithm builds on the failure detector algorithm and is based on the monarchical eventual leader detection algorithm also described in the aforementioned textbook.
The heartbeat emitter algorithm emits heartbeats to the other replicas in the system based on a periodic timeout generated by a Ticker.
Index ¶
- Constants
- type Fd
- type FdMsg
- type HbEm
- type Heartbeat
- type LeaderDetector
- type MockLD
- type MonarchicalLD
- func (mld *MonarchicalLD) PaxosLeader() grp.ID
- func (mld *MonarchicalLD) ReplacementLeader() grp.ID
- func (mld *MonarchicalLD) Start()
- func (mld *MonarchicalLD) Stop()
- func (mld *MonarchicalLD) SubscribeToPaxosLdMsgs(name string) <-chan grp.ID
- func (mld *MonarchicalLD) SubscribeToReplacementLdMsgs(name string) <-chan grp.ID
- type SuspectedRequest
Constants ¶
const ( Suspect fdEvent = false Restore fdEvent = true )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fd ¶
The state of the failure detector (Fd)
func NewFd ¶
func NewFd(id grp.ID, gm grp.GroupManager, cfg config.Config, heartbeatChan <-chan grp.ID, stopCheckIn *sync.WaitGroup) *Fd
Construct a new failure detector
func (*Fd) ResendCurrentSuspected ¶
func (fd *Fd) ResendCurrentSuspected()
Let the current replica know about all currently suspected replicas. Used by the Live Replacement module.
func (*Fd) Start ¶
func (fd *Fd) Start()
Start running the failure detector, spawn a goroutine to handle incoming and outgoing messages.
func (*Fd) SubscribeToFdMsgs ¶
If a module is interested in receiving Suspect and Restore events, this interest can be registered with this method. A name is needed to uniquely identify the subscription.
type FdMsg ¶
The type of message sent to other modules who are interested in receiving notifications about possible failures.
There are two types of events, as defined in the eventually perfect failure detector algorithm description: Suspect and Restore.
type HbEm ¶
type HbEm struct {
// contains filtered or unexported fields
}
State associated with the heartbeat emitter module.
func NewHbEm ¶
func NewHbEm(cfg config.Config, id grp.ID, rc <-chan bool, outB chan<- interface{}, stopCheckIn *sync.WaitGroup) *HbEm
Create a new heartbeat emitter (HbEm).
type Heartbeat ¶
A Heartbeat message is used by replicas to indicate they are alive in periods when no other messages are sent.
type LeaderDetector ¶
type MockLD ¶
type MockLD struct{}
func (*MockLD) PaxosLeader ¶
func (*MockLD) ReplacementLeader ¶
func (*MockLD) SubscribeToPaxosLdMsgs ¶
type MonarchicalLD ¶
type MonarchicalLD struct {
// contains filtered or unexported fields
}
The state of the leader detector (Ld)
func NewMonarchicalLD ¶
func NewMonarchicalLD(gm grp.GroupManager, fd *Fd, stopCheckIn *sync.WaitGroup) *MonarchicalLD
Construct a new leader detector.
func (*MonarchicalLD) PaxosLeader ¶
func (mld *MonarchicalLD) PaxosLeader() grp.ID
Get the id of the replica considered as the Paxos leader.
func (*MonarchicalLD) ReplacementLeader ¶
func (mld *MonarchicalLD) ReplacementLeader() grp.ID
Get the id of the replica considered as the replacement leader.
func (*MonarchicalLD) Start ¶
func (mld *MonarchicalLD) Start()
Initialize the leader detector and spawn a goroutine handling messages. The leader detector subscribes to messages from the failure detector.
func (*MonarchicalLD) SubscribeToPaxosLdMsgs ¶
func (mld *MonarchicalLD) SubscribeToPaxosLdMsgs(name string) <-chan grp.ID
Modules may register interest in receiving notifications when a new leader is elected. A name is needed to uniquely identify the module who is interested. This method returns a channel where information about newly elected leaders can be read from.
func (*MonarchicalLD) SubscribeToReplacementLdMsgs ¶
func (mld *MonarchicalLD) SubscribeToReplacementLdMsgs(name string) <-chan grp.ID
Modules may also register interest in receiving notifications when a new replacement leader is elected. This is used by the Live Replacement module.
type SuspectedRequest ¶
type SuspectedRequest struct {
// contains filtered or unexported fields
}