paxos

package
v0.0.0-...-17369de Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCompacted = errors.New("entry compacted")

ErrCompacted is the error returned to indicate that the requested entries are no longer in the LogDB due to compaction.

View Source
var ErrUnavailable = errors.New("entry unavailable")

ErrUnavailable is the error returned to indicate that requested entries are not available in LogDB.

Functions

func IsLocalMessageType

func IsLocalMessageType(t paxospb.MessageType) bool

IsLocalMessageType returns a boolean value indicating whether the specified message type is a local message type.

Types

type IInstance

type IInstance interface {
	// contains filtered or unexported methods
}

IInstance ...

type ILogDB

type ILogDB interface {
	// GetRange returns the range of the entries in LogDB.
	GetRange() (uint64, uint64)

	// SetRange updates the ILogDB to extend the entry range known to the ILogDB.s
	SetRange(index uint64, length uint64)

	// NodeState returns the state of the node persistented in LogDB.
	NodeState() paxospb.State

	SetState(ps paxospb.State)

	Entries(low uint64, high uint64) ([]paxospb.Entry, error)

	// Append makes the given entries known to the ILogDB instance. This is
	// usually not how entries are persisted.
	Append(entries []paxospb.Entry) error
	Compact(instanceID uint64) error
}

ILogDB is a read-only interface to the underlying persistent storage to allow the paxos package to access paxos state, entries, snapshots stored in the persistent storage. Entries stored in the persistent storage accessible via ILogDB is usually not required in normal cases.

type Peer

type Peer struct {
	// contains filtered or unexported fields
}

Peer is the interface struct for interacting with the underlying Paxos protocol implementation.

func LaunchPeer

func LaunchPeer(config *config.Config, logdb ILogDB,
	addresses []PeerAddress, initial bool, newNode bool) (*Peer, error)

LaunchPeer starts or restarts a Paxos node.

func (*Peer) Commit

func (p *Peer) Commit(ud paxospb.Update)

Commit commits the Update state to mark it as processed.

func (*Peer) GetUpdate

func (p *Peer) GetUpdate(moreEntriesToApply bool) paxospb.Update

GetUpdate returns the current state of the Peer.

func (*Peer) Handle

func (p *Peer) Handle(msg paxospb.PaxosMsg)

Handle ...

func (*Peer) HasUpdate

func (p *Peer) HasUpdate(moreEntriesToApply bool) bool

HasUpdate returns a boolean value indicating whether there is any Update ready to be processed.

func (*Peer) NotifyPaxosLastApplied

func (p *Peer) NotifyPaxosLastApplied(lastApplied uint64)

NotifyPaxosLastApplied ...

func (*Peer) Propose

func (p *Peer) Propose(key uint64, value []byte)

Propose ... where we need to a new instance

func (*Peer) Tick

func (p *Peer) Tick()

Tick moves the logical clock forward by one tick.

type PeerAddress

type PeerAddress struct {
	NodeID  uint64
	Address string
}

PeerAddress is the basic info for a peer in the paxos group.

Jump to

Keyboard shortcuts

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