namespace

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: Apache-2.0 Imports: 2 Imported by: 15

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

func (ID) Less

func (nid ID) Less(other ID) bool

func (ID) LessOrEqual

func (nid ID) LessOrEqual(other ID) bool

func (ID) Size

func (nid ID) Size() IDSize

func (ID) String

func (nid ID) String() string

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.

type PrefixedData8

type PrefixedData8 []byte

PrefixedData8 like PrefixedData is just a slice of bytes. It assumes that the slice it represents is at least 8 bytes. This assumption is not enforced by the type system though.

func (PrefixedData8) Data

func (d PrefixedData8) Data() []byte

func (PrefixedData8) NamespaceID

func (d PrefixedData8) NamespaceID() ID

Jump to

Keyboard shortcuts

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