tsoracle_core/lib.rs
1//
2// ░▀█▀░█▀▀░█▀█░█▀▄░█▀█░█▀▀░█░░░█▀▀
3// ░░█░░▀▀█░█░█░█▀▄░█▀█░█░░░█░░░█▀▀
4// ░░▀░░▀▀▀░▀▀▀░▀░▀░▀░▀░▀▀▀░▀▀▀░▀▀▀
5//
6// tsoracle — Distributed Timestamp Oracle
7//
8// Copyright (c) 2026 Prisma Risk
9// Licensed under the Apache License, Version 2.0
10// https://github.com/prisma-risk/tsoracle
11//
12
13//! Core algorithm for tsoracle.
14//!
15//! No I/O, no async, no tokio. Runtime-neutral. Property-testable in microseconds.
16
17// Panic policy (see CONTRIBUTING.md). `cfg_attr(not(test), ...)` skips the lint
18// for the lib's own unit tests; integration tests are separate compilation units.
19#![cfg_attr(not(test), warn(clippy::unwrap_used, clippy::expect_used))]
20
21mod allocator;
22mod clock;
23mod epoch;
24mod timestamp;
25
26pub mod docs;
27
28pub use allocator::{Allocator, CoreError, WindowGrant};
29pub use clock::{Clock, SystemClock};
30pub use epoch::Epoch;
31pub use timestamp::{LOGICAL_MAX, PHYSICAL_MS_MAX, Timestamp, TimestampError};
32
33#[cfg(any(test, feature = "test-clock"))]
34pub use clock::testing;