Skip to main content

RestApiCapability

Trait RestApiCapability 

Source
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§

Source

fn register_rest( &self, ctx: &GearCtx, router: Router, openapi: &dyn OpenApiRegistry, ) -> Result<Router>

Register REST routes for this gear.

§Errors

Returns an error if route registration fails.

Provided Methods§

Source

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".

Implementors§