storagetest

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MinAddressBytes represents bytes that can be used to represent a min. address.
	MinAddressBytes = [swarm.HashSize]byte{swarm.HashSize - 1: 0x00}

	// MaxAddressBytes represents bytes that can be used to represent a max. address.
	MaxAddressBytes = [swarm.HashSize]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}

	MaxEncryptedRefBytes = [encryption.ReferenceSize]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}

	// MaxStampIndexBytes represents bytes that can be used to represent a max. stamp index.
	MaxStampIndexBytes = [swarm.StampIndexSize]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}

	// MaxBatchTimestampBytes represents bytes that can be used to represent a max. batch timestamp.
	MaxBatchTimestampBytes = [swarm.StampTimestampSize]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
)

Functions

func BenchmarkBatchedStore

func BenchmarkBatchedStore(b *testing.B, bs storage.BatchedStore)

BenchmarkBatchedStore provides a benchmark suite for the storage.BatchedStore. Only the Write and Delete methods are tested.

func BenchmarkChunkStoreDeleteRandom

func BenchmarkChunkStoreDeleteRandom(b *testing.B, s storage.ChunkStore)

func BenchmarkChunkStoreDeleteSequential

func BenchmarkChunkStoreDeleteSequential(b *testing.B, s storage.ChunkStore)

func BenchmarkChunkStoreIterateReverse

func BenchmarkChunkStoreIterateReverse(b *testing.B, s storage.ChunkStore)

func BenchmarkChunkStoreIterateSequential

func BenchmarkChunkStoreIterateSequential(b *testing.B, s storage.ChunkStore)

func BenchmarkChunkStoreReadHot

func BenchmarkChunkStoreReadHot(b *testing.B, s storage.ChunkStore)

func BenchmarkChunkStoreReadRandom

func BenchmarkChunkStoreReadRandom(b *testing.B, s storage.ChunkStore)

func BenchmarkChunkStoreReadRandomMissing

func BenchmarkChunkStoreReadRandomMissing(b *testing.B, s storage.ChunkStore)

func BenchmarkChunkStoreReadReverse

func BenchmarkChunkStoreReadReverse(b *testing.B, db storage.ChunkStore)

func BenchmarkChunkStoreReadSequential

func BenchmarkChunkStoreReadSequential(b *testing.B, s storage.ChunkStore)

func BenchmarkChunkStoreWriteRandom

func BenchmarkChunkStoreWriteRandom(b *testing.B, s storage.Putter)

func BenchmarkChunkStoreWriteSequential

func BenchmarkChunkStoreWriteSequential(b *testing.B, s storage.Putter)

func BenchmarkDeleteInBatches

func BenchmarkDeleteInBatches(b *testing.B, bs storage.BatchedStore)

func BenchmarkDeleteInFixedSizeBatches

func BenchmarkDeleteInFixedSizeBatches(b *testing.B, bs storage.BatchedStore)

func BenchmarkDeleteRandom

func BenchmarkDeleteRandom(b *testing.B, db storage.Store)

func BenchmarkDeleteSequential

func BenchmarkDeleteSequential(b *testing.B, db storage.Store)

func BenchmarkIterateReverse

func BenchmarkIterateReverse(b *testing.B, db storage.Store)

func BenchmarkIterateSequential

func BenchmarkIterateSequential(b *testing.B, db storage.Store)

func BenchmarkReadHot

func BenchmarkReadHot(b *testing.B, db storage.Store)

func BenchmarkReadRandom

func BenchmarkReadRandom(b *testing.B, db storage.Store)

func BenchmarkReadRandomMissing

func BenchmarkReadRandomMissing(b *testing.B, db storage.Store)

func BenchmarkReadReverse

func BenchmarkReadReverse(b *testing.B, db storage.Store)

func BenchmarkReadSequential

func BenchmarkReadSequential(b *testing.B, db storage.Store)

func BenchmarkStore

func BenchmarkStore(b *testing.B, s storage.Store)

func BenchmarkWriteInBatches

func BenchmarkWriteInBatches(b *testing.B, bs storage.BatchedStore)

func BenchmarkWriteInFixedSizeBatches

func BenchmarkWriteInFixedSizeBatches(b *testing.B, bs storage.BatchedStore)

func BenchmarkWriteRandom

func BenchmarkWriteRandom(b *testing.B, db storage.Store)

func BenchmarkWriteSequential

func BenchmarkWriteSequential(b *testing.B, db storage.Store)

func RunChunkStoreBenchmarkTests

func RunChunkStoreBenchmarkTests(b *testing.B, s storage.ChunkStore)

func TestBatchedStore

func TestBatchedStore(t *testing.T, bs storage.BatchedStore)

func TestChunkStore

func TestChunkStore(t *testing.T, st storage.ChunkStore)

TestChunkStore runs a correctness test suite on a given ChunkStore.

func TestItemClone

func TestItemClone(t *testing.T, test *ItemCloneTest)

TestItemClone provides correctness testsuite for storage.Item clone capabilities.

func TestItemMarshalAndUnmarshal

func TestItemMarshalAndUnmarshal(t *testing.T, test *ItemMarshalAndUnmarshalTest)

TestItemMarshalAndUnmarshal provides correctness testsuite for storage.Item serialization and deserialization.

func TestStore

func TestStore(t *testing.T, s storage.Store)

TestStore provides correctness testsuite for Store interface.

func TestTxChunkStore

func TestTxChunkStore(t *testing.T, store storage.TxChunkStore)

TestTxChunkStore provides correctness testsuite for storage.TxChunkStore interface.

func TestTxStore

func TestTxStore(t *testing.T, store storage.TxStore)

TestTxStore provides correctness testsuite for storage.TxStore interface.

Types

type ItemCloneTest

type ItemCloneTest struct {
	Item    storage.Item
	CmpOpts []cmp.Option
}

ItemCloneTest represents a test case for the TestItemClone function.

type ItemMarshalAndUnmarshalTest

type ItemMarshalAndUnmarshalTest struct {
	Item         storage.Item
	Factory      func() storage.Item
	MarshalErr   error // Expected error from Marshal.
	UnmarshalErr error // Expected error from Unmarshal.
	CmpOpts      []cmp.Option
}

ItemMarshalAndUnmarshalTest represents a test case for the TestItemMarshalAndUnmarshal function.

type ItemStub

type ItemStub struct {
	MarshalBuf   []byte
	MarshalErr   error
	UnmarshalBuf []byte
}

ItemStub is a stub for storage.Item.

func (*ItemStub) Clone

func (im *ItemStub) Clone() storage.Item

Clone implements the storage.Item interface.

func (ItemStub) ID

func (im ItemStub) ID() string

ID implements the storage.Item interface.

func (ItemStub) Marshal

func (im ItemStub) Marshal() ([]byte, error)

Marshal implements the storage.Item interface.

func (ItemStub) Namespace

func (im ItemStub) Namespace() string

Namespace implements the storage.Item interface.

func (ItemStub) String

func (im ItemStub) String() string

Clone implements the storage.Item interface.

func (*ItemStub) Unmarshal

func (im *ItemStub) Unmarshal(data []byte) error

Unmarshal implements the storage.Item interface.

Jump to

Keyboard shortcuts

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