testu

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestRsDefaultNumData   = 10
	TestRsDefaultNumParity = 20
)

Variables

View Source
var (
	UseProtoBufLeaves = NodeOpts{Prefix: mdag.V0CidPrefix()}
	UseRawLeaves      = NodeOpts{Prefix: mdag.V0CidPrefix(), ForceRawLeaves: true, RawLeavesUsed: true}
	UseCidV1          = NodeOpts{Prefix: mdag.V1CidPrefix(), RawLeavesUsed: true}
	UseBlake2b256     NodeOpts
)

Some shorthands for NodeOpts.

Functions

func ArrComp

func ArrComp(a, b []byte) error

ArrComp checks if two byte slices are the same.

func ExtendMetaBytes added in v0.4.6

func ExtendMetaBytes(existing []byte, extended []byte) []byte

func GetDAGServ

func GetDAGServ() ipld.DAGService

GetDAGServ returns a mock DAGService.

func GetDagBuilderParams added in v0.4.9

func GetDagBuilderParams(dserv ipld.DAGService, opts NodeOpts) *h.DagBuilderParams

func GetEmptyNode

func GetEmptyNode(t testing.TB, dserv ipld.DAGService, opts NodeOpts) ipld.Node

GetEmptyNode returns an empty unixfs file node.

func GetNode

func GetNode(t testing.TB, dserv ipld.DAGService, data []byte, opts NodeOpts) ipld.Node

GetNode returns a unixfs file node with the specified data.

func GetNodeWithGivenData added in v0.4.9

func GetNodeWithGivenData(t testing.TB, dserv ipld.DAGService, data []byte, opts NodeOpts) ipld.Node

func GetRandomNode

func GetRandomNode(t testing.TB, dserv ipld.DAGService, size int64, opts NodeOpts) ([]byte, ipld.Node)

GetRandomNode returns a random unixfs file node.

func MetaSplitterGen added in v0.4.6

func MetaSplitterGen(size int64) chunker.SplitterGen

func PrintDag

func PrintDag(nd *mdag.ProtoNode, ds ipld.DAGService, indent int)

PrintDag pretty-prints the given dag to stdout.

func ReedSolomonMetaBytes added in v0.4.6

func ReedSolomonMetaBytes(numData, numParity, fileSize uint64) []byte

func SizeSplitterGen

func SizeSplitterGen(size int64) chunker.SplitterGen

SizeSplitterGen creates a generator.

Types

type NodeOpts

type NodeOpts struct {
	Prefix cid.Prefix
	// ForceRawLeaves if true will force the use of raw leaves
	ForceRawLeaves bool
	// RawLeavesUsed is true if raw leaves or either implicitly or explicitly enabled
	RawLeavesUsed bool
	// Enables reed solomon splitter
	ReedSolomonEnabled bool
	// Enables balanced DAG to be used than trickle.
	Balanced bool

	Metadata        []byte
	ChunkSize       uint64
	MaxLinks        int
	MetadataToMdify []byte
	// contains filtered or unexported fields
}

NodeOpts is used by GetNode, GetEmptyNode and GetRandomNode

func UseBalancedWithMetadata added in v0.4.5

func UseBalancedWithMetadata(maxLinks int, mdata []byte, chkSize uint64, mdata2 []byte) NodeOpts

func UseReedSolomon added in v0.4.4

func UseReedSolomon(numData, numParity, fileSize uint64, mdata []byte, chkSize uint64) (NodeOpts, []byte)

func UseTrickleWithMetadata added in v0.4.6

func UseTrickleWithMetadata(maxLinks int, mdata []byte, chkSize uint64, mdata2 []byte) NodeOpts

Jump to

Keyboard shortcuts

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