unitycatalog_server/lib.rs
1//! The Unity Catalog REST API server.
2//!
3//! This crate implements the Unity Catalog REST surface as a set of `axum`
4//! routers over three pluggable dependencies, injected as trait objects:
5//!
6//! - a [`ResourceStore`](store::ResourceStore) — the persistence backend
7//! (in-memory, `unitycatalog-postgres`, or `unitycatalog-sqlite`);
8//! - a [`Policy`](policy::Policy) — the authorization decision point; and
9//! - a [`CommitCoordinator`](unitycatalog_delta_api::coordinator::CommitCoordinator)
10//! — the Delta catalog-managed commit backend.
11//!
12//! [`ServerHandler`](services::ServerHandler) composes those dependencies. It is
13//! generic over an authorization context `Cx` (the identity or request state a
14//! [`Policy`](policy::Policy) evaluates against), cheap to clone, and satisfies
15//! the store and policy traits by delegation — so the generated handler traits in
16//! [`api`] can be blanket-implemented over it. To swap a backend, construct the
17//! handler with a different trait object; no handler code changes.
18//!
19//! # Layout
20//!
21//! - [`api`] — per-resource handler traits (generated) plus their hand-written
22//! business logic, and the [`SecuredAction`](api::SecuredAction) permission
23//! mapping.
24//! - [`policy`] — the [`Policy`](policy::Policy) authorization trait,
25//! [`Permission`](policy::Permission)/[`Decision`](policy::Decision), and the
26//! allow-all [`ConstantPolicy`](policy::ConstantPolicy).
27//! - [`store`] — storage-abstraction traits, re-exported from
28//! `unitycatalog-common`.
29//! - [`rest`] — the `axum` routers that expose the handlers over HTTP.
30//! - [`services`] — [`ServerHandler`](services::ServerHandler) and the
31//! `Provides*` dependency-injection traits.
32//! - [`handlers`] — reusable handler patterns (e.g. proxy leaves that forward to
33//! an upstream catalog).
34//!
35//! # Feature flags
36//!
37//! `memory` enables the in-memory store; `proxy` pulls in the upstream-forwarding
38//! handlers; `bin` adds the config/CLI/serve wiring used by the `uc-server`
39//! binary. See the crate README for the full table.
40
41pub mod api;
42mod codegen;
43pub mod error;
44pub mod handlers;
45#[cfg(feature = "memory")]
46pub mod memory;
47pub mod policy;
48pub mod rest;
49pub mod services;
50pub mod store;
51pub mod telemetry;
52
53// Deployable-binary support: config loading, the CLI/subcommand surface, and the
54// server-launch wiring used by the `uc-server` binary (see `src/main.rs`). Gated
55// behind `bin` so a plain library build doesn't pull the CLI/serve/store stack.
56#[cfg(feature = "bin")]
57pub mod cli;
58#[cfg(feature = "bin")]
59pub mod config;
60#[cfg(feature = "bin")]
61pub mod hybrid;
62#[cfg(feature = "bin")]
63pub mod run;
64
65pub use crate::error::{Error, Result};