Module raftstore::store::util[][src]

Structs

AdminCmdEpochState
KeysInfoFormatter
Lease

Lease records an expired time, for examining the current moment is in lease or not. It’s dedicated to the Raft leader lease mechanism, contains either state of

MsgType
ReadState
RegionReadProgress

RegionReadProgress is used to keep track of the replica’s safe_ts, the replica can handle a read request directly without requiring leader lease or read index iff safe_ts >= read_ts (the read_ts is usually stale i.e seconds ago).

RegionReadProgressCore
RemoteLease

A remote lease, it can only be derived by Lease. It will be sent to the local read thread, so name it remote. If Lease expires, the remote must expire too.

Enums

ConfChangeKind
LeaseState

Constants

MSEC_PER_SEC
NSEC_PER_MSEC
STR_CONF_CHANGE_ADDLEARNER_NODE
STR_CONF_CHANGE_ADD_NODE
STR_CONF_CHANGE_REMOVE_NODE
TIMESPEC_NSEC_MASK
TIMESPEC_NSEC_SHIFT
TIMESPEC_SEC_SHIFT

Statics

NORMAL_REQ_CHECK_CONF_VER
NORMAL_REQ_CHECK_VER

WARNING: NORMAL_REQ_CHECK_VER and NORMAL_REQ_CHECK_CONF_VER MUST NOT be changed. The reason is the same as admin_cmd_epoch_lookup.

Traits

ChangePeerI

Abstracts over ChangePeerV2Request and (legacy) ChangePeerRequest to allow treating them in a unified manner.

Functions

admin_cmd_epoch_lookup

WARNING: the existing settings below MUST NOT be changed!!! Changing any admin cmd’s AdminCmdEpochState or the epoch-change behavior during applying will break upgrade compatibility and correctness dependency of CmdEpochChecker. Please remember it is very difficult to fix the issues arising from not following this rule.

build_key_range
check_key_in_region

Check if key in region range [start_key, end_key).

check_key_in_region_exclusive

Check if key in region range (start_key, end_key).

check_key_in_region_inclusive

Check if key in region range [start_key, end_key].

check_peer_id
check_region_epoch
check_store_id
check_term
compare_region_epoch
conf_change_type_str
conf_state_from_region
find_peer
find_peer_mut
integration_on_half_fail_quorum_fn
is_epoch_stale
is_first_append_entry

is_first_append_entry checks msg is the first append message or not. This meassge is the first message that the learner peers of the new split region will receive from the leader. It’s used for when the message is received but there is no such region in Store::region_peers. In this case we should put msg into pending_msg instead of create the peer.

is_first_message
is_first_vote_msg

is_first_vote_msg checks msg is the first vote (or prevote) message or not. It’s used for when the message is received but there is no such region in Store::region_peers and the region overlaps with others. In this case we should put msg into pending_msg instead of create the peer.

is_initial_msg

is_initial_msg checks whether the msg can be used to initialize a new peer or not.

is_learner
is_region_initialized
is_sibling_regions

Check if two regions are sibling.

is_vote_msg
new_learner_peer
new_peer
parse_data_at

Parse data of entry index.

region_on_same_stores

Check if replicas of two regions are on the same stores.

remove_peer
timespec_to_u64

Convert Timespec to u64. It’s millisecond precision and covers a range of about 571232829 years in total.

u64_to_timespec

Convert Timespec to u64.