Crate tikv_util[][src]

Modules

buffer_vec
callback
codec
config
deadline
future
keybuilder
log
logger
lru
macros

The macros crate contains all useful needed macros.

metrics
mpsc

This module provides an implementation of mpsc channel based on crossbeam_channel. Comparing to the crossbeam_channel, this implementation supports closed detection and try operations.

stream
sys
time
timer
worker

Worker provides a mechanism to run tasks asynchronously (i.e. in the background) with some additional features, for example, ticks.

yatp_pool

Macros

box_err

A shortcut to box an error.

box_try

Boxes error first, and then does the same thing as try!.

count_args

Gets the count of macro’s arguments.

crit

Logs a critical level message using the slog global logger.

debug

Logs a debug level message using the slog global logger.

defer

Simulates Go’s defer.

error

Logs a error level message using the slog global logger. /// Use ‘?’ to output error in debug format or ‘%’ to ouput error in display format. As the third and forth rules shown, the last log field should follow a ‘,’ to seperate the ‘err’ field. eg. error!(?e, "msg"; "foo" => foo,); If you don’t want to output error code, just use the common form like other macros. Require slog_global dependency and #![feature(min_speacilization)] in all crates.

error_unknown
impl_display_as_debug
impl_format_delegate_newtype
info

Logs a info level message using the slog global logger.

map

Initializes a HashMap with specified key-value pairs.

safe_panic

A safe panic macro that prevents double panic.

slow_log

Logs slow operations by warn!. The final log level depends on the given cost and slow_log_threshold

thd_name

Makes a thread name with an additional tag inherited from the current thread.

trace

Logs a trace level message using the slog global logger.

try_opt

Checks Result<Option<T>>, and returns early when it meets Err or Ok(None).

try_opt_or

Checks Result<Option<T>>, and returns early when it meets Err or Ok(None). return Ok(or) when met Ok(None).

wait_op

Waits for async operation. It returns Option<Res> after the expression gets executed. It only accepts a Result expression.

warn

Logs a warning level message using the slog global logger.

Structs

DefaultRng
DeferContext

Invokes the wrapped closure when dropped.

MustConsumeVec
RingQueue

A simple ring queue with fixed capacity.

Enums

Either

Represents a value of one of two possible types (a more generic Result.)

Constants

NO_LIMIT
PANIC_MARK_FILE

Statics

PANIC_MARK
PANIC_WHEN_UNEXPECTED_KEY_OR_DATA

Traits

AssertClone
AssertCopy
AssertSend
AssertSync
HandyRwLock

A handy shortcut to replace RwLock write/read().unwrap() pattern to shortcut wl and rl.

TryInsertWith

A helper trait for Entry to accept a failable closure.

Functions

build_on_master_branch

A useful hook to check if master branch is being built.

check_environment_variables

Checks environment variables that affect TiKV.

create_panic_mark_file
empty_shared_slice
escape

A function to escape a byte array to a readable ascii string. escape rules follow golang/protobuf. https://github.com/golang/protobuf/blob/master/proto/text.go#L578

file_exists
get_tag_from_thread_name
is_even
is_zero_duration
panic_mark_file_exists
panic_mark_file_path
panic_mark_is_on
panic_when_unexpected_key_or_data
set_panic_hook

Exit the whole process when panic.

set_panic_mark
set_panic_when_unexpected_key_or_data
slices_in_range

Take slices in the range.

unescape

A function to unescape an escaped string to a byte array.