sessionpg

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 26 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sessionpg stores Sessions in PostgreSQL and decides nothing. WithSession runs a Session transaction: it locks the Session, runs the operation and prunes the journal. Inside a Session transaction, on its queries, the participants load the facts the sessions and items decisions read and apply what they decide: they lock the Session, allocate event sequence positions, event IDs, Item positions and output indexes, and write the public change journal, a Turn's execution journal and its counters, Items, Turn usage, Subagent bindings, child Turns and child Items, Artifact settlement, Environment state, input reservations and devices. SessionTx binds a Session to its caller's transaction for the sessions procedures. Store is the pooled adapter: it stores the sessions.Service use cases and serves the Session reads. Execution is the lease-bound adapter: it runs the sessions.ExecutionOperations transactions on the execution lease.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendChanges

func AppendChanges(ctx context.Context, q *sqlc.Queries, session pgtype.UUID, changes ...sessions.SessionChange) error

AppendChanges journals public changes in order. Each gets a new event ID and the Session's next sequence position, and commits with the caller's state. Text PostgreSQL cannot store is textvalue.ErrUnstorable.

func ApplyTurnEnd

func ApplyTurnEnd(ctx context.Context, q *sqlc.Queries, session, turn pgtype.UUID, end sessions.TurnEnd) error

ApplyTurnEnd writes what a Turn that ended settles, in the order sessions.TurnEnd lists: terminal activity, Artifacts, finished Items and then the public changes.

func CreateSessionEnvironment

func CreateSessionEnvironment(ctx context.Context, q *sqlc.Queries, session pgtype.UUID) error

CreateSessionEnvironment creates, on q, the Environment of a new Session whose configuration has one, as sessions.CreatesEnvironment decides. Its preparation is pending when the Session froze a setup or initial files, and complete otherwise, so it runs after those are saved.

func DeviceLookup

func DeviceLookup(tenantID, id string) (sqlc.GetDeviceParams, error)

DeviceLookup parses a tenant and the internal identifier of one of its resources, such as a device, Session or Environment; a malformed one is sessions.ErrInvalidInput.

func EnvironmentFromRow

func EnvironmentFromRow(row sqlc.Environment, tenant pgtype.UUID, configuration []byte, err error) (sessions.Environment, error)

EnvironmentFromRow maps a stored Environment of the tenant with its normalized configuration snapshot, from the result of the query that read it: no rows is sessions.ErrNotFound.

func LoadEnding

func LoadEnding(ctx context.Context, q *sqlc.Queries, session, turn pgtype.UUID) (sessions.Ending, error)

LoadEnding reads the facts sessions.EndTurn settles a Turn that ended with: its Items still in progress and the Session's public usage.

func LoadEnvironment

func LoadEnvironment(ctx context.Context, q *sqlc.Queries, tenant, environment string) (sessions.Environment, error)

LoadEnvironment reads, on q, the tenant's Environment of a Session that was not publicly deleted. A malformed tenant is sessions.ErrInvalidInput, and a malformed Environment ID a missing Environment, sessions.ErrNotFound. Other adapters read the Environment of their operation with it.

func LoadEnvironmentInput

func LoadEnvironmentInput(ctx context.Context, q *sqlc.Queries, session pgtype.UUID) (*sessions.EnvironmentInputState, error)

LoadEnvironmentInput reads the Session's latest Environment input reservation that no Turn has admitted or superseded, with the facts of its Environment, and nil when there is none. sessions.InputActivity projects it.

func LoadRequiredActions

func LoadRequiredActions(ctx context.Context, q *sqlc.Queries, session pgtype.UUID, turn sessions.Turn) ([]v1.FunctionCallAction, error)

LoadRequiredActions reads the required actions of the Session's Turn within the caller's snapshot, as sessions.LoadRequiredActions selects them.

func LoadUsage

func LoadUsage(ctx context.Context, q *sqlc.Queries, session pgtype.UUID) (json.RawMessage, error)

LoadUsage reads the Session's public usage: the sum of its root Turns once every one has ended with recorded usage, and null otherwise.

func LockSession

func LockSession(ctx context.Context, q *sqlc.Queries, tenant, session pgtype.UUID) (sessions.LockedSession, error)

LockSession locks the tenant's Session row, including a publicly deleted one, and returns what the lock shows. Every Session write takes this lock first, which orders input admission against completion and cancellation across service processes. A missing Session is sessions.ErrNotFound.

func PruneChanges

func PruneChanges(ctx context.Context, q *sqlc.Queries, session pgtype.UUID) error

PruneChanges drops the Session's journaled changes beyond the sessions retention bounds. Callers run it after the transaction's last change.

func SessionFromRow

func SessionFromRow(row sqlc.Session) (sessions.Session, error)

SessionFromRow maps a stored Session with its creator, normalized configuration and metadata.

func TurnFromRow

func TurnFromRow(row sqlc.Turn) sessions.Turn

TurnFromRow maps a stored Turn.

func TurnLookup

func TurnLookup(tenantID, sessionID, turnID string) (sqlc.GetTurnParams, error)

TurnLookup parses the internal identifiers of a tenant's Turn; a malformed one is sessions.ErrInvalidInput.

func WithSession

func WithSession(ctx context.Context, runner pgunit.Transactor, tenant, session pgtype.UUID, apply func(context.Context, *sqlc.Queries, sessions.LockedSession) error) error

WithSession runs one Session transaction on runner: it locks the tenant's Session, runs apply on the transaction's queries with what the lock shows, then prunes the Session's journal, and commits only when all of them succeed. apply applies the public view itself, with sessions.LockedSession.Public. It is the transaction runner of Session operations; other adapters lock the Session inside their own transaction with LockSession.

Types

type Execution

type Execution struct {
	// contains filtered or unexported fields
}

Execution is the Session storage of the execution owner. Every transaction runs on the connection that holds the execution lease, which the owner acquired and closes; losing or closing the lease fails the operation and never falls back to the pool.

func NewExecution

func NewExecution(lease *pgunit.Lease) *Execution

NewExecution builds the Session execution storage on a lease it borrows.

func (*Execution) ListEnvironmentConnections

func (e *Execution) ListEnvironmentConnections(ctx context.Context, after string) ([]sessions.EnvironmentKey, error)

func (*Execution) WithConnection

func (e *Execution) WithConnection(ctx context.Context, tenant, environment string, apply func(context.Context, sessions.ConnectionTx, sessions.LockedSession) error) error

WithConnection reads the Environment in the transaction before it locks the Environment's Session.

func (*Execution) WithDeviceBinding

func (e *Execution) WithDeviceBinding(ctx context.Context, tenant, session string, apply func(context.Context, sessions.DeviceBindingTx, sessions.LockedSession) error) error

func (*Execution) WithFileWriteReservation

func (e *Execution) WithFileWriteReservation(ctx context.Context, tenant, environment string, apply func(context.Context, sessions.FileWriteReservationTx, sessions.Environment, sessions.LockedSession) error) error

WithFileWriteReservation reads the Environment in the transaction before it locks the Environment's Session.

func (*Execution) WithFileWriteSettlement

func (e *Execution) WithFileWriteSettlement(ctx context.Context, tenant, environment, write string, apply func(context.Context, sessions.FileWriteSettlementTx) error) error

WithFileWriteSettlement reads the write in the transaction before it locks the Session of the write's Environment, whether or not that Session was publicly deleted. A malformed ID is sessions.ErrInvalidInput and an unknown write sessions.ErrNotFound.

func (*Execution) WithFunctionTurn

func (e *Execution) WithFunctionTurn(ctx context.Context, tenant, session, turn string, apply func(context.Context, sessions.FunctionTx, sessions.Turn) error) error

func (*Execution) WithInitialization

func (e *Execution) WithInitialization(ctx context.Context, tenant, session string, apply func(context.Context, sessions.InitializationTx, sessions.LockedSession) error) error

func (*Execution) WithTurnJournal

func (e *Execution) WithTurnJournal(ctx context.Context, tenantID, sessionID string, apply func(context.Context, sessions.TurnJournalTx) error) error

WithTurnJournal runs apply in a Session transaction on the lease, including for a publicly deleted Session.

type SessionTx

type SessionTx struct {
	// contains filtered or unexported fields
}

SessionTx is one Session inside its caller's transaction. It implements the transaction interfaces of the sessions procedures by loading the facts they read and applying what they decide, and decides nothing itself.

The caller guarantees what the procedures assume: the queries are bound to the caller's open transaction, the tenant owns the Session, the transaction already holds the Session lock (LockSession), and the operation that owns the transaction supplies its authority, such as the execution lease. A SessionTx never begins or commits a transaction, never chooses a pool or the lease, and is not used after the transaction callback it was bound in returns.

func BindSession

func BindSession(q *sqlc.Queries, tenant, session pgtype.UUID) *SessionTx

BindSession binds the tenant's Session to the caller's transaction-bound queries.

func (*SessionTx) AppendChanges

func (t *SessionTx) AppendChanges(ctx context.Context, changes ...sessions.SessionChange) error

func (*SessionTx) ApplyFunctionResult

func (t *SessionTx) ApplyFunctionResult(ctx context.Context, turn, call string) error

func (*SessionTx) ApplyFunctionTurnStatus

func (t *SessionTx) ApplyFunctionTurnStatus(ctx context.Context, turn, expected, status string) (sessions.Turn, error)

func (*SessionTx) ApplySubagentLifecycle

func (t *SessionTx) ApplySubagentLifecycle(ctx context.Context, subagent string, lifecycle sessions.SubagentLifecycle) error

func (*SessionTx) ApplyTurnEnd

func (t *SessionTx) ApplyTurnEnd(ctx context.Context, turn string, end sessions.TurnEnd) error

func (*SessionTx) BindDevice

func (t *SessionTx) BindDevice(ctx context.Context, device string) error

BindDevice binds the device to the Session; a Session bound to another device is sessions.ErrDeviceBindingConflict.

func (*SessionTx) CancelPendingInput

func (t *SessionTx) CancelPendingInput(ctx context.Context) error

func (*SessionTx) CountEvents

func (t *SessionTx) CountEvents(ctx context.Context, turn string, count int32, size int64) error

CountEvents adds entries to the Turn's journal counters.

func (*SessionTx) CreateFunctionCall

func (t *SessionTx) CreateFunctionCall(ctx context.Context, turn string, call sessions.FunctionCall) error

func (*SessionTx) ExpireEnvironment

func (t *SessionTx) ExpireEnvironment(ctx context.Context, environment string) error

ExpireEnvironment expires the Environment only while it is the Session's; another Environment is sessions.ErrNotFound and changes nothing.

func (*SessionTx) FailPendingInput

func (t *SessionTx) FailPendingInput(ctx context.Context) error

func (*SessionTx) FindResultTurn

func (t *SessionTx) FindResultTurn(ctx context.Context, turn string) (sessions.Turn, bool, error)

func (*SessionTx) HasFunctionCall

func (t *SessionTx) HasFunctionCall(ctx context.Context, call string) (bool, error)

func (*SessionTx) InsertEnvironmentDevice

func (t *SessionTx) InsertEnvironmentDevice(ctx context.Context, device sessions.ExecutionDevice, credentialHash string) error

InsertEnvironmentDevice inserts the device only for the Session's own hosted Environment. The insert takes no row when the Environment already has a device, including one a concurrent transaction inserted first, or cannot take one: that is sessions.ErrDeviceBindingConflict.

func (*SessionTx) InsertEvent

func (t *SessionTx) InsertEvent(ctx context.Context, turn string, ordinal int32, event sessions.ExecutionEvent) error

InsertEvent records event at the Turn's journal position ordinal.

func (*SessionTx) InsertEvents

func (t *SessionTx) InsertEvents(ctx context.Context, turn string, first int32, events []sessions.ExecutionEvent) error

InsertEvents records events at the Turn's journal positions from first. The database stamps each entry.

func (*SessionTx) LoadActiveTurn

func (t *SessionTx) LoadActiveTurn(ctx context.Context) (sessions.Turn, bool, error)

func (*SessionTx) LoadBoundDevice

func (t *SessionTx) LoadBoundDevice(ctx context.Context) (bool, error)

func (*SessionTx) LoadChildItem

func (t *SessionTx) LoadChildItem(ctx context.Context, subagent, item string, candidate json.RawMessage) (sessions.StoredChildItem, bool, error)

func (*SessionTx) LoadChildTurn

func (t *SessionTx) LoadChildTurn(ctx context.Context, subagent, id string) (sessions.ChildTurn, bool, error)

func (*SessionTx) LoadComputeSuspension

func (t *SessionTx) LoadComputeSuspension(ctx context.Context) (bool, error)

func (*SessionTx) LoadDevice

func (t *SessionTx) LoadDevice(ctx context.Context, device string) (bool, error)

func (*SessionTx) LoadEnding

func (t *SessionTx) LoadEnding(ctx context.Context, turn string) (sessions.Ending, error)

func (*SessionTx) LoadEnvironment

func (t *SessionTx) LoadEnvironment(ctx context.Context) (sessions.Environment, error)

func (*SessionTx) LoadEnvironmentInput

func (t *SessionTx) LoadEnvironmentInput(ctx context.Context) (*sessions.EnvironmentInputState, error)

func (*SessionTx) LoadEventSources

func (t *SessionTx) LoadEventSources(ctx context.Context, turn string, first int32) ([]sessions.Source, error)

LoadEventSources reads the Turn's journal entries from first, in order.

func (*SessionTx) LoadFunctionCall

func (t *SessionTx) LoadFunctionCall(ctx context.Context, turn, call string) (sessions.FunctionCall, bool, error)

func (*SessionTx) LoadInputSource

func (t *SessionTx) LoadInputSource(ctx context.Context, sequence int64) (sessions.Source, error)

LoadInputSource reads the Session's admitted input at sequence.

func (*SessionTx) LoadItem

func (t *SessionTx) LoadItem(ctx context.Context, turnID string, update items.Update) (items.Stored, error)

LoadItem reads what the Session holds for update's Item: the stored Item and, when update asks for them, whether the Turn has another assistant message and the result the application saved for the call.

func (*SessionTx) LoadJournalTurn

func (t *SessionTx) LoadJournalTurn(ctx context.Context, turn string) (sessions.JournalTurn, bool, error)

LoadJournalTurn reads the tenant's Turn in the Session.

func (*SessionTx) LoadNativeSubagent

func (t *SessionTx) LoadNativeSubagent(ctx context.Context, native string) (sessions.NativeSubagent, bool, error)

func (*SessionTx) LoadPendingFileWrite

func (t *SessionTx) LoadPendingFileWrite(ctx context.Context) (bool, error)

func (*SessionTx) LoadPendingFunctionCalls

func (t *SessionTx) LoadPendingFunctionCalls(ctx context.Context, turn string) ([]sessions.FunctionCall, error)

func (*SessionTx) LoadPublicSubagent

func (t *SessionTx) LoadPublicSubagent(ctx context.Context, id string) (v1.Subagent, error)

func (*SessionTx) LoadRootAgent

func (t *SessionTx) LoadRootAgent(ctx context.Context) (string, error)

func (*SessionTx) LoadTurn

func (t *SessionTx) LoadTurn(ctx context.Context, turn string) (sessions.Turn, error)

func (*SessionTx) LoadUsage

func (t *SessionTx) LoadUsage(ctx context.Context) (json.RawMessage, error)

func (*SessionTx) MatchEvents

func (t *SessionTx) MatchEvents(ctx context.Context, turn string, first int32, events []sessions.ExecutionEvent) (bool, error)

MatchEvents compares the Turn's journal entries from first with events.

func (*SessionTx) MatchFunctionCall

func (t *SessionTx) MatchFunctionCall(ctx context.Context, turn string, call sessions.FunctionCall) (sessions.FunctionCallMatch, error)

func (*SessionTx) MatchFunctionResult

func (t *SessionTx) MatchFunctionResult(ctx context.Context, turn, call string, result json.RawMessage) (sessions.FunctionResultMatch, error)

func (*SessionTx) PublishSubagent

func (t *SessionTx) PublishSubagent(ctx context.Context, subagent string, name, instructions *string) error

func (*SessionTx) PutChildItem

func (t *SessionTx) PutChildItem(ctx context.Context, item sessions.ChildItem) error

PutChildItem stores a Subagent Item; a new output Item takes its Turn's next output index.

func (*SessionTx) PutChildTurn

func (t *SessionTx) PutChildTurn(ctx context.Context, turn sessions.ChildTurn) error

func (*SessionTx) PutItem

func (t *SessionTx) PutItem(ctx context.Context, turnID string, created time.Time, change items.Change) (*int32, error)

PutItem stores a decided Item change. A new Item takes the Session's next position and, when it is output, the Turn's next output index; an update keeps both, and its first terminal status records when it settled. PutItem returns the Item's output index, nil when it has none, and textvalue.ErrUnstorable for text PostgreSQL cannot store.

func (*SessionTx) PutSubagentEffect

func (t *SessionTx) PutSubagentEffect(ctx context.Context, effect string, payload json.RawMessage) (bool, error)

func (*SessionTx) PutSubagentIdentity

func (t *SessionTx) PutSubagentIdentity(ctx context.Context, identity sessions.SubagentIdentity) (string, error)

PutSubagentIdentity allocates the Subagent ID of a new binding.

func (*SessionTx) PutTurnUsage

func (t *SessionTx) PutTurnUsage(ctx context.Context, turnID string, usage v1.TokenUsage) error

PutTurnUsage replaces a root Turn's recorded usage with a measurement.

func (*SessionTx) RecordEnvironmentFailure

func (t *SessionTx) RecordEnvironmentFailure(ctx context.Context, environment, reason string, detail *sessions.ProvisioningFailureDetail) (time.Time, error)

RecordEnvironmentFailure fails the Environment only while it is the Session's and still live; otherwise it changes nothing and returns pgx.ErrNoRows.

func (*SessionTx) RecordTerminalActivity

func (t *SessionTx) RecordTerminalActivity(ctx context.Context) error

RecordTerminalActivity marks the Session's running managed compute active at the database's commit clock.

func (*SessionTx) RequestTurnCancel

func (t *SessionTx) RequestTurnCancel(ctx context.Context, turn string) error

func (*SessionTx) SubmitFunctionResult

func (t *SessionTx) SubmitFunctionResult(ctx context.Context, turn, call string, result json.RawMessage) error

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is the pooled Session adapter: the storage of the Session use cases and the Session reads. cipher opens the Session data frozen at creation and signs installation authorizations; it is nil on a service without a credential key.

func New

func New(units *pgunit.Pool, cipher *credentialcrypto.Cipher) *Store

New builds the pooled Session adapter on units, opening frozen Session data and signing installation authorizations with cipher.

func (*Store) AuthenticateEnvironmentExecutor

func (s *Store) AuthenticateEnvironmentExecutor(ctx context.Context, environment, digest string) (string, error)

func (*Store) CreateDevice

func (s *Store) CreateDevice(ctx context.Context, tenant string, registration sessions.DeviceRegistration) (sessions.ExecutionDevice, error)

func (*Store) DeleteSessionArtifact

func (s *Store) DeleteSessionArtifact(ctx context.Context, tenantID, sessionID, artifactID string) error

func (*Store) ExecutorProjectExists

func (s *Store) ExecutorProjectExists(ctx context.Context, scope identity.ProjectScope) (bool, error)

func (*Store) GetDeviceCredential

func (s *Store) GetDeviceCredential(ctx context.Context, device string) (runtimedevice.Credential, bool, error)

GetDeviceCredential reads a device's credential for the Runtime gateway. A malformed or unknown device has no credential. The standalone service assigns no product WorkspaceID.

func (*Store) GetEnvironment

func (s *Store) GetEnvironment(ctx context.Context, tenant, environment string) (sessions.Environment, error)

func (*Store) GetSessionArtifact

func (s *Store) GetSessionArtifact(ctx context.Context, tenantID, sessionID, artifactID string) (sessions.Artifact, error)

func (*Store) GetSessionDevice

func (s *Store) GetSessionDevice(ctx context.Context, tenant, session string) (sessions.ExecutionDevice, error)

func (*Store) GetSessionEnvironment

func (s *Store) GetSessionEnvironment(ctx context.Context, tenant, session string) (sessions.Environment, error)

func (*Store) GetSessionRuntimeDevice

func (s *Store) GetSessionRuntimeDevice(ctx context.Context, tenant, session string) (sessions.ExecutionDevice, error)

func (*Store) GetSubagent

func (s *Store) GetSubagent(ctx context.Context, tenantID, sessionID, subagentID string) (v1.Subagent, error)

func (*Store) GetSubagentTurn

func (s *Store) GetSubagentTurn(ctx context.Context, tenantID, sessionID, subagentID, turnID string) (v1.Turn, error)

func (*Store) ListEnrolledRuntimeBindings

func (s *Store) ListEnrolledRuntimeBindings(ctx context.Context) ([]sessions.EnrolledRuntimeBinding, error)

func (*Store) ListEnvironmentInitializations

func (s *Store) ListEnvironmentInitializations(ctx context.Context, after string) ([]sessions.EnvironmentInitialization, error)

func (*Store) ListItems

func (s *Store) ListItems(ctx context.Context, tenantID, sessionID, cursor string, limit int, ascending bool) (sessions.ItemPage, error)

func (*Store) ListSessionArtifacts

func (s *Store) ListSessionArtifacts(ctx context.Context, tenantID, sessionID, environmentID, cursor string, limit int, ascending bool) (sessions.ArtifactPage, error)

func (*Store) ListSubagentItems

func (s *Store) ListSubagentItems(ctx context.Context, tenantID, sessionID, subagentID, cursor string, limit int, ascending bool) (v1.ItemList, error)

func (*Store) ListSubagentTurnItems

func (s *Store) ListSubagentTurnItems(ctx context.Context, tenantID, sessionID, subagentID, turnID, cursor string, limit int, ascending bool) (v1.ItemList, error)

func (*Store) ListSubagentTurns

func (s *Store) ListSubagentTurns(ctx context.Context, tenantID, sessionID, subagentID, cursor string, limit int, ascending bool) (v1.TurnList, error)

func (*Store) ListSubagents

func (s *Store) ListSubagents(ctx context.Context, tenantID, sessionID, cursor string, limit int, ascending bool) (v1.SubagentList, error)

func (*Store) LoadExecutorCredentialRestriction

func (s *Store) LoadExecutorCredentialRestriction(ctx context.Context, principal identity.Principal, key string) (string, error)

func (*Store) LoadProjectArchived

func (s *Store) LoadProjectArchived(ctx context.Context, tenant string) (bool, error)

func (*Store) ProjectExecutorCredentialState

func (s *Store) ProjectExecutorCredentialState(ctx context.Context, project identity.Principal, environment string) (sessions.ExecutorCredentialState, error)

func (*Store) ReadEnvironmentSetup

func (s *Store) ReadEnvironmentSetup(ctx context.Context, tenant, session string) (environmentconfig.Setup, error)

ReadEnvironmentSetup opens the setup the Session froze at creation. Frozen data that does not open, decode or validate is corrupt stored data, never the caller's input, so it is an internal error.

func (*Store) ReadInitialEnvironmentFile

func (s *Store) ReadInitialEnvironmentFile(ctx context.Context, tenant, session string, position int) (environmentconfig.InitialFileMetadata, []byte, error)

ReadInitialEnvironmentFile opens the initial file the Session froze at position. A file that does not open or match its recorded size is corrupt stored data, so it is an internal error.

func (*Store) ReadSessionArtifact

func (s *Store) ReadSessionArtifact(ctx context.Context, tenantID, sessionID, artifactID string, consume func(sessions.Artifact, io.Reader) error) error

ReadSessionArtifact keeps an admitted snapshot available across concurrent deletion.

func (*Store) RevokeDevice

func (s *Store) RevokeDevice(ctx context.Context, tenant, device string) error

func (*Store) SignInstallation

func (s *Store) SignInstallation(_ context.Context, payload string) (string, error)

func (*Store) TouchAuthenticatedDevice

func (s *Store) TouchAuthenticatedDevice(ctx context.Context, device, credentialHash string) (bool, error)

func (*Store) TouchDevice

func (s *Store) TouchDevice(ctx context.Context, device string) (bool, error)

func (*Store) VerifyInstallation

func (s *Store) VerifyInstallation(_ context.Context, payload, signature string) error

func (*Store) WithArtifactStaging

func (s *Store) WithArtifactStaging(ctx context.Context, key sessions.ArtifactStagingKey, stage func(context.Context, sessions.ArtifactStagingTx) error) error

WithArtifactStaging runs the staging in one pooled transaction, not on the execution lease: the transfer can outlast a lease transaction, and staged Artifacts stay private until the lease-bound completion publishes or discards them. Large objects the staging created are removed with the rolled-back transaction.

func (*Store) WithEnrollment

func (s *Store) WithEnrollment(ctx context.Context, environment, credentialHash string, apply func(context.Context, sessions.EnrollmentTx, sessions.Environment, sessions.LockedSession) error) error

WithEnrollment authenticates the credential and reads the Environment on the pool before it knows which Session to lock; the enrollment transaction rechecks that authority under the Session lock.

func (*Store) WithEnvironmentExecutorCredentials

func (s *Store) WithEnvironmentExecutorCredentials(ctx context.Context, tenant, environment string, apply func(context.Context, sessions.EnvironmentExecutorCredentialTx, sessions.LockedSession) error) error

WithEnvironmentExecutorCredentials reads the Environment on the pool before it knows which Session to lock.

func (*Store) WithExecutorCredentials

func (s *Store) WithExecutorCredentials(ctx context.Context, tenant string, apply func(context.Context, sessions.ExecutorCredentialTx) error) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL