Documentation
¶
Index ¶
- Constants
- func CidFromNamespacedSha256(namespacedHash []byte) (cid.Cid, error)
- func DataSquareRowOrColumnRawInputParser(r io.Reader, _mhType uint64, _mhLen int) ([]ipld.Node, error)
- func GetNode(ctx context.Context, bGetter blockservice.BlockGetter, root cid.Cid) (ipld.Node, error)
- func MustCidFromNamespacedSha256(hash []byte) cid.Cid
- func NamespacedSha256FromCID(cid cid.Cid) []byte
- func NewNMTLeafNode(id cid.Cid, data []byte) ipld.Node
- func NewNMTNode(id cid.Cid, l, r []byte) ipld.Node
- func NewNamespaceHasher(hasher *nmt.Hasher) hash.Hash
- func RandNamespacedCID(t *testing.T) cid.Cid
Constants ¶
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 ¶
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 ¶
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 ¶
NamespacedSha256FromCID derives the Namespaced hash from the given CID.
Types ¶
This section is empty.