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