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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
//! # solti-api
//!
//! Public task transports for a Solti agent.
//!
//! HTTP uses the model-owned CRD JSON representation.
//! gRPC uses versioned protobuf messages.
//! Both transports delegate domain operations to one [`ApiHandler`].
//!
//! This crate does not store or execute tasks.
//!
//! ## Start Here
//!
//! Use [`ApiHandler`] to define the transport-independent backend.
//! Use `SupervisorApiAdapter` to connect that boundary to `solti-core`.
//! Use `HttpApi` to build a standalone axum router or mount documented routes
//! into an application router.
//! Use `GrpcApi` to build a tonic service.
//!
//! ## Flow
//!
//! ```text
//! HTTP CRD JSON ── parse and validate ──┐
//! ▼
//! ApiHandler
//! ▲
//! gRPC v1 DTO ── convert and validate ──┘
//! └──► custom backend or solti-core
//! ```
//!
//! The transports own wire validation, authentication, metrics, and error mapping.
//! The handler owns task operations.
//!
//! ## Desired State
//!
//! The bundled adapter commits desired state before reconciliation finishes.
//! A successful create or apply does not mean that execution has started.
//! Clients observe reconciliation through `status.conditions[type=Reconciled]`.
//!
//! Apply is an upsert without write preconditions.
//! Apply and delete can check `uid` and `resourceVersion`.
//!
//! ## Collections and Streams
//!
//! Lists use opaque continuation tokens.
//! The bundled adapter provides snapshot-consistent pagination.
//! Watches can resume from a retained resource version.
//!
//! Task output is live-only and lossy.
//! It is not persisted or replayed.
//! A slow subscriber receives a `Lagged` event.
//!
//! ## Workload Boundary
//!
//! The built-in `Embedded` workload is available only through the in-process SDK.
//! HTTP and gRPC reject it.
//! Extension workloads remain visible.
//!
//! ## Feature Flags
//!
//! | Feature | Capability |
//! |----------------|-------------------------------------------------|
//! | `core-adapter` | `SupervisorApiAdapter` for `solti-core` |
//! | `grpc` | tonic gRPC service and generated current client |
//! | `grpc-tls` | `solti-tls` adapter for tonic; implies `grpc` |
//! | `http` | axum HTTP/JSON router |
//!
//! No feature is enabled by default.
//!
//! ## Main Types
//!
//! | Area | Types |
//! |---------------|-------------------------------------------------------------|
//! | Handler | [`ApiHandler`], [`ApiError`] |
//! | Streams | [`TaskWatchEventStream`], [`OutputEventStream`] |
//! | Metrics | [`ApiMetricsBackend`], [`ApiMetricsHandle`], [`Transport`] |
//! | HTTP | `HttpApi`, `HttpApiParts` |
//! | gRPC | `GrpcApi`, `grpc::wire` |
//! | Core adapter | `SupervisorApiAdapter` |
//!
//! ## Quick Start
//!
//! Build both transports from one handler:
//!
//! # use std::sync::Arc;
//! # use solti_api::{GrpcApi, HttpApi, SupervisorApiAdapter};
//! # fn wire(supervisor: Arc<solti_core::SupervisorApi>) {
//! let handler = Arc::new(SupervisorApiAdapter::new(supervisor));
//! let grpc = GrpcApi::new(handler.clone()).server();
//! let http = HttpApi::new(handler).build();
//! # let _ = (grpc, http.router, http.openapi);
//! # }
//! ```
/// Compiles the runnable Rust code blocks in `README.md` as doctests.
///
/// Gated on every feature: the README examples cover both transports and TLS.
;
/// Compose a compile-time Kubernetes named-group URL rooted at `/apis/solti.io/v<API_MAJOR>`.
/// Current public API major version.
pub const API_VERSION: u32 = TASK_API_VERSION_MAJOR;
/// Current public API version name.
pub const API_VERSION_NAME: &str = concat!;
/// Current gRPC package exposed by the agent.
pub const GRPC_API_PACKAGE: &str = concat!;
/// Current gRPC service exposed by the agent.
pub const GRPC_API_SERVICE: &str = concat!;
/// Root path of the HTTP Kubernetes API group.
pub const HTTP_API_ROOT: &str = api_url!;
/// Maximum HTTP request body and gRPC message size.
///
/// The limit is 4 MiB.
pub const MAX_REQUEST_BYTES: usize = 4 * 1024 * 1024;
pub use ;
pub use ;
pub use SupervisorApiAdapter;
pub use ;
// Generated prost output carries no doc comments; suppress the doc
// lints on this module only. Never suppress them crate-wide.
pub
pub use GrpcApi;
pub use tonic;
pub use ;
pub use axum;
pub use aide;
pub use to_tonic_server_tls;