types

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Separator = "/"

Variables

This section is empty.

Functions

func BatchIDSlicePb

func BatchIDSlicePb(ids []BatchID) [][]byte

BatchIDSlicePb converts a slice of BatchIDs to a slice of the native type underlying BatchID. This is required for serialization using Protocol Buffers.

func ClientWMsPb

func ClientWMsPb(wms map[ClientID]ClientWM) map[string]uint64

func ErrorFromPb

func ErrorFromPb(ok bool, errStr string) error

func ErrorPb

func ErrorPb(err error) (ok bool, errStr string)

ErrorPb converts a error to its representation in protocol buffers.

func Membership

func Membership(membershipPb *commonpb.Membership) map[NodeID]NodeAddress

func MembershipPb

func MembershipPb(membership map[NodeID]NodeAddress) *commonpb.Membership

func MembershipSlice

func MembershipSlice(membershipsPb []*commonpb.Membership) []map[NodeID]NodeAddress

func NodeIDSlicePb

func NodeIDSlicePb(nids []NodeID) []string

NodeIDSlicePb converts a slice of NodeIDs to a slice of the native type underlying NodeID. This is required for serialization using Protocol Buffers.

func SeqNrSlicePb

func SeqNrSlicePb(sns []SeqNr) []uint64

SeqNrSlicePb converts a slice of SeqNrs to a slice of the native type underlying SeqNr. This is required for serialization using Protocol Buffers.

func TxIDSlicePb

func TxIDSlicePb(ids []TxID) [][]byte

TxIDSlicePb converts a slice of TxIDs to a slice of the native type underlying TxID. This is required for serialization using Protocol Buffers.

Types

type BatchID

type BatchID string

BatchID is a unique identifier of a batch.

func BatchIDSlice

func BatchIDSlice(ids [][]byte) []BatchID

BatchIDSlice converts a slice of BatchIDs represented directly as their underlying native type to a slice of abstractly typed batch IDs.

func (BatchID) Bytes

func (id BatchID) Bytes() []byte

Bytes serializes the object to a sequence of bytes.

func (BatchID) Pb

func (id BatchID) Pb() []byte

Pb converts a BatchID to its underlying native type.

type ClientID

type ClientID string

ClientID represents the ID of a client.

func NewClientIDFromInt

func NewClientIDFromInt(id int) ClientID

func (ClientID) Bytes

func (cid ClientID) Bytes() []byte

func (ClientID) Pb

func (cid ClientID) Pb() string

Pb converts a ClientID to its underlying native type.

type ClientWM

type ClientWM uint64

ClientWM represents the client request watermark.

func (ClientWM) Pb

func (cwm ClientWM) Pb() uint64

Pb converts a ClientWN to its underlying native type.

type EpochNr

type EpochNr uint64

EpochNr represents the number of an epoch.

func (EpochNr) Bytes

func (e EpochNr) Bytes() []byte

func (EpochNr) Pb

func (e EpochNr) Pb() uint64

Pb converts an EpochNr number to its underlying native type.

type ModuleID

type ModuleID string

ModuleID represents an identifier of a module. The intention is for it to correspond to a path in the module hierarchy. However, technically, the Mir Node only cares for the ID's prefix up to the first separator and ignores the rest. The rest of the ID can be used for any module-specific purposes.

func (ModuleID) Pb

func (mid ModuleID) Pb() string

Pb converts a ModuleID to a type used in a Protobuf message.

func (ModuleID) Sub

func (mid ModuleID) Sub() ModuleID

Sub returns the identifier of a submodule within the top-level module, stripped of the top-level module identifier.

func (ModuleID) Then

func (mid ModuleID) Then(submodule ModuleID) ModuleID

Then combines the module ID with a relative path to its submodule in a single module ID.

func (ModuleID) Top

func (mid ModuleID) Top() ModuleID

Top returns the ID of the top-level module of the path, stripped of the IDs of the submodules.

type NodeAddress

type NodeAddress multiaddr.Multiaddr

NodeAddress represents the address of a node.

type NodeID

type NodeID string

NodeID represents the ID of a node.

func NewNodeIDFromInt

func NewNodeIDFromInt(id int) NodeID

func NodeIDSlice

func NodeIDSlice(nids []string) []NodeID

NodeIDSlice converts a slice of NodeIDs represented directly as their underlying native type to a slice of abstractly typed node IDs.

func (NodeID) Bytes

func (id NodeID) Bytes() []byte

Bytes returns the byte slice representation of the node ID.

func (NodeID) Pb

func (id NodeID) Pb() string

Pb converts a NodeID to its underlying native type.

type NumRequests

type NumRequests uint64

NumRequests represents the number of requests (e.g. pending in some buffer)

func (NumRequests) Bytes

func (nr NumRequests) Bytes() []byte

func (NumRequests) Pb

func (nr NumRequests) Pb() uint64

Pb converts an EpochNr number to its underlying native type.

type PBFTViewNr

type PBFTViewNr uint64

PBFTViewNr represents the view number in the PBFT protocol (used as a sub-protocol of ISS)

func (PBFTViewNr) Bytes

func (v PBFTViewNr) Bytes() []byte

Bytes converts a PBFTViewNr to a slice of bytes (useful for serialization).

func (PBFTViewNr) Pb

func (v PBFTViewNr) Pb() uint64

Pb converts a PBFTViewNr to its underlying native type

type ReqNo

type ReqNo uint64

ReqNo represents a request number a client assigns to its requests.

func (ReqNo) Bytes

func (rn ReqNo) Bytes() []byte

Bytes converts a ReqNo to a slice of bytes (useful for serialization).

func (ReqNo) Pb

func (rn ReqNo) Pb() uint64

Pb converts a ReqNo to its underlying native type.

type RetentionIndex

type RetentionIndex uint64

RetentionIndex represents an abstract notion of system progress used in garbage collection. The basic idea is to associate various parts of the system (parts of the state, even whole modules) that are subject to eventual garbage collection with a retention index. As the system progresses, the retention index monotonically increases and parts of the system associated with a lower retention index can be garbage-collected.

func (RetentionIndex) Bytes

func (ri RetentionIndex) Bytes() []byte

Bytes converts a RetentionIndex to a slice of bytes (useful for serialization).

func (RetentionIndex) Pb

func (ri RetentionIndex) Pb() uint64

Pb converts a RetentionIndex to its underlying native type.

type SBInstanceNr

type SBInstanceNr uint64

SBInstanceNr identifies the instance of Sequenced Broadcast (SB) within an epoch.

func (SBInstanceNr) Bytes

func (i SBInstanceNr) Bytes() []byte

func (SBInstanceNr) Pb

func (i SBInstanceNr) Pb() uint64

Pb converts a SBInstanceNr to its underlying native type.

type SeqNr

type SeqNr uint64

SeqNr represents the sequence number of a batch as assigned by the ordering protocol.

func SeqNrSlice

func SeqNrSlice(sns []uint64) []SeqNr

SeqNrSlice converts a slice of SeqNrs represented directly as their underlying native type to a slice of abstractly typed sequence numbers.

func (SeqNr) Bytes

func (sn SeqNr) Bytes() []byte

Bytes converts a SeqNr to a slice of bytes (useful for serialization).

func (SeqNr) Pb

func (sn SeqNr) Pb() uint64

Pb converts a SeqNr to its underlying native type.

type TimeDuration

type TimeDuration time.Duration

TimeDuration represents an interval of real time

func (TimeDuration) Bytes

func (td TimeDuration) Bytes() []byte

func (TimeDuration) Pb

func (td TimeDuration) Pb() uint64

Pb converts a TimeDuration to a type used in a Protobuf message.

type TxID

type TxID string

TxID is a unique identifier of a transaction.

func TxIDSlice

func TxIDSlice(ids [][]byte) []TxID

TxIDSlice converts a slice of TxIDs represented directly as their underlying native type to a slice of abstractly typed transaction IDs.

func (TxID) Bytes

func (id TxID) Bytes() []byte

Bytes serializes the object to a sequence of bytes.

func (TxID) Pb

func (id TxID) Pb() []byte

Pb converts a TxID to its underlying native type.

Jump to

Keyboard shortcuts

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