osproxy_spi/lib.rs
1//! Public SPI traits for osproxy.
2//!
3//! This is the contract implementers compile against (`docs/02`). It depends
4//! only on [`osproxy_core`] (plus `serde_json` for body values) so the surface
5//! stays tiny and fast.
6//!
7//! Two layers:
8//!
9//! - [`RoutingSpi`], low-level, full control over the [`RouteDecision`].
10//! - [`TenancySpi`], high-level, declarative tenancy rules; `osproxy-tenancy`
11//! adapts it into a [`RoutingSpi`].
12//!
13//! Supporting vocabulary is grouped by concern: [`Principal`] identity,
14//! [`RequestCtx`] inputs, [`RouteDecision`] outputs, declarative [`rules`], and
15//! [`Placement`] results. Every public item carries an example, per NFR-Q3.
16#![deny(missing_docs)]
17
18// Re-export the core vocabulary so SPI implementers get the identifier, target,
19// and error types from a single dependency.
20pub use osproxy_core as core;
21
22mod auth;
23mod decision;
24mod error;
25mod placement;
26mod principal;
27mod request;
28mod routing;
29pub mod rules;
30mod tenancy;
31
32pub use auth::{Action, AuthError, Authenticator, Authorizer, ClientCredentials};
33pub use decision::{BodyTransform, HeaderOp, RouteDecision};
34pub use error::SpiError;
35pub use placement::{MigrationPhase, Placement, PlacementAt};
36pub use principal::{Principal, PrincipalAttr};
37pub use request::{BodyDoc, HeaderView, HttpMethod, Protocol, RequestCtx};
38pub use routing::RoutingSpi;
39pub use rules::{
40 DocIdRule, IdTemplate, InjectedField, InjectedValue, JsonPath, PartitionKeySpec,
41 PartitionKeySpecKind, SensitivitySpec,
42};
43pub use tenancy::TenancySpi;