Repository navigation
Move function calls and results into sessions and sessionpg - #333
Merged
Merged
Conversation
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.
Function calls and results move out of
storeintosessionsandsessionpg. This PR also introduces the lease-bound Session execution skeleton.What changes
sessions.ExecutionOperationswithExecutionStorage { FunctionExecution }.sessionpg.Execution{lease}.execution.Owner.Sessions.Dispatcher.Bind(owner): StartWorker binds through it, and a Dispatcher that runs Turns outside a Worker binds the same way. The Session execution operations are unexported on the Dispatcher.RecordFunctionCall,PendingFunctionCallsandConfirmFunctionResultrun on the lease under the Session lock.sessionsrules, then applies. The Turn status change and its journal entries are settled in the same order as before.sessions.AdmitFunctionResultis a procedure over a four-method Tx thatsessionpg.BindSessionimplements. It runs inside the public SubmitInputs transaction.LoadRequiredActionsis the lock-free snapshot read used by scheduling.store:function_calls.go,function_inputs.go,function_results.goandfunction_state.go;GetFunctionCall/SubmitFunctionResult. Tests now submit results through the public tool_result input.IMPLEMENTATION.mdandsessions/doc.goname the new owners.Behavior
Unchanged. The api mapping and precedence are the same for
ErrFunctionCallTurnMismatch,ErrUnknownFunctionCallandErrFunctionResultConflict, and so are idempotent replay, the pending order and the conflict rules.Checks
go build ./...andgo vet ./services/core/....sessionsandsessionpgin full. The PostgreSQL tests cover rollback, a concurrent single winner, scoping, a closed lease and the ownership handoff.-run '^(TestStartWorker|TestWorkerRun|TestFunction|TestSandboxReset|TestSandboxDeploymentDrain|TestCommittedResetView|TestFinishRun)'.cmd/server, and the api function and tool_result tests.scripts/check-names.pyandmake check-docs.A blind review found one blocker (an unbound Dispatcher in a store test) and three minor issues. All are fixed in this commit.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.