proposal

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2019 License: MIT Imports: 0 Imported by: 0

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) IsEqualTo

func (p *Proposal) IsEqualTo(other *Proposal) bool

IsEqualTo overrides the "==" operator for Proposal objects.

func (*Proposal) IsGEThan

func (p *Proposal) IsGEThan(other *Proposal) bool

IsGEThan overrides the ">=" operator for Proposal objects.

func (*Proposal) IsGreaterThan

func (p *Proposal) IsGreaterThan(other *Proposal) bool

IsGreaterThan overrides the ">" operator for Proposal objects.

func (*Proposal) IsLEThan

func (p *Proposal) IsLEThan(other *Proposal) bool

IsLEThan overrides the "<=" operator for Proposal object.

func (*Proposal) IsLowerThan

func (p *Proposal) IsLowerThan(other *Proposal) bool

IsLowerThan overrides the "<" operator for Proposal objects.

Jump to

Keyboard shortcuts

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