Repository navigation
Share Session transaction procedures through sessions and sessionpg - #330
Merged
Merged
Conversation
Cancellation, Environment failure and termination, the input-activity bracket, the admission gates and dedicated device creation become sessions procedures over the transaction interfaces they declare, with pure decisions and explicit post-update loads. sessionpg adds LockSession, WithSession (lock, apply, prune on a pgunit.Transactor), the SessionTx binding from BindSession, which writes only its own Session's Environment, LoadEnvironmentInput and the row helpers. store's private helpers become direct calls; lock order, error precedence, event order and rollback are unchanged.
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.
Several Session operations repeat the same multi-step sequences: cancelling a Turn, failing or terminating an Environment, and bracketing input activity. This change writes each sequence once, as a procedure in
sessions, over a minimal transaction interface. The PostgreSQL side implements those interfaces insessionpgas named participants, so later PRs can compose them inside their own transactions. For example, deployment's allocation cleanup can run Environment termination in its own transaction.What changes
sessionsprocedures and rules:CancelTurn,CancelWorkandDecideCancellation.FailEnvironment,TerminateEnvironmentand the termination decision.TrackInputActivity.CreateEnvironmentDevice: load, then the binding rule, then an insert-only apply.CheckComputeAdmission,CheckFileWriteGateandCheckInputStart.JournalTxandActiveTurnTx.sessionpg:LockSessionandWithSessionare the single transaction shape for a locked Session.BindSession(q, tenant, session)returns aSessionTxthat implements the procedure interfaces on a transaction-bound*sqlc.Queries.pgunit.Transactorreplaces store's private transactor.RecordEnvironmentFailureandExpireSessionEnvironmentcheck both.IMPLEMENTATION.mdlists the permitted participants (LockSession,BindSession) and the import direction.Behavior
Unchanged, except for one case. Expiring or settling an Environment now normalizes its stored configuration through
EnvironmentFromRow, as failed initialization already did. This affects only corrupt stored data.Checks
go build ./...andgo vet ./services/core/....sessionsandsessionpgin full, including:-runsubset: devices, runtime allocation, Environment termination and failure, initialization failure detail, file writes, runtime nodes, archive, deletion and cancellation.scripts/check-names.py.A blind review found no blockers or majors. Its minor findings are fixed in this commit.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.