Expand description
Axum HTTP/JSON API handlers
Modules§
Structs§
- Custom
Error 🔒 - Error
Response 🔒 - API error response — wire-compatible with the
Customvariant of the per-module error enums (node::Error::Custom,merklized_state::Error::Custom, etc.) that all of tide-disco’sError::catch_allcalls produce. Most of our migrated endpoints (catchup, submit, state-signature, light-client, node, status, config, token, database) take that path, so this envelope is byte-identical with tide’s error response for them. Endpoints that use a specific variant directly (e.g.availability::Error::FetchLeaf) emit their own shape on tide; those bytes are not matched here. - Send
Query 🔒
Enums§
- WsFormat 🔒
- Wire format for a WebSocket stream — negotiated from the upgrade request’s
Acceptheader to match tide-disco. surf-disco clients default toapplication/octet-stream, so production stream consumers expect VBS-encodedMessage::Binaryframes.
Functions§
- classify_
availability_ 🔒error - Classify an
anyhow::Errorfrom an availability handler into the appropriateApiErrorvariant. Errors produced viaAvailabilityErrorin the state implementation carry semantic meaning; everything else falls back to a 500 Internal Server Error. - create_
combined_ router - Create a combined router serving both v1 and v2 APIs
- create_
router_ v1 - Create v1 router without OpenAPI documentation (internal types)
- create_
router_ v2 - Create v2 router with OpenAPI documentation (proto types)
- decode_
body 🔒 - Decode a request body based on its
Content-Type, matching tide-disco’sbody_autobehavior. - drive_
ws_ 🔒stream - encode_
response 🔒 - Encode a successful response body based on the request’s
Acceptheader, matching tide-disco’s content negotiation. - redirect_
to_ 🔒docs - Redirect handler for root path
- rewrite_
root_ 🔒to_ v2 - Middleware to rewrite root paths to /v2 paths
- serve_
openapi_ 🔒spec - Serve the OpenAPI spec (extracted from Extension)
- serve_
swagger_ 🔒ui - Serve custom Swagger UI with collapsed defaults
- ws_
format 🔒