Skip to main content

graphrt_provider_api/
lib.rs

1//! # graphrt-provider-api
2//!
3//! The contract between the graphrt gateway and the platforms it wakes agents
4//! on (plan §6). Every provider (local-process, Kubernetes, Cloud Run, Azure
5//! Container Apps, ECS Fargate, Lambda, Fly) lives in its own crate or module
6//! behind its own cargo feature and implements:
7//!
8//! - [`Provider`]: run-time `wake` / `release` / `list`, with [`Capabilities`]
9//!   that tell the gateway how to drain and when to preempt;
10//! - [`DeployDriver`]: deploy-time `apply` of a [`DeploymentSpec`].
11//!
12//! The crate also carries the one HTTP layer providers share ([`http`]: a
13//! token bucket per provider API, jittered retry of 429/5xx, token caching with
14//! one refresh on 401; the reqwest client is behind feature `http`) and, behind
15//! feature `conformance`, the C1–C13 suite with a scripted fake HTTP server
16//! and an in-memory reference provider ([`conformance`]).
17//!
18//! No cloud SDK is used anywhere: REST and auth are hand-rolled per provider.
19//!
20//! ```
21//! use graphrt_provider_api::{Addressing, ProviderError, ProviderErrorKind};
22//!
23//! assert_eq!(ProviderError::kind_for_status(429), ProviderErrorKind::RateLimited);
24//! assert!(ProviderErrorKind::Transient.is_retryable());
25//! assert_ne!(Addressing::Replica, Addressing::Url);
26//! ```
27
28#[cfg(feature = "conformance")]
29pub mod conformance;
30mod error;
31pub mod http;
32pub mod invoke;
33mod provider;
34mod types;
35
36pub use error::{DeployError, DeployErrorKind, ProviderError, ProviderErrorKind};
37pub use invoke::{ByteStream, InvokeRequest, InvokeResponse};
38pub use provider::{BoxFuture, DeployDriver, Provider};
39pub use types::{
40    Addressing, Capabilities, DeploymentRef, DeploymentSpec, Endpoint, EndpointAddress, ReleaseMode, ReplicaPhase,
41    ReplicaRef, ReplicaState, Resources, Scaler, SecretRef,
42};