testutil

package
v0.0.0-...-a4f5bd3 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func ApplyDiff

func ApplyDiff(t *testing.T, diff shard.Diff, bs Blockstore)

func RandomBytes

func RandomBytes(t *testing.T, size int) []byte
func RandomLink(t *testing.T) datamodel.Link

func RandomMultihash

func RandomMultihash(t *testing.T) mh.Multihash

Types

type Blockstore

type Blockstore interface {
	block.Fetcher
	Put(ctx context.Context, b block.Block) error
	Del(ctx context.Context, link ipld.Link) error
}

type MapBlockstore

type MapBlockstore struct {
	GetCount int
	// contains filtered or unexported fields
}

func NewBlockstore

func NewBlockstore() *MapBlockstore

func (*MapBlockstore) Del

func (bs *MapBlockstore) Del(ctx context.Context, link ipld.Link) error

func (*MapBlockstore) Get

func (bs *MapBlockstore) Get(ctx context.Context, link ipld.Link) (block.Block, error)

func (*MapBlockstore) Put

func (bs *MapBlockstore) Put(ctx context.Context, b block.Block) error

func (*MapBlockstore) PutAll

func (bs *MapBlockstore) PutAll(ctx context.Context, blocks ...block.Block) error

type StringBinder

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

func NewStringBinder

func NewStringBinder(t *testing.T) StringBinder

func (StringBinder) Bind

func (sb StringBinder) Bind(n ipld.Node) (string, error)

func (StringBinder) Unbind

func (sb StringBinder) Unbind(s string) (ipld.Node, error)

type TestEvent

type TestEvent struct {
	Operation string
	Key       string
	Value     ipld.Link
}

func RandomEventData

func RandomEventData(t *testing.T) TestEvent

type TestEventBinder

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

func NewTestEventBinder

func NewTestEventBinder(t *testing.T) TestEventBinder

func (TestEventBinder) Bind

func (teb TestEventBinder) Bind(n ipld.Node) (TestEvent, error)

func (TestEventBinder) Unbind

func (teb TestEventBinder) Unbind(e TestEvent) (ipld.Node, error)

Jump to

Keyboard shortcuts

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