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// Panic policy (see CONTRIBUTING.md). `cfg_attr(not(test), ...)` skips the lint
13// for the lib's own unit tests; integration tests are separate compilation units.
14#![cfg_attr(not(test), warn(clippy::unwrap_used, clippy::expect_used))]
15//!
16//! Followers respond to RPCs with `FAILED_PRECONDITION` and a
17//! `tsoracle-leader-hint-bin` binary trailer; `tsoracle-client` consumes
18//! the hint to redirect without an extra round-trip.
19//!
20//! Use [`Server::builder`] to embed in another binary, or use the
21//! `tsoracle` CLI from `tsoracle-bin` for a standalone process. The
22//! [`docs`] module contains the docs.rs-rendered operations chapter; the
23//! repo's `docs/key-subsystems.md` covers the same internals in depth.
24
25#[macro_use]
26mod failpoint;
27mod fence;
28mod leader_hint;
29mod server;
30mod service;
31
32pub mod docs;
33
34pub use server::{BuildError, Server, ServerBuilder, ServerError, ServingState};
35
36#[cfg(any(test, feature = "test-fakes"))]
37pub mod test_fakes;
38
39#[cfg(any(test, feature = "test-support"))]
40pub mod test_support;
41
42#[doc(hidden)]
43pub use leader_hint::decode_leader_hint as __priv_decode_leader_hint;