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:

Related code:

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 PerfContext. This statistics store delta values between two instant statistics.

PerfStatisticsInstant

Store statistics we need. Data comes from RocksDB’s PerfContext. This statistics store instant values.

PrewriteResult
RocksEngine

The RocksEngine is based on RocksDB.

SnapshotStore
Statistics
Storage

Storage implements transactional KV APIs and raw KV APIs on a given Engine. An Engine provides low level KV functionality. Engine has multiple implementations. When a TiKV server is running, a RaftKv will be the underlying Engine of Storage. The other two types of engines are for test purpose.

TestEngineBuilder

A builder to build a temporary RocksEngine.

TestStorageBuilder

A builder to build a temporary Storage<E>.

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

Scanners allow retrieving items or batches from a scan result.

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