Documentation ¶
Index ¶
- Variables
- func BenchmarkBatchDelete(b *testing.B, db database.Database, keys, _ [][]byte)
- func BenchmarkBatchPut(b *testing.B, db database.Database, keys, values [][]byte)
- func BenchmarkBatchWrite(b *testing.B, db database.Database, keys, values [][]byte)
- func BenchmarkDelete(b *testing.B, db database.Database, keys, values [][]byte)
- func BenchmarkGet(b *testing.B, db database.Database, keys, values [][]byte)
- func BenchmarkParallelDelete(b *testing.B, db database.Database, keys, values [][]byte)
- func BenchmarkParallelGet(b *testing.B, db database.Database, keys, values [][]byte)
- func BenchmarkParallelPut(b *testing.B, db database.Database, keys, values [][]byte)
- func BenchmarkPut(b *testing.B, db database.Database, keys, values [][]byte)
- func FuzzKeyValue(f *testing.F, db database.KeyValueReaderWriterDeleter)
- func FuzzNewIteratorWithPrefix(f *testing.F, db database.Database)
- func FuzzNewIteratorWithStartAndPrefix(f *testing.F, db database.Database)
- func SetupBenchmark(b *testing.B, count int, keySize, valueSize int) ([][]byte, [][]byte)
- func TestAtomicClear(t *testing.T, db database.Database)
- func TestAtomicClearPrefix(t *testing.T, db database.Database)
- func TestBatchDelete(t *testing.T, db database.Database)
- func TestBatchInner(t *testing.T, db database.Database)
- func TestBatchLargeSize(t *testing.T, db database.Database)
- func TestBatchPut(t *testing.T, db database.Database)
- func TestBatchReplay(t *testing.T, db database.Database)
- func TestBatchReplayPropagateError(t *testing.T, db database.Database)
- func TestBatchReset(t *testing.T, db database.Database)
- func TestBatchReuse(t *testing.T, db database.Database)
- func TestBatchRewrite(t *testing.T, db database.Database)
- func TestClear(t *testing.T, db database.Database)
- func TestClearPrefix(t *testing.T, db database.Database)
- func TestCompactNoPanic(t *testing.T, db database.Database)
- func TestConcurrentBatches(t *testing.T, db database.Database)
- func TestEmptyKey(t *testing.T, db database.KeyValueReaderWriterDeleter)
- func TestIterator(t *testing.T, db database.Database)
- func TestIteratorClosed(t *testing.T, db database.Database)
- func TestIteratorError(t *testing.T, db database.Database)
- func TestIteratorErrorAfterRelease(t *testing.T, db database.Database)
- func TestIteratorMemorySafety(t *testing.T, db database.Database)
- func TestIteratorPrefix(t *testing.T, db database.Database)
- func TestIteratorSnapshot(t *testing.T, db database.Database)
- func TestIteratorStart(t *testing.T, db database.Database)
- func TestIteratorStartPrefix(t *testing.T, db database.Database)
- func TestKeyEmptyValue(t *testing.T, db database.KeyValueReaderWriterDeleter)
- func TestManySmallConcurrentKVPairBatches(t *testing.T, db database.Database)
- func TestMemorySafetyBatch(t *testing.T, db database.Database)
- func TestMemorySafetyDatabase(t *testing.T, db database.KeyValueReaderWriterDeleter)
- func TestModifyValueAfterBatchPut(t *testing.T, db database.Database)
- func TestModifyValueAfterBatchPutReplay(t *testing.T, db database.Database)
- func TestModifyValueAfterPut(t *testing.T, db database.KeyValueReaderWriterDeleter)
- func TestNewBatchClosed(t *testing.T, db database.Database)
- func TestOverwriteKeyValue(t *testing.T, db database.KeyValueReaderWriterDeleter)
- func TestPutGetEmpty(t *testing.T, db database.KeyValueReaderWriterDeleter)
- func TestSimpleKeyValue(t *testing.T, db database.KeyValueReaderWriterDeleter)
- func TestSimpleKeyValueClosed(t *testing.T, db database.Database)
Constants ¶
This section is empty.
Variables ¶
var ( // Benchmarks is a list of all database benchmarks Benchmarks = map[string]func(b *testing.B, db database.Database, keys, values [][]byte){ "Get": BenchmarkGet, "Put": BenchmarkPut, "Delete": BenchmarkDelete, "BatchPut": BenchmarkBatchPut, "BatchDelete": BenchmarkBatchDelete, "BatchWrite": BenchmarkBatchWrite, "ParallelGet": BenchmarkParallelGet, "ParallelPut": BenchmarkParallelPut, "ParallelDelete": BenchmarkParallelDelete, } // BenchmarkSizes to use with each benchmark BenchmarkSizes = [][]int{ {1024, 32, 32}, {1024, 256, 256}, {1024, 2 * units.KiB, 2 * units.KiB}, } )
var Tests = map[string]func(t *testing.T, db database.Database){ "SimpleKeyValueClosed": TestSimpleKeyValueClosed, "NewBatchClosed": TestNewBatchClosed, "BatchPut": TestBatchPut, "BatchDelete": TestBatchDelete, "BatchReset": TestBatchReset, "BatchReuse": TestBatchReuse, "BatchRewrite": TestBatchRewrite, "BatchReplay": TestBatchReplay, "BatchReplayPropagateError": TestBatchReplayPropagateError, "BatchInner": TestBatchInner, "BatchLargeSize": TestBatchLargeSize, "IteratorSnapshot": TestIteratorSnapshot, "Iterator": TestIterator, "IteratorStart": TestIteratorStart, "IteratorPrefix": TestIteratorPrefix, "IteratorStartPrefix": TestIteratorStartPrefix, "IteratorMemorySafety": TestIteratorMemorySafety, "IteratorClosed": TestIteratorClosed, "IteratorError": TestIteratorError, "IteratorErrorAfterRelease": TestIteratorErrorAfterRelease, "CompactNoPanic": TestCompactNoPanic, "MemorySafetyBatch": TestMemorySafetyBatch, "AtomicClear": TestAtomicClear, "Clear": TestClear, "AtomicClearPrefix": TestAtomicClearPrefix, "ClearPrefix": TestClearPrefix, "ModifyValueAfterBatchPut": TestModifyValueAfterBatchPut, "ModifyValueAfterBatchPutReplay": TestModifyValueAfterBatchPutReplay, "ConcurrentBatches": TestConcurrentBatches, "ManySmallConcurrentKVPairBatches": TestManySmallConcurrentKVPairBatches, }
Tests is a list of all database tests
var TestsBasic = map[string]func(t *testing.T, db database.KeyValueReaderWriterDeleter){ "SimpleKeyValue": TestSimpleKeyValue, "OverwriteKeyValue": TestOverwriteKeyValue, "EmptyKey": TestEmptyKey, "KeyEmptyValue": TestKeyEmptyValue, "MemorySafetyDatabase": TestMemorySafetyDatabase, "ModifyValueAfterPut": TestModifyValueAfterPut, "PutGetEmpty": TestPutGetEmpty, }
TestsBasic is a list of all basic database tests that require only a KeyValueReaderWriterDeleter.
Functions ¶
func BenchmarkBatchDelete ¶
BenchmarkBatchDelete measures the time it takes to batch delete.
func BenchmarkBatchPut ¶
BenchmarkBatchPut measures the time it takes to batch put.
func BenchmarkBatchWrite ¶
BenchmarkBatchWrite measures the time it takes to batch write.
func BenchmarkDelete ¶
BenchmarkDelete measures the time it takes to delete a (k, v) from a database.
func BenchmarkGet ¶
BenchmarkGet measures the time it takes to get an operation from a database.
func BenchmarkParallelDelete ¶
BenchmarkParallelDelete measures the time it takes to delete a (k, v) from the db.
func BenchmarkParallelGet ¶
BenchmarkParallelGet measures the time it takes to read in parallel.
func BenchmarkParallelPut ¶
BenchmarkParallelPut measures the time it takes to write to the db in parallel.
func BenchmarkPut ¶
BenchmarkPut measures the time it takes to write an operation to a database.
func FuzzKeyValue ¶
func FuzzKeyValue(f *testing.F, db database.KeyValueReaderWriterDeleter)
func SetupBenchmark ¶
Writes size data into the db in order to setup reads in subsequent tests.
func TestBatchDelete ¶
TestBatchDelete tests to make sure that batched deletes work as expected.
func TestBatchInner ¶
TestBatchInner tests to make sure that inner can be used to write to the database.
func TestBatchLargeSize ¶
TestBatchLargeSize tests to make sure that the batch can support a large amount of entries.
func TestBatchPut ¶
TestBatchPut tests to make sure that batched writes work as expected.
func TestBatchReplay ¶
TestBatchReplay tests to make sure that batches will correctly replay their contents.
func TestBatchReplayPropagateError ¶
TestBatchReplayPropagateError tests to make sure that batches will correctly propagate any returned error during Replay.
func TestBatchReset ¶
TestBatchReset tests to make sure that a batch drops un-written operations when it is reset.
func TestBatchReuse ¶
TestBatchReuse tests to make sure that a batch can be reused once it is reset.
func TestBatchRewrite ¶
TestBatchRewrite tests to make sure that write can be called multiple times on a batch and the values will be updated correctly.
func TestCompactNoPanic ¶
TestCompactNoPanic tests to make sure compact never panics.
func TestEmptyKey ¶
func TestEmptyKey(t *testing.T, db database.KeyValueReaderWriterDeleter)
func TestIterator ¶
TestIterator tests to make sure the database iterates over the database contents lexicographically.
func TestIteratorClosed ¶
TestIteratorClosed tests to make sure that an iterator that was created with a closed database will report a closed error correctly.
func TestIteratorError ¶
TestIteratorError tests to make sure that an iterator on a database will report itself as being exhausted and return database.ErrClosed to indicate that the iteration was not successful. Additionally tests that an iterator that has already called Next() can still serve its current value after the underlying DB was closed.
func TestIteratorErrorAfterRelease ¶
TestIteratorErrorAfterRelease tests to make sure that an iterator that was released still reports the error correctly.
func TestIteratorMemorySafety ¶
TestIteratorMemorySafety tests to make sure that keys can values are able to be modified from the returned iterator.
func TestIteratorPrefix ¶
TestIteratorPrefix tests to make sure the iterator can be configured to skip keys missing the provided prefix.
func TestIteratorSnapshot ¶
TestIteratorSnapshot tests to make sure the database iterates over a snapshot of the database at the time of the iterator creation.
func TestIteratorStart ¶
TestIteratorStart tests to make sure the iterator can be configured to start mid way through the database.
func TestIteratorStartPrefix ¶
TestIteratorStartPrefix tests to make sure that the iterator can start mid way through the database while skipping a prefix.
func TestKeyEmptyValue ¶
func TestKeyEmptyValue(t *testing.T, db database.KeyValueReaderWriterDeleter)
func TestMemorySafetyBatch ¶
TestMemorySafetyBatch ensures it is safe to modify a key after passing it to Batch.Put.
func TestMemorySafetyDatabase ¶
func TestMemorySafetyDatabase(t *testing.T, db database.KeyValueReaderWriterDeleter)
TestMemorySafetyDatabase ensures it is safe to modify a key after passing it to Database.Put and Database.Get.
func TestModifyValueAfterPut ¶
func TestModifyValueAfterPut(t *testing.T, db database.KeyValueReaderWriterDeleter)
func TestNewBatchClosed ¶
TestNewBatchClosed tests to make sure that calling NewBatch on a closed database returns a batch that errors correctly.
func TestOverwriteKeyValue ¶
func TestOverwriteKeyValue(t *testing.T, db database.KeyValueReaderWriterDeleter)
func TestPutGetEmpty ¶
func TestPutGetEmpty(t *testing.T, db database.KeyValueReaderWriterDeleter)
func TestSimpleKeyValue ¶
func TestSimpleKeyValue(t *testing.T, db database.KeyValueReaderWriterDeleter)
TestSimpleKeyValue tests to make sure that simple Put + Get + Delete + Has calls return the expected values.
Types ¶
This section is empty.