Skip to main content

osproxy_core/
lib.rs

1//! Core data model for osproxy.
2//!
3//! This crate is the shared vocabulary every other crate speaks. It has **no
4//! I/O dependencies** (no async runtime, no sockets, no wire serialization) so
5//! the surface an SPI implementer compiles against stays tiny and fast, see
6//! `docs/01-architecture.md` §2.
7//!
8//! It contains three things:
9//!
10//! - [`ids`], strongly-typed identifier newtypes (no bare `String`/`u64`
11//!   identifiers cross API boundaries, `docs/08` §7).
12//! - [`endpoint`], the [`endpoint::EndpointKind`] classification of OpenSearch
13//!   requests (`docs/02` §5).
14//! - [`error`], the request-path [`error::ErrorContext`] taxonomy that makes
15//!   every failure typed, contextual, and LLM-diagnosable (`docs/02` §4).
16//! - [`time`], the [`time::Clock`] seam that keeps time deterministic and
17//!   testable (`docs/12`).
18//! - [`target`], the [`target::Target`] a routing decision resolves to
19//!   (`docs/02`).
20//! - [`trace`], the [`trace::TraceContext`] W3C propagation primitive that
21//!   carries distributed-trace identity to downstream calls (`docs/05` §2).
22//! - [`json`], a dependency-free byte-level JSON scanner that reads partition
23//!   keys and id components straight from a body without materializing a tree
24//!   (ADR-014), shared by the SPI extraction utilities and the transform layer.
25//!
26//! The module tree is intentionally flat and small; each concept lives in its
27//! own file (`docs/08` §2).
28#![deny(missing_docs)]
29
30pub mod cursor;
31pub mod endpoint;
32pub mod error;
33pub mod ids;
34pub mod json;
35pub mod target;
36pub mod time;
37pub mod trace;
38
39pub use cursor::CursorSigner;
40pub use endpoint::EndpointKind;
41pub use error::{ErrorCode, ErrorContext};
42pub use ids::{ClusterId, Epoch, FieldName, IndexName, PartitionId, PrincipalId, RequestId};
43pub use json::JsonError;
44pub use target::Target;
45pub use time::{Clock, Instant, ManualClock, SystemClock};
46pub use trace::TraceContext;