Skip to main content

tsoracle_server/
lib.rs

1//! gRPC server for tsoracle.
2//!
3//! Wires four pieces together:
4//! - [`tsoracle_core::Allocator`] — the sync window allocator.
5//! - A user-supplied [`tsoracle_consensus::ConsensusDriver`] — leadership
6//!   state plus durable high-water persistence.
7//! - The tonic-generated `TsoServiceServer` from `tsoracle-proto`,
8//!   mounted on `GetTs` and `GetTsBatch`.
9//! - The internal leader-watch pipeline and failover fence, which keep
10//!   timestamps strictly monotonic across leader transitions.
11//!
12//! Followers respond to RPCs with `FAILED_PRECONDITION` and a
13//! `tsoracle-leader-hint-bin` binary trailer; `tsoracle-client` consumes
14//! the hint to redirect without an extra round-trip.
15//!
16//! Use [`Server::builder`] to embed in another binary, or use the
17//! `tsoracle` CLI from `tsoracle-bin` for a standalone process. The
18//! [`docs`] module contains the docs.rs-rendered operations chapter; the
19//! repo's `docs/key-subsystems.md` covers the same internals in depth.
20
21mod fence;
22mod leader_hint;
23mod server;
24mod service;
25
26pub mod docs;
27
28pub use server::{BuildError, Server, ServerBuilder, ServerError, ServingState};
29
30#[cfg(any(test, feature = "test-fakes"))]
31pub mod test_fakes;
32
33#[doc(hidden)]
34pub use leader_hint::decode_leader_hint as __priv_decode_leader_hint;