doc: timestamp

Signed-off-by: ekexium <ekexium@gmail.com>
This commit is contained in:
ekexium 2020-11-10 16:05:13 +08:00
parent a92f3710fe
commit 82fdf4c9e2
2 changed files with 6 additions and 1 deletions

View File

@ -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;
}

View File

@ -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>;