view

package
v0.0.0-...-bccea44 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// A buffered channel to signal the monitor thread to change to view change mode.
	// Note: we use a buffered channel here because multiple threads running StartViewChange() could be
	// sending signals to the channel at the same time, but the monitor thread can only consume one of them.
	// Having a buffered channel ensures that while only the first signal is consumed, the rest of the threads do not block.
	StartViewChangeChan chan int = make(chan int, len(globals.AllPorts))

	// A channel to notify the monitor that view change is done and what mode should the replica switch to.
	ViewChangeDone chan string = make(chan string)
)

Functions

func ClearViewChangeStates

func ClearViewChangeStates(clearProposedView bool)

ClearViewChangeStates clears the intermediate states of the current view change. This function is atomic and thread-safe.

func InitiateStartViewChange

func InitiateStartViewChange()

InitiateStartViewChange initiates a view change protocol by sending StartViewChange messages to all other replicas.

func SendStartViewChange

func SendStartViewChange(port, viewNum, id int)

SendStartViewChange sends a StartViewChange message with a proposed viewNum and the current node id to a replica at port.

Types

type ViewChangeRPC

type ViewChangeRPC int

ViewChangeRPC implements the ViewService interface.

func (*ViewChangeRPC) DoViewChange

func (v *ViewChangeRPC) DoViewChange(args *vrrpc.DoViewChangeArgs, resp *vrrpc.DoViewChangeResp) error

DoViewChange handles the DoViewChange RPC. This function is triggered when the new primary receives a DoViewChange message. It only starts a new view when enough DoViewChange messages are received. It is thread-safe so multiple nodes can send DoViewChange messages to the new primary concurrently.

func (*ViewChangeRPC) StartView

func (v *ViewChangeRPC) StartView(args *vrrpc.StartViewArgs, resp *vrrpc.StartViewResp) error

StartView handles the StartView RPC.

func (*ViewChangeRPC) StartViewChange

func (v *ViewChangeRPC) StartViewChange(args *vrrpc.StartViewChangeArgs, resp *vrrpc.StartViewChangeResp) error

StartViewChange handles the StartViewChange RPC. This function is triggered whenever the node receives a StartViewChange message. When triggered, the node will stop what it is doing right now and start the view change protocol. It implements step 1 and 2 in section 4.2 in the paper. This function is thread-safe, so multiple nodes can call this RPC on the same node concurrently.

Jump to

Keyboard shortcuts

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