Crate engine_test[][src]

Engines for use in the test suite, implementing both the KvEngine and RaftEngine traits.

These engines link to all other engines, providing concrete single storage engine type to run tests against.

This provides a simple way to integrate non-RocksDB engines into the existing test suite without too much disruption.

Engines presently supported by this crate are

TiKV uses two different storage engine instances, the “raft” engine, for storing consensus data, and the “kv” engine, for storing user data.

The types and constructors for these two engines are located in the raft and kv modules respectively.

The engine for each module is chosen at compile time with feature flags:

By default, the tikv crate turns on test-engine-kv-rocksdb, and test-engine-raft-rocksdb. This behavior can be disabled with --disable-default-features.

The tikv crate additionally provides two feature flags that contral both the kv and raft engines at the same time:

So, e.g., to run the test suite with the panic engine:

cargo test --all --disable-default-features --features=protobuf_codec,test-engines-panic

We’ll probably revisit the engine-testing strategy in the future, e.g. by using engine-parameterized tests instead.

This create also contains a ctor module that contains constructor methods appropriate for constructing storage engines of any type. It is intended that this module is the only module within TiKV that knows about concrete storage engines, and that it be extracted into its own crate for use in TiKV, once the full requirements are better understood.

Modules

ctor

Create a storage engine with a concrete type. This should ultimately be the only module within TiKv that needs to know about concrete engines. Other code only uses the engine_traits abstractions.

kv

Types and constructors for the “kv” engine

raft

Types and constructors for the “raft” engine

Functions

new_temp_engine

Create a new set of engines in a temporary directory