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§
- Blob
Stream 🔒 - A blob on its way out, a chunk at a time.
Constants§
- BLOB_
CONTENT_ 🔒SECURITY_ POLICY - The content security policy every
com.atproto.sync.getBlobanswer 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.getBlobcalls 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-Lengthdeclared. atproto’s blob specification: “If the actual blob upload size differs from theContent-Lengthheader, 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