Documentation
¶
Overview ¶
Package testutil is a fork of some components of github.com/ipfs/go-graphsync/testutil in order to avoid networking dependencies imposed by Graphsync.
Index ¶
- func AsIdentity(key string) (digest []byte, ok bool, err error)
- func MakeDagWithIdentity(t *testing.T, lsys linking.LinkSystem) unixfs.DirEntry
- func RandomBytes(n int64) []byte
- type CorrectedMemStore
- type ParentStore
- type TestBlockChain
- func (tbc *TestBlockChain) AllBlocks() []blocks.Block
- func (tbc *TestBlockChain) Blocks(from int, to int) []blocks.Block
- func (tbc *TestBlockChain) Chooser(ipld.Link, ipld.LinkContext) (ipld.NodePrototype, error)
- func (tbc *TestBlockChain) LinkTipIndex(fromTip int) ipld.Link
- func (tbc *TestBlockChain) NodeTipIndex(fromTip int) ipld.Node
- func (tbc *TestBlockChain) PathTipIndex(fromTip int) ipld.Path
- func (tbc *TestBlockChain) RemainderBlocks(from int) []blocks.Block
- func (tbc *TestBlockChain) Selector() ipld.Node
- type ZeroReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeDagWithIdentity ¶ added in v0.3.0
MakeDagWithIdentity makes a non-unixfs DAG, wrapped in the go-unixfsnode/testutil/DirEntry struct (so it can be used in all the places DirEntry is) that has an identity CID in the middle linking a section that the identity CID must be traversed through to find.
func RandomBytes ¶
RandomBytes returns a byte array of the given size with random values.
Types ¶
type CorrectedMemStore ¶ added in v0.3.0
type CorrectedMemStore struct {
ParentStore
}
TODO: remove when this is fixed in IPLD prime
func (*CorrectedMemStore) GetStream ¶ added in v0.3.0
func (cms *CorrectedMemStore) GetStream(ctx context.Context, key string) (io.ReadCloser, error)
type ParentStore ¶ added in v0.3.0
type ParentStore interface { storage.ReadableStorage storage.StreamingReadableStorage storage.WritableStorage }
type TestBlockChain ¶
type TestBlockChain struct { GenisisNode ipld.Node GenisisLink ipld.Link MiddleNodes []ipld.Node MiddleLinks []ipld.Link TipNode ipld.Node TipLink ipld.Link // contains filtered or unexported fields }
TestBlockChain is a simulated data structure similar to a blockchain
func SetupBlockChain ¶
func SetupBlockChain( ctx context.Context, t testing.TB, lsys ipld.LinkSystem, size uint64, blockChainLength int) *TestBlockChain
SetupBlockChain creates a new test block chain with the given height
func (*TestBlockChain) AllBlocks ¶
func (tbc *TestBlockChain) AllBlocks() []blocks.Block
AllBlocks returns all blocks for a blockchain
func (*TestBlockChain) Blocks ¶
func (tbc *TestBlockChain) Blocks(from int, to int) []blocks.Block
Blocks Returns the given raw blocks for the block chain for the given range, indexed from the tip
func (*TestBlockChain) Chooser ¶
func (tbc *TestBlockChain) Chooser(ipld.Link, ipld.LinkContext) (ipld.NodePrototype, error)
Chooser is a NodeBuilderChooser function that always returns the block chain
func (*TestBlockChain) LinkTipIndex ¶
func (tbc *TestBlockChain) LinkTipIndex(fromTip int) ipld.Link
LinkTipIndex returns a link to the block at the given index from the tip
func (*TestBlockChain) NodeTipIndex ¶
func (tbc *TestBlockChain) NodeTipIndex(fromTip int) ipld.Node
NodeTipIndex returns the node to the block at the given index from the tip
func (*TestBlockChain) PathTipIndex ¶
func (tbc *TestBlockChain) PathTipIndex(fromTip int) ipld.Path
PathTipIndex returns the path to the block at the given index from the tip
func (*TestBlockChain) RemainderBlocks ¶
func (tbc *TestBlockChain) RemainderBlocks(from int) []blocks.Block
RemainderBlocks returns the remaining blocks for a blockchain, indexed from tip
func (*TestBlockChain) Selector ¶
func (tbc *TestBlockChain) Selector() ipld.Node
Selector returns the selector to recursive traverse the block chain parent links
type ZeroReader ¶ added in v0.3.0
type ZeroReader struct{}
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package chaintypes is a fork of some components of github.com/ipfs/go-graphsync/testutil/chaintypes in order to avoid networking dependencies imposed by Graphsync.
|
Package chaintypes is a fork of some components of github.com/ipfs/go-graphsync/testutil/chaintypes in order to avoid networking dependencies imposed by Graphsync. |