Skip to main content

yeti_types/
lib.rs

1// Tests/benches use unwrap()/expect()/panic!() idiomatically; the workspace
2// lint policy is relaxed for test-cfg compilations so production code keeps
3// its strict policy. See tools/audit/policies/lint-policy.toml [[ratchet]] for context.
4#![cfg_attr(
5    test,
6    allow(
7        clippy::unwrap_used,
8        clippy::expect_used,
9        clippy::panic,
10        clippy::unwrap_in_result
11    )
12)]
13#![warn(missing_docs)]
14//! Yeti Types — Platform vocabulary crate.
15//!
16//! Defines the core traits, error types, encoding functions, and schema types
17//! that every other Yeti crate depends on. This crate has ZERO dependencies
18//! on other yeti crates.
19//!
20//! # Exports
21//!
22//! - `trait Resource` — handle(method, request, params) -> response
23//! - `trait KvBackend` — get, put, delete, scan, `get_batch`
24//! - `enum Access` — request authorization decision (closed enum,
25//!   no `dyn` dispatch); holds `Arc<User>` when authenticated
26//! - `trait AuthProvider` — `authenticate(request) -> Option<AuthIdentity>`
27//! - `trait Plugin` — plugin lifecycle (register, `on_ready`, `on_shutdown`)
28//! - `trait RequestMiddleware` — request augmentation before handlers
29//! - `struct Context` — request context (auth, table context, permission)
30//! - `struct TablePermission` — Public | `FullAccess` | `AttributeRestricted`
31//! - `struct TableDefinition` — schema-parsed table definition
32//! - `struct YetiError` / `type Result<T>` — error handling
33//! - `fn encode(T) -> Vec<u8>` / `fn decode(bytes) -> T` — storage encoding
34
35/// Error types and result aliases.
36pub mod error;
37
38/// Storage encoding (MessagePack serialize/deserialize, KeyEncoder trait).
39pub mod encoding;
40
41/// Zero-`Value` MessagePack → JSON transcoding for the read path.
42pub mod transcode;
43
44/// Content type enum and format resolution.
45pub mod content_type;
46
47/// Canonical transport identity (Transport, TransportSet).
48pub mod transport;
49
50/// Canonical GraphQL scalar registry (name → JSON type + WIT type).
51pub mod scalar;
52
53/// Schema types (TableDefinition, FieldDefinition, PublicAccess).
54pub mod schema;
55
56/// Authentication and access control traits.
57pub mod auth;
58
59/// Resource trait and supporting types.
60pub mod resource;
61
62/// Storage backend traits and types.
63pub mod backend;
64
65/// PubSub (topic-based publish/subscribe).
66pub mod pubsub;
67
68/// Platform utilities (telemetry events, path helpers).
69pub mod platform;
70
71/// Plugin traits, registration context, and the extension contracts
72/// (`tower::Service<R>` for every plugin surface — see ADR-006).
73/// Strongly-typed Request / Response types per domain (`request`,
74/// `lifecycle`, `auth`, `token`, `oauth`, `queue`, `mcp`) live in
75/// submodules.
76pub mod plugins;
77
78/// Common type aliases and newtypes.
79pub mod types;
80
81/// Canonical node identity (`{provider}-{region}-{node}-{hash}-{count}`).
82pub mod node;
83
84/// Canonical deployment address derivation — the stable,
85/// app-independent `deployment_hash` (`sha256(customer|environment)[..16]`).
86pub mod deployment;
87
88/// Weighted fair scheduling across tenants (anti-starvation).
89pub mod fairness;
90
91/// Resource execution hooks (pre/post/failure).
92pub mod hooks;
93
94/// Durable work queue types.
95pub mod queue;
96
97/// Deployment-safety declarations.
98pub mod safety;
99
100/// Hybrid Logical Clock — replication-timestamp primitive.
101/// Stamped on every entry in the per-deployment transaction log
102/// and consulted for the per-record `__hlc_meta` sidecar
103///. Configurable skew tolerance via `yeti-config.yaml`
104/// (`replication.hlc_skew_tolerance_ms`).
105pub mod hlc;
106
107/// Process-wide snapshot of registered applications. Written once
108/// by yeti-host at startup-complete; read by tooling crates that
109/// need the app list but can't depend on yeti-host (eg
110/// yeti-mcp-domain's `app_list` tool).
111pub mod app_snapshot;
112
113/// Process-wide deployment inventory — databases, apps, tables,
114/// interfaces, functions. Written once by yeti-host at
115/// startup-complete; read by yeti-mcp's `inventory_full` /
116/// `inventory_summary` tools so MCP-attached agents get the whole
117/// deployment shape in one call.
118pub mod inventory;
119
120/// Pluggable secrets backend interface — ADR-014 §5.
121pub mod secrets;
122
123/// Custom-domain TLS cert install seam (`SslCertInstaller`). The wasm
124/// host holds an `Arc<dyn SslCertInstaller>`; the concrete impl lives in
125/// `yeti-cluster` and is wired in at startup, keeping the runtime crate
126/// free of a cluster dependency.
127pub mod ssl_cert;