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 bt;
23mod clock;
24mod epoch;
25mod timestamp;
26
27pub mod docs;
28
29pub use allocator::{Allocator, CoreError, WindowGrant};
30pub use bt::Bt;
31pub use clock::{Clock, SystemClock};
32pub use epoch::Epoch;
33pub use timestamp::{LOGICAL_MAX, PHYSICAL_MS_MAX, Timestamp, TimestampError};
34
35#[cfg(any(test, feature = "test-clock"))]
36pub use clock::testing;