mdutils

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bserv

func Bserv() bsrv.BlockService

Bserv returns a new, thread-safe, mock BlockService.

func Mock

func Mock() ipld.DAGService

Mock returns a new thread-safe, mock DAGService.

Types

type DAGGenerator

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

DAGGenerator generates BasicBlocks on demand. For each instance of DAGGenerator, each new DAG is different from the previous, although two different instances will produce the same, given the same parameters.

func NewDAGGenerator

func NewDAGGenerator() *DAGGenerator

NewDAGGenerator returns an object capable of producing IPLD DAGs.

func (*DAGGenerator) MakeDagBlock

func (dg *DAGGenerator) MakeDagBlock(adder func(ctx context.Context, block blocks.Block) error, fanout uint, depth uint) (c cid.Cid, allCids []cid.Cid, err error)

MakeDagBlock generate a balanced DAG with the given fanout and depth, and add the blocks to the adder. This adder can be for example a blockstore.Put or a blockservice.AddBlock.

func (*DAGGenerator) MakeDagNode

func (dg *DAGGenerator) MakeDagNode(adder func(ctx context.Context, node format.Node) error, fanout uint, depth uint) (c cid.Cid, allCids []cid.Cid, err error)

MakeDagNode generate a balanced DAG with the given fanout and depth, and add the blocks to the adder. This adder can be for example a DAGService.Add.

Jump to

Keyboard shortcuts

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