blobcachetests

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

package blobcachetests provides a test suite for blobcache.Service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abort

func Abort(t testing.TB, s blobcache.Service, txh blobcache.Handle)

func Commit

func Commit(t testing.TB, s blobcache.Service, txh blobcache.Handle)

func CreateOnSameHost

CreateOnSameHost creates a new subvolume on the same host as the base volume.

func Delete

func Delete(t testing.TB, s blobcache.Service, txh blobcache.Handle, cid blobcache.CID)

func Exists

func Exists(t testing.TB, s blobcache.Service, txh blobcache.Handle, cid blobcache.CID) bool

func Get

func Get(t testing.TB, s blobcache.Service, txh blobcache.Handle, cid blobcache.CID, buf []byte, opts blobcache.GetOpts) int

func GetBytes

func GetBytes(t testing.TB, s blobcache.Service, txh blobcache.Handle, cid blobcache.CID, opts blobcache.GetOpts, maxSize int) []byte

func IsVisited

func IsVisited(t testing.TB, s blobcache.Service, txh blobcache.Handle, cids []blobcache.CID) []bool

func Load

func Load(t testing.TB, s blobcache.Service, txh blobcache.Handle) []byte

func Modify

func Modify(t testing.TB, s blobcache.Service, volh blobcache.Handle, f func(tx *bcsdk.Tx) ([]byte, error))

func Post

func QueueAPI added in v0.4.0

func QueueAPI(t *testing.T, setup func(testing.TB) (blobcache.QueueAPI, blobcache.Handle))

func Save

func Save(t testing.TB, s blobcache.Service, txh blobcache.Handle, data []byte)

func SaveCommit

func SaveCommit(t testing.TB, s blobcache.Service, txh blobcache.Handle, data []byte)

SaveCommit is a convenience function that saves the given data and then commits the transaction.

func ServiceAPI

func ServiceAPI(t *testing.T, mk func(t testing.TB) blobcache.Service)

ServiceAPI tests an implementation of blobcache.Service.

func SetupScene added in v0.8.0

func SetupScene(t testing.TB, scen Scene, nodes []blobcache.Service)

func TestManyBlobs

func TestManyBlobs(t *testing.T, singleTx bool, mk func(t testing.TB) blobcache.Service)

func TestMultiNode

func TestMultiNode(t *testing.T, mk func(t testing.TB, n int) []blobcache.Service)

func TestVolumeSubscribe added in v0.4.0

func TestVolumeSubscribe(t *testing.T, setup func(testing.TB) (svc blobcache.Service, volh, qh blobcache.Handle))

func TxAPI

func TxAPI(t *testing.T, mk func(t testing.TB) (blobcache.Service, blobcache.Handle))

TxAPI runs a test suite for transactions on a given volume. The function mk should return a service and a volume handle. The volume handle will be used to open multiple transactions, sometimes concurrently.

func Visit

func Visit(t testing.TB, s blobcache.Service, txh blobcache.Handle, cids []blobcache.CID)

Types

type Contents added in v0.8.0

type Contents interface {
	// Fill fills a Volume.
	// tx is a transaction on the Volume being filled.
	// vols are handles to all of the volumes on the same Node as the Volume being filled.
	Fill(ctx context.Context, tx *bcsdk.Tx, vols []blobcache.Handle) error
}

Contents are Volume contents

type Data added in v0.8.0

type Data struct {
	Cell []byte
}

func (*Data) Fill added in v0.8.0

func (d *Data) Fill(ctx context.Context, tx *bcsdk.Tx, vols []blobcache.Handle) error

type LocalVolume added in v0.8.0

type LocalVolume struct {
	Schema   blobcache.SchemaSpec
	Contents Contents
}

LocalVolume describes a Volume in a Scenario

func (*LocalVolume) VolumeSpec added in v0.8.0

func (v *LocalVolume) VolumeSpec() blobcache.VolumeSpec

type Node added in v0.8.0

type Node struct {
	Root    LocalVolume
	Volumes []Volume
}

type PeerVolume added in v0.8.0

type PeerVolume struct {
	Node   int
	Volume int
}

type Scene added in v0.8.0

type Scene struct {
	Nodes []Node
}

Scene describes an initial configuration of Nodes and Volumes

type Volume added in v0.8.0

type Volume interface {
	// contains filtered or unexported methods
}

Volume describes how a Volume should be setup in a Scene

Jump to

Keyboard shortcuts

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