The repository's records
The com.atproto.repo methods: createRecord, putRecord, deleteRecord,
applyWrites, getRecord, listRecords and describeRepo. What every
method shares, and how the server is checked, is in The PDS: accounts and their records.
The repository is an atproto repository as atproto's Repository spec defines
it: records in an MST, encoded as DAG-CBOR (atproto's Data Model spec), in
signed version 3 commits (atproto's Cryptography spec), served from getRepo
as a CAR file (Sync and the firehose). A record of a type whose lexicon the server
knows is checked against it, as Records against their lexicons says, which
also says what validate and validationStatus are, and what
createRecord of a like, repost, follow or block that duplicates another
deletes.
What the reference does that the specs leave open
Section titled “What the reference does that the specs leave open”listRecordslists newest first, by record key descending;reverse: truelists in key order. It answers acursorwhenever the page has records, not only when it is full.getRecordandlistRecordscheck the syntax ofcollectionandrkeyfirst: a bad one is400 InvalidRequest, notRecordNotFound.- A record without
$typeis stored with$typeset to its collection, which is part of what its CID covers. A$typeother than the collection is400 InvalidRequest, as are values outside the data model, such as floats. createRecordof a key that exists is500 InternalServerError, and so is anapplyWriteswhose update or delete names a record that does not exist.deleteRecordof a record that does not exist answers200 {}, makes no commit, and checks noswapRecord. Its answer otherwise is{commit}alone.putRecordof exactly the record already stored changes nothing: it makes no commit, answers{uri, cid, validationStatus}withoutcommit, and checks noswapRecord. AnapplyWritesupdate to exactly the record stored does make a commit.describeRepoof a repository the server does not hold is400 RepoNotFound.- An
applyWritesof more than 200 writes is400 InvalidRequest, and acreateRecord,putRecordorapplyWritesbody of more than 1000000 bytes, or adeleteRecordbody of more than 153600, is413 PayloadTooLargeError(Limits). validateis as Records against their lexicons says:trueon a record of a type the server knows no lexicon for is400 InvalidRequest, and withfalsethe write is made unchecked, and its answer, or eachapplyWritesresult, has novalidationStatus.
One thing the reference does is a fault, and the server does not copy it. In
one applyWrites, if a write gives a record exactly the content that another
write in the same batch replaces or deletes, the reference drops the first
record from its index: getRecord answers RecordNotFound and
listRecords leaves it out, though it is in the repository. The harness
keeps the values in a batch distinct, so it never sends such a batch.
How it is checked
Section titled “How it is checked”Each method’s answers are held to the reference’s, as The PDS: accounts and their records says. A record created without a key must get a TID (atproto's Timestamp Identifiers (TIDs) spec) later than the last.