~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/pds.js

An atproto PDS in JavaScript, for Cloudflare Workers and Node

0
0
main
23 lines · 1.1 KB Raw History

'@pdsjs/core': patch '@pdsjs/cloudflare': patch

Repo writes for one account run one at a time. createRecord, putRecord, deleteRecord and applyWrites hold a repo lock from reading the record they change through the commit. createCommit, emitEvent, emitSyncEvent and rebuildMst take the same lock. Without it, two commits could build on the same head and share a since whenever a commit waited on real I/O between reading the head and writing the next one. A swapRecord check could also pass for two writes at once.

deleteRecord reaps only the blobs that the deleted record held, and only those uploaded before the delete started. It reaped every orphan, so it could delete a blob that a client had uploaded for a record not yet written. reapOrphanedBlobs takes an optional list of the blobs to consider.

Cloudflare: blob writes to one R2 key run one at a time. A put skips a key that R2 already holds, since the key is the blob's CID. A write that R2 refuses with error 10058 is tried again after a delay. Clients that uploaded the same bytes at once got 500 errors from R2's limit on concurrent writes to one object.