namespace

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: Apache-2.0 Imports: 3 Imported by: 12

Documentation

Overview

Package namespace contains the core namespaced data types. PrefixedData represents the leaf data that gets pushed to the NMT (data prefixed with an ID).

Index

Constants

View Source
const IDMaxSize = math.MaxUint8

IDMaxSize defines the max. allowed namespace ID size in bytes.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID []byte

func (ID) Equal

func (nid ID) Equal(other ID) bool

Equal returns true if nid == other, otherwise, false.

func (ID) Less

func (nid ID) Less(other ID) bool

Less returns true if nid < other, otherwise, false.

func (ID) LessOrEqual

func (nid ID) LessOrEqual(other ID) bool

LessOrEqual returns true if nid <= other, otherwise, false.

func (ID) Size

func (nid ID) Size() IDSize

Size returns the byte size of the nid.

func (ID) String

func (nid ID) String() string

String returns the hexadecimal encoding of the nid. The output of nid.String() is not equivalent to string(nid).

type IDSize

type IDSize uint8

IDSize is the number of bytes a namespace uses. Valid values are in [0,255].

type PrefixedData

type PrefixedData []byte

PrefixedData simply represents a slice of bytes which consists of a namespace.ID and raw data. The user has to guarantee that the bytes are valid namespace prefixed data. Go's type system does not allow enforcing the structure we want: [namespaceID, rawData ...], especially as this type does not expect any particular size for the namespace.

Jump to

Keyboard shortcuts

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