Skip to content

Commit 701c5d7

Browse files
committed
[Util] Introducing RoughTimestamp for second-level granularity timestamps
This timestamp type is intended to be used for invocation scheduling and the `RunAt` field of vqueues. While it's internally represented as 4-byte integer, it'll be serialized as u63 (yes, missing one bit) in EntryKey. This is done to allow future expansion of the granularity if needed. The granularity is chosen to be second-level to (a) reflect the realistic expecations of invocation scheduling and (b) to allow invocations in queues to be reordered dynamically withing a single-second window based on their sequence ordering. Some helpers in this type are not used (floor_to_minute, smear_to_minute) but are kept for future use if we need to use this type for coarse jittering or if we need to expand the window-bucketing further.
1 parent 5560b2f commit 701c5d7

File tree

4 files changed

+471
-1
lines changed

4 files changed

+471
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/clock/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ restate-workspace-hack = { workspace = true }
1717
restate-encoding = { workspace = true }
1818

1919
bilrost = { workspace = true }
20-
libc = { version = "0.2" }
2120
jiff = { workspace = true, optional = true }
21+
libc = { version = "0.2" }
2222
prost-types = { workspace = true, optional = true }
23+
rand = { workspace = true }
2324
schemars = { workspace = true, optional = true }
2425
serde = { workspace = true }
2526
thiserror = { workspace = true }

crates/clock/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
mod hlc;
1313
#[cfg(feature = "test-util")]
1414
mod mock_clock;
15+
pub mod rough_ts;
1516
#[cfg(feature = "hlc")]
1617
pub mod storage;
1718
pub mod time;

0 commit comments

Comments
 (0)