Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions crates/types/src/clock/unique_timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,22 @@ impl UniqueTimestamp {
Ok(Self(nz))
}

/// Compare the physical clock of both timestamps and ignore the logical clock.
///
/// Note that this has millisecond precision.
pub fn cmp_physical(&self, other: &Self) -> std::cmp::Ordering {
self.physical_raw().cmp(&other.physical_raw())
}

pub fn as_u64(&self) -> u64 {
self.0.get()
}

/// Fails if the resulting timestamp is out of range
pub fn add_millis(&self, millis: u64) -> Result<Self, Error> {
Self::from_parts(self.physical_raw() + millis, self.logical_raw())
}

#[inline(always)]
fn physical_raw(&self) -> u64 {
// extract the physical time
Expand Down
3 changes: 2 additions & 1 deletion crates/vqueues/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ futures = { workspace = true }
hashbrown = { version = "0.16" }
pin-project = { workspace = true }
rocksdb = { workspace = true }
slab = { version = "0.4" }
smallvec = { workspace = true }
strum = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["sync"] }
tokio-stream = { workspace = true }
tokio-util = { workspace = true, features = ["time"] }
tokio-util = { workspace = true }
tracing = { workspace = true }
Loading
Loading