nodes

package
v0.0.0-...-874df76 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Nmt is the codec used for leaf and inner nodes of an Namespaced Merkle Tree.
	Nmt = 0x7700

	// NmtCodecName is the name used during registry of the Nmt codec
	NmtCodecName = "nmt-node"

	// Sha256Namespace8Flagged is the multihash code used to hash blocks
	// that contain an NMT node (inner and leaf nodes).
	Sha256Namespace8Flagged = 0x7701

	// DagParserFormatName can be used when putting into the IPLD Dag
	DagParserFormatName = "extended-square-row-or-col"
)

Variables

Functions

func CidFromNamespacedSha256

func CidFromNamespacedSha256(namespacedHash []byte) (cid.Cid, error)

CidFromNamespacedSha256 uses a hash from an nmt tree to create a cide

func DataSquareRowOrColumnRawInputParser

func DataSquareRowOrColumnRawInputParser(r io.Reader, _mhType uint64, _mhLen int) ([]node.Node, error)

DataSquareRowOrColumnRawInputParser reads the raw shares and extract the IPLD nodes from the NMT tree. Note, to parse without any error the input has to be of the form:

<share_0>| ... |<share_numOfShares - 1>

To determine the share and the namespace size the constants types.ShareSize and types.NamespaceSize are redefined here to avoid lazyledger-core as a dependency.

Note while this coredag.DagParser is implemented here so this plugin can be used from the commandline, the ipld Nodes will rather be created together with the NMT root instead of re-computing it here.

func NmtNodeParser

func NmtNodeParser(block blocks.Block) (node.Node, error)

Types

type LazyLedgerPlugin

type LazyLedgerPlugin struct{}

func (LazyLedgerPlugin) Init

func (LazyLedgerPlugin) Name

func (l LazyLedgerPlugin) Name() string

func (LazyLedgerPlugin) RegisterBlockDecoders

func (l LazyLedgerPlugin) RegisterBlockDecoders(dec format.BlockDecoder) error

func (LazyLedgerPlugin) RegisterInputEncParsers

func (l LazyLedgerPlugin) RegisterInputEncParsers(iec coredag.InputEncParsers) error

func (LazyLedgerPlugin) Version

func (l LazyLedgerPlugin) Version() string

type NmtNodeAdder

type NmtNodeAdder struct {
	// contains filtered or unexported fields
}

NmtNodeAdder adds ipld.Nodes to the underlying ipld.Batch if it is inserted into an nmt tree

func NewNmtNodeAdder

func NewNmtNodeAdder(ctx context.Context, batch *format.Batch) *NmtNodeAdder

NewNmtNodeAdder returns a new NmtNodeAdder with the provided context and batch. Note that the context provided should have a timeout

func (*NmtNodeAdder) Batch

func (n *NmtNodeAdder) Batch() *format.Batch

Batch return the ipld.Batch originally provided to the NmtNodeAdder

func (*NmtNodeAdder) Visit

func (n *NmtNodeAdder) Visit(hash []byte, children ...[]byte)

Visit can be inserted into an nmt tree to create ipld.Nodes while computing the root

Jump to

Keyboard shortcuts

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