consensus

package
v0.0.0-...-1a21ecf Latest Latest
Warning

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

Go to latest
Published: May 8, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package consensus implements a simplified version of Paxos consensus protocol.

Index

Constants

View Source
const CHANNEL_DEFAULT_BUFFER_SIZE = 20

Variables

This section is empty.

Functions

func GetConsensusResultChan

func GetConsensusResultChan(associatedView *view.View) chan interface{}

func Propose

func Propose(associatedView *view.View, thisProcess view.Process, defaultValue interface{})

Propose proposes the value to be agreed upon on this consensus instance. It should be run only by the leader process to guarantee termination.

Types

type Accept

type Accept struct {
	*Proposal
	// contains filtered or unexported fields
}

type ConsensusRequest

type ConsensusRequest int

-------- REQUESTS -----------

func (*ConsensusRequest) Accept

func (r *ConsensusRequest) Accept(arg Proposal, reply *Proposal) error

Accept Request

func (*ConsensusRequest) Learn

func (r *ConsensusRequest) Learn(arg Proposal, reply *struct{}) error

Learn Request

func (*ConsensusRequest) Prepare

func (r *ConsensusRequest) Prepare(arg Proposal, reply *Proposal) error

Prepare Request

type Learn

type Learn struct {
	*Proposal
}

type OldProposalNumberError

type OldProposalNumberError struct{}

------- ERRORS -----------

func (OldProposalNumberError) Error

func (e OldProposalNumberError) Error() string

type Prepare

type Prepare struct {
	*Proposal
	// contains filtered or unexported fields
}

type Proposal

type Proposal struct {
	AssociatedView *view.View

	N int // N is the proposal number

	Value interface{} // Value proposed

	Err error // Err is used to return an error related to the proposal
}

Jump to

Keyboard shortcuts

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