types

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const Separator = "/"

Variables

This section is empty.

Functions

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 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.

Types

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.

Jump to

Keyboard shortcuts

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