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§

Structs§

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

Functions§

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

Type Aliases§

  • Helper type alias that defaults the error type to AppError