Skip to main content

RestBackend

Trait RestBackend 

Source
pub trait RestBackend:
    Send
    + Sync
    + 'static {
    // Required methods
    fn compatibility_report(&self) -> RestFuture<CompatibilityReport>;
    fn run_text_turn(
        &self,
        request: RestTextTurnRequest,
    ) -> RestFuture<RestTextTurnResponse>;

    // Provided methods
    fn create_session(
        &self,
        _request: RestSessionCreateRequest,
    ) -> RestFuture<RestSessionCreateResponse> { ... }
    fn list_sessions(&self) -> RestFuture<Vec<RestSessionSummary>> { ... }
    fn delete_session(
        &self,
        session_id: String,
    ) -> RestFuture<RestStatusResponse> { ... }
    fn call_method(
        &self,
        request: RestCallRequest,
    ) -> RestFuture<RestCallResponse> { ... }
    fn poll_event(
        &self,
        session_id: String,
        timeout_ms: Option<u64>,
    ) -> RestFuture<RestEventResponse> { ... }
    fn reply_request_result(
        &self,
        session_id: String,
        request_key: String,
        body: RestRequestReplyResultRequest,
    ) -> RestFuture<RestRequestReplyResponse> { ... }
    fn reply_request_error(
        &self,
        session_id: String,
        request_key: String,
        body: RestErrorReplyRequest,
    ) -> RestFuture<RestRequestReplyResponse> { ... }
}
Expand description

Backend used by the REST router.

The default crate::rest::CodexRestBackend talks to real codex app-server processes. Tests and host applications can inject their own backend with crate::rest::router_with_backend to control process lifecycle, pooling, or policy.

Required Methods§

Provided Methods§

Implementors§