Expand description
Experimental Rust API for native CCF applications.
A registration function installs endpoint handlers on a Registry, and
export_app! exports it to CCF. Each handler call receives a
ReadOnlyContext or WriteContext, which gives access to the request,
the response and raw-byte KV maps in the call’s transaction. See
samples/apps/basic_rust in the CCF repository for a complete application.
Handlers may run concurrently, and may be re-executed after a transaction
conflict (see RetrySafeHandler). KV writes are applied only if the
response status is 2xx. A handler returns an EndpointError to send an
error response, and ? on a BridgeResult sends HTTP 500. Panics are
caught and also sent as HTTP 500, which requires panic = "unwind".
Macros§
- export_
app - Export
register, afn(&mut Registry) -> BridgeResult<()>, as the application’s entry point.
Structs§
- Endpoint
Error - Error response returned by a handler.
- Map
- Read-write access to a raw-byte KV map, from
WriteContext::map. - Read
Only Context - Request, response and read-only KV access for one call of a
Registry::read_onlyhandler. - Read
Only Map - Read-only access to a raw-byte KV map, from
ReadOnlyContext::map. - Registry
- Endpoint registry, passed to the function exported with
export_app!. - Write
Context - Request, response and read-write KV access for one call of a
Registry::read_writehandler.
Enums§
- Auth
- Authentication policy for an endpoint.
- Bridge
Error - Failure of an SDK call into CCF.
Traits§
- Codec
- Optional conversion between application values and KV bytes.
- Retry
Safe Handler - Marker trait for endpoint handlers, which CCF may re-execute.
Type Aliases§
- Bridge
Result - Result of an SDK call into CCF.
- Endpoint
Result - Result of a handler:
Okkeeps the response set by the handler, andErrreplaces it with an error response.