pub trait RestApiCapability: Send + Sync {
// Required method
fn register_rest(
&self,
ctx: &GearCtx,
router: Router,
openapi: &dyn OpenApiRegistry,
) -> Result<Router>;
// Provided method
fn healthcheck(&self, _ctx: &GearCtx) -> Option<Arc<dyn Healthcheck>> { ... }
}Expand description
REST API capability: Pure wiring; must be sync. Runs AFTER DB migrations.
Required Methods§
Sourcefn register_rest(
&self,
ctx: &GearCtx,
router: Router,
openapi: &dyn OpenApiRegistry,
) -> Result<Router>
fn register_rest( &self, ctx: &GearCtx, router: Router, openapi: &dyn OpenApiRegistry, ) -> Result<Router>
Provided Methods§
Sourcefn healthcheck(&self, _ctx: &GearCtx) -> Option<Arc<dyn Healthcheck>>
fn healthcheck(&self, _ctx: &GearCtx) -> Option<Arc<dyn Healthcheck>>
Readiness healthcheck for this gear, run on every /readyz and /health.
None (default) opts out.
Return one composite check per gear that aggregates the gear’s critical
dependencies, rather than many fine-grained probes — the aggregate is what decides
whether the pod stays in traffic. External SaaS/LLM dependencies should usually not
gate readiness: a provider outage would evict every pod from rotation and take the
whole service down. Report such dependencies as degraded (kept in rotation), reserving
unhealthy for failures the gear itself cannot serve through.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".