mirror of https://github.com/tikv/client-rust.git
doc: timestamp
Signed-off-by: ekexium <ekexium@gmail.com>
This commit is contained in:
parent
a92f3710fe
commit
82fdf4c9e2
|
@ -10,8 +10,13 @@ pub use tikv_client_proto::pdpb::Timestamp;
|
|||
const PHYSICAL_SHIFT_BITS: i64 = 18;
|
||||
const LOGICAL_MASK: i64 = (1 << PHYSICAL_SHIFT_BITS) - 1;
|
||||
|
||||
/// A helper trait to convert between [`Timestamp`](Timestamp) and an u64.
|
||||
///
|
||||
/// A `Timestamp` (64 bits) contains a physical part (first 46 bits) and a logical part (last 18 bits).
|
||||
pub trait TimestampExt {
|
||||
/// Combine physical and logical parts to get a single `Timestamp` (version).
|
||||
fn version(&self) -> u64;
|
||||
/// Decompose the `Timestamp` (version) into physical and logical parts.
|
||||
fn from_version(version: u64) -> Self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue