types

package
v0.0.0-...-7148df5 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(bn1 *BallotNumber, bn2 *BallotNumber) int

Compare two Ballot numbers lexicographically The result will be:

0 if bn1 == bn2,
-1 if bn1 < bn2, and
+1 if bn1 > bn2.

Types

type BallotNumber

type BallotNumber struct {
	// a monotonically increasing integer
	Round int

	// Represents a the leader identifier with this ballot number
	LeaderID v1.Addr
}

A BallotNumber in paxos has the property that it has can lexicographically ordered. s.t they can be totally ordered

func (BallotNumber) String

func (bn BallotNumber) String() string

type BasicCommand

type BasicCommand struct {
	// Client unique Id
	ClientID string

	// Unique command ID
	CommandID string

	// Operation associated with this command
	Op string
}

Indicates a unique Command issued by the client to a Replica For a unique <ClientID, CommandID> will always map to a unique Op.

func (BasicCommand) GetClientID

func (b BasicCommand) GetClientID() string

func (BasicCommand) GetCommandID

func (b BasicCommand) GetCommandID() string

func (BasicCommand) GetOp

func (b BasicCommand) GetOp() string

func (BasicCommand) String

func (b BasicCommand) String() string

type Command

type Command interface {
	// The client unique id
	GetClientID() string

	// The command unique id
	GetCommandID() string

	// Operation
	GetOp() string
}

type PValue

type PValue struct {
	// Ballot number associated
	BN BallotNumber

	// Slot for this PValue
	Slot Slot

	// Command for this PValue
	Command Command
}

func (PValue) String

func (pValue PValue) String() string

type PValues

type PValues map[PValue]bool

PValueSet

func (PValues) Contains

func (pvalues PValues) Contains(value PValue) bool

func (PValues) Set

func (pvalues PValues) Set(value PValue)

func (PValues) Update

func (pvalues PValues) Update(values PValues)

type ReConfigCommand

type ReConfigCommand struct {
	BasicCommand

	// New leader configuration
	NewLeaders []v1.Addr
}

A Reconfiguration Command issued

type Slot

type Slot int

Represents a slot which is assigned to a Command in Paxos

const InitialSlotID Slot = 1

The initial slot ID

type SlotCommandMap

type SlotCommandMap map[Slot]Command

func (SlotCommandMap) Assign

func (s SlotCommandMap) Assign(slot Slot, c Command)

func (SlotCommandMap) Contains

func (s SlotCommandMap) Contains(slot Slot) bool

func (SlotCommandMap) Get

func (s SlotCommandMap) Get(slot Slot) (Command, bool)

func (SlotCommandMap) Remove

func (s SlotCommandMap) Remove(slot Slot)

Jump to

Keyboard shortcuts

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