hn.today

Strictly monotonic timestamps and gapless sequences in Rust

tsoracle.rs3 points0 comments
Screenshot of Strictly monotonic timestamps and gapless sequences in Rust

tsoracle is a Rust service for issuing identifiers across distributed systems. Its timestamp-oracle API returns integers that are strictly increasing globally, supporting uses such as ordering database transactions, combining changes from multiple shards, and maintaining audit logs. Unlike per-machine clocks or independent database sequences, it relies on replicated consensus. The project also offers gapless sequences through a separate API: each named counter produces contiguous values for needs such as invoice numbers, order IDs, and ledger entries. These sequences are durable across crashes and failover, but their stronger guarantee has a cost: an ambiguous request failure is reported as SeqUncertain rather than retried automatically, because the counter may already have advanced.

The service allocates batches so clients can issue IDs locally after a single request. Before a timestamp range or sequence block is returned, the leader persists the new high-water mark and replicates it to followers, preventing restarts from reusing values. Production consensus drivers for OpenRaft and OmniPaxos are included, alongside a pluggable driver interface, gRPC client, metrics, and options to run a standalone binary or embed the server in a Rust application. The project describes fuzzing, crash-injection tests, and stress testing across both consensus backends. It is open source under Apache-2.0, with published crates and container deployment options; its documentation and contribution guidance cover architecture, operations, testing, and reporting issues.

Read on tsoracle.rs0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Aristotle Expands into Rust

Aristotle has expanded its formal verification platform to Rust, allowing developers to prove code meets specifications and contains no undefined behavior, including in unsafe blocks. It can also verify that Rust rewrites behave like their original C code, targeting critical software such as smart contracts and infrastructure. (harmonic.fun)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.