Documentation
¶
Overview ¶
Package rowlock owns the invariant PostgreSQL lock order for local Workspace mutations. Every caller locks Sandbox, then Workspace, then Snapshot when present before acquiring any operation-specific rows.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SandboxWorkspace ¶
type SandboxWorkspace struct {
SandboxID string
TenantRef string
SubjectRef string
WorkspaceID string
ProfileRevisionID string
SandboxState string
DesiredState string
Generation int64
Revision int64
CurrentInstanceID string
ReconcileOwner string
Workspace ports.HomeWorkspace
}
SandboxWorkspace is the durable authority protected by the first two locks.
func SandboxWorkspaceByID ¶
func SandboxWorkspaceByID( ctx context.Context, tx pgx.Tx, sandboxID string, ) (SandboxWorkspace, error)
SandboxWorkspaceByID locks one internally identified Sandbox followed by its Workspace.
type Snapshot ¶
type Snapshot struct {
ID string
SandboxID string
WorkspaceID string
HomeRunnerID string
State string
}
Snapshot identifies the third row in the invariant lock order.
func SnapshotByID ¶
func SnapshotByID( ctx context.Context, tx pgx.Tx, locked SandboxWorkspace, snapshotID string, ) (Snapshot, error)
SnapshotByID locks a Snapshot only after the caller holds its Sandbox and Workspace.
func SnapshotForSubject ¶
func SnapshotForSubject( ctx context.Context, tx pgx.Tx, tenantRef string, subjectRef string, locked SandboxWorkspace, snapshotID string, ) (Snapshot, error)
SnapshotForSubject locks a Snapshot only after the caller holds its Sandbox and Workspace through SandboxWorkspaceForSubject or SandboxWorkspaceByID.