Documentation ¶
Index ¶
- Constants
- Variables
- func CidFromNamespacedSha256(namespacedHash []byte) (cid.Cid, error)
- func DataSquareRowOrColumnRawInputParser(r io.Reader, _mhType uint64, _mhLen int) ([]node.Node, error)
- func NmtNodeParser(block blocks.Block) (node.Node, error)
- type LazyLedgerPlugin
- func (l LazyLedgerPlugin) Init(env *plugin.Environment) error
- func (l LazyLedgerPlugin) Name() string
- func (l LazyLedgerPlugin) RegisterBlockDecoders(dec format.BlockDecoder) error
- func (l LazyLedgerPlugin) RegisterInputEncParsers(iec coredag.InputEncParsers) error
- func (l LazyLedgerPlugin) Version() string
- type NmtNodeAdder
Constants ¶
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 ¶
var Plugins = []plugin.Plugin{&LazyLedgerPlugin{}}
Functions ¶
func CidFromNamespacedSha256 ¶
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.
Types ¶
type LazyLedgerPlugin ¶
type LazyLedgerPlugin struct{}
func (LazyLedgerPlugin) Init ¶
func (l LazyLedgerPlugin) Init(env *plugin.Environment) error
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