plugin

package
v0.3.1-dirty Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (

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

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

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

Variables

This section is empty.

Functions

func CidFromNamespacedSha256

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

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

func DataSquareRowOrColumnRawInputParser

func DataSquareRowOrColumnRawInputParser(r io.Reader, _mhType uint64, _mhLen int) ([]ipld.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>

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 GetNode added in v0.3.0

func GetNode(ctx context.Context, bGetter blockservice.BlockGetter, root cid.Cid) (ipld.Node, error)

func MustCidFromNamespacedSha256

func MustCidFromNamespacedSha256(hash []byte) cid.Cid

MustCidFromNamespacedSha256 is a wrapper around cidFromNamespacedSha256 that panics in case of an error. Use with care and only in places where no error should occur.

func NamespacedSha256FromCID

func NamespacedSha256FromCID(cid cid.Cid) []byte

NamespacedSha256FromCID derives the Namespaced hash from the given CID.

func NewNMTLeafNode

func NewNMTLeafNode(id cid.Cid, data []byte) ipld.Node

func NewNMTNode

func NewNMTNode(id cid.Cid, l, r []byte) ipld.Node

func NewNamespaceHasher

func NewNamespaceHasher(hasher *nmt.Hasher) hash.Hash

func RandNamespacedCID added in v0.3.0

func RandNamespacedCID(t *testing.T) cid.Cid

Types

This section is empty.

Jump to

Keyboard shortcuts

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