Module tikv::storage [−][src]
This module contains TiKV’s transaction layer. It lowers high-level, transactional commands to low-level (raw key-value) interactions with persistent storage.
This module is further split into layers: txn
lowers transactional commands to
key-value operations on an MVCC abstraction. mvcc
is our MVCC implementation.
kv
is an abstraction layer over persistent storage.
Other responsibilities of this module are managing latches (see latch
), deadlock
and wait handling (see lock_manager
), scheduling command execution (see
txn::scheduler
), and handling commands from the raw and versioned APIs (in
the Storage
struct).
For more information about TiKV’s transactions, see the sig-txn docs.
Some important types are:
- the
Engine
trait and related traits, which abstracts over underlying storage, - the
MvccTxn
struct, which is the primary object in the MVCC implementation, - the commands in the
commands
module, which are how each command is implemented, - the
Storage
struct, which is the primary entry point for this module.
Related code:
- the
kv
module, which is the interface for TiKV’s APIs, - the `lock_manager, which takes part in lock and deadlock management,
gc_worker
, which drives garbage collection of old values,- the `txn_types crate, some important types for this module’s interface,
- the
kvproto
crate, which defines TiKV’s protobuf API and includes some documentation of the commands implemented here, - the
test_storage
crate, integration tests for this module, - the
engine_traits
crate, more detail of the engine abstraction.
Re-exports
pub use self::errors::get_error_kind_from_header; |
pub use self::errors::get_tag_from_header; |
pub use self::errors::Error; |
pub use self::errors::ErrorHeaderKind; |
pub use self::errors::ErrorInner; |
pub use self::raw::TTLSnapshot; |
pub use self::txn::ProcessResult; |
Modules
config | Storage configuration. |
errors | Types for storage related errors and associated helper methods. |
kv | |
lock_manager | |
metrics | Prometheus metrics for storage functionality. |
mvcc | Multi-version concurrency control functionality. |
raw | |
read_pool | Distinct thread pools to handle read commands having different priority levels. |
test_util | |
txn | Storage Transactions |
types | Core data types. |
Structs
CbContext | |
CfStatistics | Statistics collects the ops taken when fetching data. |
Cursor | |
CursorBuilder | A handy utility to build a snapshot cursor according to various configurations. |
FlowStatistics | |
LatchLock | Lock required for a command. |
Latches | Latches which are used for concurrency control in the scheduler. |
PerfStatisticsDelta | Store statistics we need. Data comes from RocksDB’s |
PerfStatisticsInstant | Store statistics we need. Data comes from RocksDB’s |
PrewriteResult | |
RocksEngine | The RocksEngine is based on |
SnapshotStore | |
Statistics | |
Storage |
|
TestEngineBuilder | A builder to build a temporary |
TestStorageBuilder | A builder to build a temporary |
Enums
PessimisticLockRes | |
RawStore | |
ScanMode | |
SecondaryLocksStatus | |
StorageCallback | |
TxnStatus | Represents the status of a transaction. |
Traits
Engine | Engine defines the common behaviour for a storage engine type. |
FlowStatsReporter | |
Iterator | |
ResponseBatchConsumer | |
Scanner |
|
Snapshot | A Snapshot is a consistent view of the underlying engine at a given point in time. |
Store |
Functions
build_read_pool | Build respective thread pools to handle read commands of different priority levels. |
build_read_pool_for_test | Build a thread pool that has default tick behavior for testing. |
get_priority_tag | |
need_check_locks_in_replica_read | |
point_key_range | |
prepare_snap_ctx |
Type Definitions
Callback | |
Result |