Skip to main content

Module blobs

Module blobs 

Source
Expand description

The three blob methods, and the streaming that keeps them honest.

com.atproto.repo.uploadBlob, com.atproto.sync.getBlob and com.atproto.sync.listBlobs. What is here rather than in crate::routes is everything to do with a body that does not fit in a Bytes: an upload is consumed a frame at a time and handed straight to the store, and a download is a stream over an open file. Neither direction ever holds a whole blob.

§Which repository an upload is for

com.atproto.repo.uploadBlob takes no parameters. In atproto the account comes from the request’s authentication, and now that this route has one — see Credential::AccountToken — that is exactly where it comes from: the DID auth::require_agent_token_or_dpop resolves is the repository, with no separate field to disagree with it. This used to arrive in a didbot-repo header, back when there was no session to take it from; plan/auth-types.md names that header as the thing that “comes out the moment a session exists”, and this is that moment.

Structs§

BlobStream 🔒
A blob on its way out, a chunk at a time.

Constants§

BLOB_CONTENT_SECURITY_POLICY 🔒
The content security policy every com.atproto.sync.getBlob answer carries.
BLOB_READAHEAD 🔒
How many chunks the reading task may run ahead of the socket.
CHUNK 🔒
How much of a blob is read from the store per chunk on the way out.

Statics§

BLOB_READ_CONCURRENCY 🔒
How many com.atproto.sync.getBlob calls may hold a blocking-pool thread at once, across every caller.

Functions§

blob_error
Maps a blob failure onto the error name a client switches on.
get_blob
GET /xrpc/com.atproto.sync.getBlob
length_differs 🔒
The answer to an upload body that is not the length its Content-Length declared. atproto’s blob specification: “If the actual blob upload size differs from the Content-Length header, the server should reject the upload.” A body that runs past its length is refused at the frame that runs past it, and no later frame is read.
list_blobs
GET /xrpc/com.atproto.sync.listBlobs
serve_blob 🔒
get_blob’s answer, before its content security policy.
upload_blob
POST /xrpc/com.atproto.repo.uploadBlob