Crate car_mirror_axum

Source
Expand description

§car-mirror-axum

This crate exposes a very basic car mirror server. It accepts GET /dag/pull/:cid, POST /dag/pull/:cid and POST /dag/push/:cid requests with streaming car file request and response types, respectively.

It is roughly based on the car-mirror-http specification.

It also exposes some utilities with which it’s easier to build a car-mirror axum server.

At the moment, it’s recommended to only make use of the extract module, and mostly use the rest of the library for tests or treat the rest of the code as an example to copy code from for actual production use.

Modules§

extract
Axum extractor utilities

Structs§

AppError
A basic anyhow error type wrapper that returns internal server errors if something goes wrong.
ServerState
The server state used for a basic car mirror server.

Functions§

app
This will serve the routes from dag_router nested under /dag, but with tracing and cors headers.
car_mirror_pull
Handle an incoming GET or POST request for a car mirror pull.
car_mirror_push
Handle a POST request for car mirror pushes.
dag_router
Returns a router for car mirror requests with the given blockstore as well as a new 10MB cache as state.
serve
Serve a basic car mirror server that serves the routes from app with given blockstore at 127.0.0.1:3344.

Type Aliases§

AppResult
Helper type alias that defaults the error type to AppError