testu

package
v0.0.0-...-8b9b725 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2019 License: MIT, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 GetDAGServ

func GetDAGServ() ipld.DAGService

GetDAGServ returns a mock DAGService.

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 GetRandomNode

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

GetRandomNode returns a random unixfs file node.

func PrintDag

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

PrintDag pretty-prints the given dag to stdout.

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
}

NodeOpts is used by GetNode, GetEmptyNode and GetRandomNode

Jump to

Keyboard shortcuts

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