sqlcompletion

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 17 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 sqlcompletion shares the transactional completion invariant between SQL backends. Drivers supply only transaction and placeholder adapters.

Index

Constants

View Source
const PendingActionSelectColumns = `` /* 421-byte string literal not displayed */

PendingActionSelectColumns keeps the SQL backends and transactional approval core on the same metadata projection. Counts are derived, never caller supplied.

View Source
const SQLiteTimestampLayout = "2006-01-02T15:04:05.000000000Z"

SQLiteTimestampLayout preserves nanosecond chronology in text comparisons. RFC3339Nano removes trailing zeros, making older fractions sort after newer.

Variables

This section is empty.

Functions

func ActionDeliverySchema added in v0.7.0

func ActionDeliverySchema(dialect string) []string

ActionDeliverySchema deliberately has no action/run foreign key. Delivery recovery remains possible after explicit action evidence retention.

func ConnectorActionSchema added in v0.7.0

func ConnectorActionSchema(dialect string) []string

ConnectorActionSchema has no run foreign key. Explicit action retention owns deletion; run or thread deletion must not silently erase effect evidence.

func PendingApprovalSchema added in v0.7.0

func PendingApprovalSchema(dialect string) []string

PendingApprovalSchema keeps approval history separate from run lifetime. A unique exact identity prevents concurrent retries becoming additional votes.

func ScanPendingAction added in v0.7.0

func ScanPendingAction(row Row) (*models.PendingAction, error)

Types

type ActionRows added in v0.7.0

type ActionRows interface {
	Next() bool
	Scan(...interface{}) error
	Err() error
	Close()
}

ActionRows is the small read adapter needed by the shared action lifecycle.

type Driver

type Driver struct {
	Begin          func(context.Context) (Tx, error)
	Dialect        string
	ValidateValues func(context.Context, Tx, []byte) error
}

func DatabaseSQL

func DatabaseSQL(db *sql.DB, dialect string) Driver

DatabaseSQL adapts database/sql transactions. SQLite uses BEGIN IMMEDIATE so read/modify/write is serialized before the metadata is inspected.

func (Driver) AckActionDelivery added in v0.7.0

func (d Driver) AckActionDelivery(ctx context.Context, id, token string) error

func (Driver) ApprovePendingAction added in v0.7.0

func (d Driver) ApprovePendingAction(ctx context.Context, id, actor string) error

ApprovePendingAction serializes votes with capability consumption. Managed paths lock the run before the pending row, matching dispatch's lock order.

func (Driver) BeginRunAttempt

func (d Driver) BeginRunAttempt(ctx context.Context, runID string, generation int64) (bool, error)

func (Driver) BindPendingAction added in v0.7.0

func (d Driver) BindPendingAction(ctx context.Context, a *models.PendingAction) error

BindPendingAction freezes the approval plan and derives managed requester identity from the durable run, never from submitted tool arguments.

func (Driver) ClaimActionDeliveries added in v0.7.0

func (d Driver) ClaimActionDeliveries(ctx context.Context, sinkID string, now, leaseUntil time.Time, limit int) ([]*state.ActionDelivery, error)

func (Driver) CompleteRun

func (Driver) CompleteRunInTx

func (d Driver) CompleteRunInTx(ctx context.Context, tx Tx, c *state.RunCompletion) (state.CompletionResult, error)

CompleteRunInTx shares the completion writes with synchronous cached-run creation. The caller owns the transaction and must commit only after every admission, parent-ownership and completion operation succeeds.

func (Driver) ConsumeApprovedPendingAction added in v0.7.0

func (d Driver) ConsumeApprovedPendingAction(ctx context.Context, tenantID, agentID, runID string, generation int64, connector, tool, digest, targetRevision, policyRevision, toolRevision string) (string, error)

ConsumeApprovedPendingAction locks the current run before approval authority. A status flip alone never supplies votes for a quorum-bound capability.

func (Driver) CreateConnectorAction added in v0.7.0

func (d Driver) CreateConnectorAction(ctx context.Context, input *models.ConnectorAction, mutation string) (*models.ConnectorAction, error)

func (Driver) DeleteBoundOpaqueCheckpoint

func (d Driver) DeleteBoundOpaqueCheckpoint(ctx context.Context, binding state.RunCheckpointBinding, checkpointID string) error

func (Driver) FailActionDelivery added in v0.7.0

func (d Driver) FailActionDelivery(ctx context.Context, id, token string, nextAt time.Time, reason string, dead bool) error

func (Driver) FindOpenPendingCall added in v0.7.0

func (d Driver) FindOpenPendingCall(ctx context.Context, tenantID, agentID, runID string, generation int64, connector, tool, digest string, embedded bool, incarnation, targetRevision, policyRevision, toolRevision string, plan *models.PendingAction) (*models.PendingAction, error)

FindOpenPendingCall shares exact revision and immutable-plan matching across all SQL dialects. Public lookups omit plan; creation supplies the frozen plan.

func (Driver) FinishConnectorAction added in v0.7.0

func (d Driver) FinishConnectorAction(ctx context.Context, id string, version int64, dispatchID string, obs models.ConnectorActionObservation, mutation string) (*models.ConnectorAction, error)

func (Driver) GetConnectorAction added in v0.7.0

func (d Driver) GetConnectorAction(ctx context.Context, id string) (*models.ConnectorAction, error)

func (Driver) GetPendingAction added in v0.7.0

func (d Driver) GetPendingAction(ctx context.Context, id string) (*models.PendingAction, error)

func (Driver) ListConnectorActionEvents added in v0.7.0

func (d Driver) ListConnectorActionEvents(ctx context.Context, id string, after int64, limit int) ([]*models.ConnectorActionEvent, error)

func (Driver) ListPendingActionApprovals added in v0.7.0

func (d Driver) ListPendingActionApprovals(ctx context.Context, id string) ([]models.PendingActionApproval, error)

func (Driver) LockRunCheckpoint

func (d Driver) LockRunCheckpoint(ctx context.Context, tx Tx, binding state.RunCheckpointBinding) error

LockRunCheckpoint uses the same run-row lock as attempt advancement and completion. The caller must keep tx open until its blob mutation commits.

func (Driver) LockThread

func (d Driver) LockThread(ctx context.Context, tx Tx, threadID string) (models.ThreadStatus, error)

LockThread binds a child mutation to the current parent owner. The row lock must be retained through the child write: a preceding API lookup cannot fence deletion and reuse of the same custom thread ID by a different tenant.

func (Driver) MarkExpiredConnectorActionsUnknown added in v0.7.0

func (d Driver) MarkExpiredConnectorActionsUnknown(ctx context.Context, cutoff time.Time, limit int) (int, error)

func (Driver) PeekApprovedConnectorAction added in v0.7.0

func (d Driver) PeekApprovedConnectorAction(ctx context.Context, id string) (*models.PendingAction, error)

func (Driver) PendingRunIncarnation added in v0.7.0

func (d Driver) PendingRunIncarnation(ctx context.Context, tenantID, agentID, runID string) (string, error)

func (Driver) PrepareConnectorActionDispatch added in v0.7.0

func (d Driver) PrepareConnectorActionDispatch(ctx context.Context, id string, version int64, approvalID, source string, deadline time.Time, mutation string) (*state.ConnectorActionDispatch, error)

func (Driver) PruneConnectorActions added in v0.7.0

func (d Driver) PruneConnectorActions(ctx context.Context, cutoff time.Time, limit int) (int, error)

func (Driver) RecordConnectorActionDecision added in v0.7.0

func (d Driver) RecordConnectorActionDecision(ctx context.Context, id string, version int64, dec models.ConnectorActionDecision, mutation string) (*models.ConnectorAction, error)

func (Driver) RetryActionDelivery added in v0.7.0

func (d Driver) RetryActionDelivery(ctx context.Context, tenantID, id string) error

func (Driver) SearchActionDeliveries added in v0.7.0

func (d Driver) SearchActionDeliveries(ctx context.Context, req *state.ActionDeliverySearchRequest) ([]*state.ActionDelivery, error)

func (Driver) SearchConnectorActions added in v0.7.0

func (d Driver) SearchConnectorActions(ctx context.Context, request *models.ConnectorActionSearchRequest) ([]*models.ConnectorAction, error)

func (Driver) WithRunCheckpoint

func (d Driver) WithRunCheckpoint(ctx context.Context, binding state.RunCheckpointBinding, mutate func(Tx) error) error

func (Driver) WithThread

func (d Driver) WithThread(ctx context.Context, threadID string, mutate func(Tx) error) error

type Row

type Row interface{ Scan(...interface{}) error }

type Tx

type Tx interface {
	Exec(context.Context, string, ...interface{}) error
	Row(context.Context, string, ...interface{}) Row
	Commit(context.Context) error
	Rollback(context.Context) error
}

func WrapSQLTransaction

func WrapSQLTransaction(tx *sql.Tx) Tx

WrapSQLTransaction lets a store reuse the completion lock inside an existing database/sql transaction without opening another connection.

func WrapSQLiteConnection

func WrapSQLiteConnection(conn *sql.Conn) Tx

WrapSQLiteConnection adapts an already-open BEGIN IMMEDIATE transaction.

Jump to

Keyboard shortcuts

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