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;
|
||||
}
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ impl From<tikv_client_proto::kvrpcpb::KeyError> for Error {
|
|||
}
|
||||
}
|
||||
|
||||
/// The result type used in tikv-client.
|
||||
/// The result type used in tikv-client.
|
||||
/// It holds an error type that contains varisous kinds of error that can happen in the crate.
|
||||
pub type Result<T> = result::Result<T, Error>;
|
||||
|
||||
|
|
Loading…
Reference in New Issue