voting

package
v15.11.9 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// UnknownPhase is the default value. It should not be used.
	UnknownPhase = Phase(iota)
	// Prepared is the prepratory phase. The data that is about to change is locked for
	// concurrent modification, but changes have not yet been written to disk.
	Prepared
	// Committed is the committing phase. Data has been committed to disk and will be visible
	// in all subsequent requests.
	Committed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Phase

type Phase int

Phase is the transactional phase a given vote can be cast on.

func (Phase) ToProto

ToProto converts the phase into its Protobuf enum. This function panics if called with an invalid phase.

type Vote

type Vote [voteSize]byte

Vote is a vote cast by a node.

func VoteFromData

func VoteFromData(data []byte) Vote

VoteFromData hashes the given data and converts it to a vote.

func VoteFromHash

func VoteFromHash(bytes []byte) (Vote, error)

VoteFromHash converts the given byte slice containing a hash into a vote.

func VoteFromString

func VoteFromString(s string) (Vote, error)

VoteFromString converts the given string representation of the hash into a vote.

func (Vote) Bytes

func (v Vote) Bytes() []byte

Bytes returns a byte slice containing the hash.

func (Vote) String

func (v Vote) String() string

String returns the hex representation of the vote hash.

type VoteHash

type VoteHash struct {
	hash.Hash
}

VoteHash is the hash structure used to compute a Vote from arbitrary data.

func NewVoteHash

func NewVoteHash() VoteHash

NewVoteHash returns a new VoteHash.

func (VoteHash) Vote

func (v VoteHash) Vote() (Vote, error)

Vote hashes all data written into VoteHash and returns the resulting Vote.

Jump to

Keyboard shortcuts

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