Skip to main content

upload

Function upload 

Source
pub async fn upload(
    __arg0: State<State>,
    __arg1: Path<String>,
    headers: HeaderMap,
    __arg3: Extension<i64>,
    body: Body,
) -> Result<impl IntoResponse>
Expand description

Handles streaming asset uploads (POST /api/v1/upload/{tag}).

This endpoint processes raw binary streams from the client, calculates the BLAKE3 hash incrementally, and commits the file to the Content-Addressable Storage (CAS) vault. The uploaded file’s metadata is then recorded in the database.

§Errors

  • Returns a BadRequest if required headers (X-File-Name, Content-Length) are missing or malformed.
  • Returns a BadRequest if the payload size exceeds the 10GB limit.
  • Returns an internal error if the storage transaction or database insertion fails.