Documentation ¶
Overview ¶
Package proposal exposes the Proposal type and some of its methods.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Proposal ¶
type Proposal struct { Pid int `json:"pid"` // Pid is the (supposedly) unique identifier of the node. 0 is null pid Seq int `json:"seq"` // Seq is the sequence number. 0 is null sequence number V string `json:"v"` // V is the value being proposed. "" is null value }
Proposal implements a simple class representing proposals for the paxos algorithm. A proposal has a number (n) and a value (v). Proposal numbers are supposed to unique and orderable. To achieve so we can represent the number n by using a tuple composed by the sequence number and the PID, hence n = (pid, seq). If two proposals have the same sequence number we can use the PID to break ties, since they are unique by definition. Two identical proposals can only exist if they refer to different turn ids.
func (*Proposal) IsGreaterThan ¶
IsGreaterThan overrides the ">" operator for Proposal objects.
func (*Proposal) IsLowerThan ¶
IsLowerThan overrides the "<" operator for Proposal objects.