Repository navigation
refactor(global): the host's tables, content and the sweep stand behind ports - #307
Merged
rami-hatoum merged 3 commits intoOct 23, 2026
Conversation
rami-hatoum
force-pushed
the
refactor/the-hosts-tables-content-and-sweep-stand-behind-ports
branch
from
October 23, 2026 17:15
fb45e61 to
90d96d3
Compare
… of the ledger it is given The workflow host opened its tables itself, on a SQLite file through the native addon or on PostgreSQL, though they must sit in the ledger's own database, which the ledger has already opened. The ledger's layers now provide, beside Ledger, the connection of the ledger, LedgerConnection: the dialect it speaks, an event store over its connections for streams kept beside the ledger, and read, write, transaction, readConsistently, sharedClock and migrated. On SQLite it runs on the ledger's one pool; on PostgreSQL its statements run on a pool of four the ledger keeps for them and its streams on the ledger's own pool. The host's store takes that connection, whatever store it is, and runs its statements, its leases, its snapshot chunks and its run logs through it. The host opens, closes and loads no database of its own, and its driver dependencies go. The server reads the connection from its runtime and hands it to the host's store; the host's own report of a lost connection goes with its pools, since its connections are the ledger's, which logs those it loses. A private database in memory is now one database for the ledger and the host. The tests and the measurements open a ledger on the settings of a database and the host over its connection, through src/ledger-testing; the tests of the PostgreSQL statements, the snapshots and the statement move to the ledger with the code they test. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…p speak to a bucket port Content kept outside the ledger was built directly on an S3 client, so a store of content that is not S3 had no port to stand behind. The package now names a Bucket port: put, of bytes in hand, conditional on the key being absent, of a stream, or of another object of the bucket; get, which streams the object's body; head; delete; list by prefix; and unfinished, the puts of a stream that never finished, each with its abandon. bucketOnS3 is its one implementation, over the S3 client, and sends the requests the adapter sent before. objectContentOn keeps content on any bucket: its puts, reads, staging and sweep of uploads speak to the port alone, and the digest of what is read back stays the content store's. Beside put, get, head, delete and list, the port copies, since a content larger than one chunk is uploaded before its digest is known and moves under its digest without sending its bytes again, and names the puts that never finished, since an interrupted multipart upload is no object a listing finds and the sweep aborts it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…'s clock calls The hourly sweep of orphaned content was forked by the ledger on a clock of its own. It is now a chore, sweepOrphans(now), which sweeps what puts that never finished left an hour before now and answers the next time it is due, an hour on, logging a sweep that fails as before; nothing in the ledger forks a timer. Both layers provide it beside Ledger and the connection, as LedgerChores, and a close still waits for a sweep under way. The workflow host performs a chore as due work of its wake-up, choreWork: at the first wake-up, then whenever the chore answered it is due, in the lane no wake-up waits for. The server reads the ledger's chores from its runtime and hands the host the sweep so. The host that holds the database's workflows now sweeps for every server on the database, where every server swept it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
rami-hatoum
force-pushed
the
refactor/the-hosts-tables-content-and-sweep-stand-behind-ports
branch
from
October 23, 2026 17:36
90d96d3 to
ae6398e
Compare
rami-hatoum
deleted the
refactor/the-hosts-tables-content-and-sweep-stand-behind-ports
branch
October 23, 2026 18:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Three places where a store was bound to one way of reaching it.
LedgerConnectionbeside theLedger, with its dialect, streams, reads, writes, transactions, consistent reads and clock, and the host runs every statement through it; the host opens, closes and loads no database of its own, its driver dependencies are gone, and the SQLite and PostgreSQL code it held moved into the ledger with its tests. A server holds 14 PostgreSQL connections instead of 24.Bucketport,putwith copy, streamingget,head,delete,listandunfinished, whose one implementation sends the same S3 commands as before.sweepOrphans(now)now sweeps and answers when it is next due, and the host runs it as part of its wake-up, so only the server holding the workflows sweeps, and closing the ledger still waits for a sweep under way.Tests
pnpm checkpasses on each commit, with the PostgreSQL suites running.