postgres

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 18 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 postgres implements the state.Store interface using PostgreSQL via pgx. This is the production backend for multi-node deployments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Store)

Option configures optional Postgres store behavior.

func WithRLS

func WithRLS(enabled bool) Option

WithRLS enables opt-in Postgres row-level security: FORCE RLS policies on tenant-scoped tables plus per-acquire app.tenant_id / app.is_system GUCs derived from context. Off by default — application WHERE clauses remain the primary isolation mechanism. Turning the flag off and restarting clears Runkite's policies (see disableRLS) so FORCE does not stick.

type Store

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

Store implements state.Store with a PostgreSQL database.

func New

func New(ctx context.Context, dsn string, opts ...Option) (*Store, error)

New creates a new Postgres store from a connection string (DSN).

func (*Store) AckActionDelivery added in v0.7.0

func (s *Store) AckActionDelivery(ctx context.Context, id, token string) error

func (*Store) BeginRunAttempt

func (s *Store) BeginRunAttempt(ctx context.Context, id string, generation int64) (bool, error)

func (*Store) ClaimActionDeliveries added in v0.7.0

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

func (*Store) Close

func (s *Store) Close() error

Close closes the connection pool.

func (*Store) CompleteRun

func (s *Store) CompleteRun(ctx context.Context, c *state.RunCompletion) (state.CompletionResult, error)

func (*Store) ConsumeApprovedAction

func (s *Store) ConsumeApprovedAction(ctx context.Context, tenantID, agentID, runID string, generation int64, connector, tool, argsDigest, targetRevision, policyRevision, toolRevision string) (string, error)

ConsumeApprovedAction atomically marks an approved action consumed for the matching run/generation/connector/tool and argument digest. Unbound legacy approvals cannot authorize a newly interpreted operation.

func (*Store) CountActiveRuns

func (s *Store) CountActiveRuns(ctx context.Context, agentID string) (int, error)

func (*Store) CountAgents

func (s *Store) CountAgents(ctx context.Context) (int, error)

func (*Store) CountRunsByStatus

func (s *Store) CountRunsByStatus(ctx context.Context) (map[string]int, error)

func (*Store) CountRunsCreatedSince

func (s *Store) CountRunsCreatedSince(ctx context.Context, since time.Time, agentID string) (int, error)

func (*Store) CountRunsSince

func (s *Store) CountRunsSince(ctx context.Context, tenantID, agentID string, since time.Time) (int64, error)

CountRunsSince counts runs created at/after since for tenant (optional agent).

func (*Store) CountThreadsByStatus

func (s *Store) CountThreadsByStatus(ctx context.Context) (map[string]int, error)

func (*Store) CreateBreakGlassWindow

func (s *Store) CreateBreakGlassWindow(ctx context.Context, w *models.BreakGlassWindow) error

func (*Store) CreateCachedRun

func (s *Store) CreateCachedRun(ctx context.Context, run *models.Run, caps *state.RunAdmissionCaps) error

func (*Store) CreateConnectorAction added in v0.7.0

func (s *Store) CreateConnectorAction(ctx context.Context, a *models.ConnectorAction, mutation string) (*models.ConnectorAction, error)

func (*Store) CreatePendingAction

func (s *Store) CreatePendingAction(ctx context.Context, a *models.PendingAction) error

CreatePendingAction inserts or reuses a scoped open approval. The canonical action ID is written back to a.ID. A nullable unique key arbitrates concurrent creates; legacy rows are reused without changing their stored history.

func (*Store) CreateRun

func (s *Store) CreateRun(ctx context.Context, run *models.Run) error

func (*Store) CreateRunAdmitted

func (s *Store) CreateRunAdmitted(ctx context.Context, run *models.Run, caps *state.RunAdmissionCaps) error

CreateRunAdmitted locks admission scopes, COUNTs, then INSERTs in one transaction so concurrent creates serialize per tenant/agent.

func (*Store) CreateThread

func (s *Store) CreateThread(ctx context.Context, thread *models.Thread) error

func (*Store) CredentialLeaseStorage added in v0.7.0

func (s *Store) CredentialLeaseStorage() (credentials.Store, error)

func (*Store) DeleteBoundOpaqueCheckpoint

func (s *Store) DeleteBoundOpaqueCheckpoint(ctx context.Context, binding state.RunCheckpointBinding, checkpointID string) error

func (*Store) DeleteBreakGlassWindow

func (s *Store) DeleteBreakGlassWindow(ctx context.Context, id string) error

func (*Store) DeleteCronSchedule

func (s *Store) DeleteCronSchedule(ctx context.Context, name string) error

func (*Store) DeleteFinOpsOverlay

func (s *Store) DeleteFinOpsOverlay(ctx context.Context) error

DeleteFinOpsOverlay removes the singleton overlay (file baseline only).

func (*Store) DeleteItem

func (s *Store) DeleteItem(ctx context.Context, namespace []string, key string) error

func (*Store) DeleteKillSwitch

func (s *Store) DeleteKillSwitch(ctx context.Context, id string) error

func (*Store) DeleteMandatoryHITLRule

func (s *Store) DeleteMandatoryHITLRule(ctx context.Context, id string) error

DeleteMandatoryHITLRule removes a rule by id. Missing id is not an error.

func (*Store) DeleteOpaqueCheckpoint

func (s *Store) DeleteOpaqueCheckpoint(ctx context.Context, threadID, checkpointID string) error

func (*Store) DeletePolicyGrant

func (s *Store) DeletePolicyGrant(ctx context.Context, id string) error

DeletePolicyGrant removes a grant by id. Missing id is not an error.

func (*Store) DeleteRegistryEntry

func (s *Store) DeleteRegistryEntry(ctx context.Context, name string) error

DeleteRegistryEntry also removes the entry's own version history, not just its current row -- real bug found via live testing: without this, a delete-then-republish of the same name hits the version snapshot table's "ON CONFLICT (tenant_id, name, version) DO NOTHING" against ORPHANED rows left over from before the delete, so the new publish's own v1 snapshot is silently discarded and ListRegistryEntryVersions keeps showing pre-delete content. Deleting history alongside the entry means a republish always starts from a genuinely clean version 1, matching what "deleted" should mean for a scoped-to-tenant, no-op cascading resource with no other backend to preserve the audit trail for once its own parent row is gone (unlike agent versioning, which never deletes an agent at all today).

func (*Store) DeleteRun

func (s *Store) DeleteRun(ctx context.Context, runID string) error

func (*Store) DeleteThread

func (s *Store) DeleteThread(ctx context.Context, threadID string) error

func (*Store) Downgrade

func (s *Store) Downgrade(ctx context.Context) error

Downgrade rolls back the most recently applied migration under the same advisory lock Init uses.

func (*Store) ExpireGovernancePending

func (s *Store) ExpireGovernancePending(ctx context.Context, now time.Time) error

ExpireGovernancePending denies embedded rows past expires_at. ponytail: no index on expires_at. Upgrade path is an index on (status, expires_at) if this sweep shows up in traces.

func (*Store) ExpireUsageHolds

func (s *Store) ExpireUsageHolds(ctx context.Context, olderThan time.Time) (int64, error)

ExpireUsageHolds deletes open holds with created_at strictly before olderThan.

func (*Store) FailActionDelivery added in v0.7.0

func (s *Store) FailActionDelivery(ctx context.Context, id, token string, nextAt time.Time, reason string, dead bool) error

func (*Store) FindActiveBreakGlass

func (s *Store) FindActiveBreakGlass(ctx context.Context, tenantID, agentID string) (*models.BreakGlassWindow, error)

FindActiveBreakGlass returns the most specific active window: agent-scoped wins over tenant-wide (agent_id empty), then earliest expiry.

func (*Store) FindActiveKill

func (s *Store) FindActiveKill(ctx context.Context, tenantID, agentID string) (*models.KillSwitch, error)

func (*Store) FindOpenPendingAction

func (s *Store) FindOpenPendingAction(ctx context.Context, tenantID, agentID, runID string, generation int64, connector, tool, argsDigest, targetRevision, policyRevision, toolRevision string, embedded bool) (*models.PendingAction, error)

FindOpenPendingAction returns the oldest still-pending row for this call tuple and argument digest. Different amounts do not share a row.

func (*Store) FinishConnectorAction added in v0.7.0

func (s *Store) FinishConnectorAction(ctx context.Context, id string, version int64, dispatch string, obs models.ConnectorActionObservation, mutation string) (*models.ConnectorAction, error)

func (*Store) GetAgent

func (s *Store) GetAgent(ctx context.Context, agentID string) (*models.Agent, error)

func (*Store) GetAgentSchema

func (s *Store) GetAgentSchema(ctx context.Context, agentID string) (*models.AgentSchema, error)

func (*Store) GetAgentVersion

func (s *Store) GetAgentVersion(ctx context.Context, agentID string, version int) (*models.AgentVersion, error)

func (*Store) GetBreakGlassWindow

func (s *Store) GetBreakGlassWindow(ctx context.Context, id string) (*models.BreakGlassWindow, error)

func (*Store) GetCachedRunResult

func (s *Store) GetCachedRunResult(ctx context.Context, cacheKey string) (*models.CachedRunResult, error)

func (*Store) GetConnectorAction added in v0.7.0

func (s *Store) GetConnectorAction(ctx context.Context, id string) (*models.ConnectorAction, error)

func (*Store) GetFinOpsOverlay

func (s *Store) GetFinOpsOverlay(ctx context.Context) (*models.FinOpsOverlay, error)

GetFinOpsOverlay returns the singleton overlay row, or (nil, nil) when absent.

func (*Store) GetItem

func (s *Store) GetItem(ctx context.Context, namespace []string, key string, refreshTTL bool) (*models.StoreItem, error)

func (*Store) GetKillSwitch

func (s *Store) GetKillSwitch(ctx context.Context, id string) (*models.KillSwitch, error)

func (*Store) GetLastCronFireTime

func (s *Store) GetLastCronFireTime(ctx context.Context, scheduleName string) (time.Time, bool, error)

func (*Store) GetLatestCheckpoint

func (s *Store) GetLatestCheckpoint(ctx context.Context, threadID string) (*models.ThreadState, error)

func (*Store) GetLatestOpaqueCheckpoint

func (s *Store) GetLatestOpaqueCheckpoint(ctx context.Context, threadID, namespace string) (*models.OpaqueCheckpoint, error)

GetLatestOpaqueCheckpoint returns the newest opaque blob for threadID. namespace "" = root graph keys (checkpoint_id with no "\x1f"); otherwise keys prefixed with namespace+"\x1f" (LangGraph folds checkpoint_ns into the opaque path key this way).

func (*Store) GetMandatoryHITLRule

func (s *Store) GetMandatoryHITLRule(ctx context.Context, id string) (*models.MandatoryHITLRule, error)

GetMandatoryHITLRule returns one rule by id, or state.ErrNotFound.

func (*Store) GetOpaqueCheckpoint

func (s *Store) GetOpaqueCheckpoint(ctx context.Context, threadID, checkpointID string) (*models.OpaqueCheckpoint, error)

func (*Store) GetPendingAction

func (s *Store) GetPendingAction(ctx context.Context, id string) (*models.PendingAction, error)

GetPendingAction returns one row by id.

func (*Store) GetPolicyGrant

func (s *Store) GetPolicyGrant(ctx context.Context, id string) (*models.PolicyGrant, error)

GetPolicyGrant returns one grant by id, or state.ErrNotFound.

func (*Store) GetRegistryEntry

func (s *Store) GetRegistryEntry(ctx context.Context, name string) (*models.RegistryEntry, error)

func (*Store) GetRegistryEntryVersion

func (s *Store) GetRegistryEntryVersion(ctx context.Context, name string, version int) (*models.RegistryEntryVersion, error)

func (*Store) GetRun

func (s *Store) GetRun(ctx context.Context, runID string) (*models.Run, error)

func (*Store) GetRunUsage added in v0.8.0

func (s *Store) GetRunUsage(ctx context.Context, binding state.RunUsageBinding) (*models.RunUsageSnapshot, error)

func (*Store) GetThread

func (s *Store) GetThread(ctx context.Context, threadID string) (*models.Thread, error)

func (*Store) GetWebhookDeadLetter

func (s *Store) GetWebhookDeadLetter(ctx context.Context, id string) (*models.WebhookDeadLetter, error)

func (*Store) Init

func (s *Store) Init(ctx context.Context) error

Init applies pending numbered schema migrations. Safe to call concurrently from multiple processes against the same database (e.g. several `runkite serve` replicas starting up at once) -- wrapped in a session-level advisory lock so only one process runs DDL while the others wait. Without this, concurrent CREATE TABLE IF NOT EXISTS calls against a table that doesn't exist yet can race on Postgres's own catalog (confirmed live: "duplicate key value violates unique constraint \"pg_type_typname_nsp_index\"" when 3 replicas started together against a fresh database).

func (*Store) ListActiveRunsCreatedBefore

func (s *Store) ListActiveRunsCreatedBefore(ctx context.Context, before time.Time, limit int) ([]*models.Run, error)

func (*Store) ListAgentVersions

func (s *Store) ListAgentVersions(ctx context.Context, agentID string) ([]*models.AgentVersion, error)

func (*Store) ListBreakGlassWindows

func (s *Store) ListBreakGlassWindows(ctx context.Context) ([]*models.BreakGlassWindow, error)

func (*Store) ListCheckpoints

func (s *Store) ListCheckpoints(ctx context.Context, threadID string, limit int, before string) ([]*models.ThreadState, error)

func (*Store) ListConnectorActionEvents added in v0.7.0

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

func (*Store) ListCronSchedules

func (s *Store) ListCronSchedules(ctx context.Context) ([]*models.CronSchedule, error)

ListCronSchedules -- see the SQLite equivalent's doc comment: always called from a system context in practice (the scheduler loop must see every tenant's schedules), TenantID is always populated on the returned rows so the caller can dispatch each fire under its own tenant.

func (*Store) ListKillSwitches

func (s *Store) ListKillSwitches(ctx context.Context) ([]*models.KillSwitch, error)

func (*Store) ListMandatoryHITLRules

func (s *Store) ListMandatoryHITLRules(ctx context.Context) ([]*models.MandatoryHITLRule, error)

ListMandatoryHITLRules returns every durable mandatory-HITL rule.

func (*Store) ListNamespaces

func (s *Store) ListNamespaces(ctx context.Context, req *models.StoreListNamespacesRequest) ([][]string, error)

func (*Store) ListOpaqueCheckpoints

func (s *Store) ListOpaqueCheckpoints(ctx context.Context, threadID string, limit int) ([]models.OpaqueCheckpointMeta, error)

func (*Store) ListPendingActionApprovals added in v0.7.0

func (s *Store) ListPendingActionApprovals(ctx context.Context, id string) ([]models.PendingActionApproval, error)

func (*Store) ListPolicyGrants

func (s *Store) ListPolicyGrants(ctx context.Context) ([]*models.PolicyGrant, error)

ListPolicyGrants returns every durable grant (Admin reload / startup).

func (*Store) ListRegistryEntryVersions

func (s *Store) ListRegistryEntryVersions(ctx context.Context, name string) ([]*models.RegistryEntryVersion, error)

func (*Store) ListWebhookDeadLetters

func (s *Store) ListWebhookDeadLetters(ctx context.Context, limit int) ([]*models.WebhookDeadLetter, error)

func (*Store) MarkExpiredConnectorActionsUnknown added in v0.7.0

func (s *Store) MarkExpiredConnectorActionsUnknown(ctx context.Context, cutoff time.Time, limit int) (int, error)

func (*Store) PeekApprovedConnectorAction added in v0.7.0

func (s *Store) PeekApprovedConnectorAction(ctx context.Context, id string) (*models.PendingAction, error)

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

Ping verifies the pool can still reach Postgres right now.

func (*Store) PrepareConnectorActionDispatch added in v0.7.0

func (s *Store) PrepareConnectorActionDispatch(ctx context.Context, id string, version int64, approval, source string, deadline time.Time, mutation string) (*state.ConnectorActionDispatch, error)

func (*Store) PruneCheckpoints

func (s *Store) PruneCheckpoints(ctx context.Context, keepLast int) (int64, error)

func (*Store) PruneConnectorActions added in v0.7.0

func (s *Store) PruneConnectorActions(ctx context.Context, cutoff time.Time, limit int) (int, error)

func (*Store) PruneCronClaims

func (s *Store) PruneCronClaims(ctx context.Context, olderThan time.Time) (int64, error)

func (*Store) PruneExpiredStoreItems

func (s *Store) PruneExpiredStoreItems(ctx context.Context) (int64, error)

func (*Store) PruneOpaqueCheckpoints

func (s *Store) PruneOpaqueCheckpoints(ctx context.Context, keepLast int) (int64, error)

func (*Store) PruneRuns

func (s *Store) PruneRuns(ctx context.Context, olderThan time.Time) (int64, error)

func (*Store) PruneTerminalHookClaims

func (s *Store) PruneTerminalHookClaims(ctx context.Context, olderThan time.Time) (int64, error)

func (*Store) PruneWebhookDeadLetters

func (s *Store) PruneWebhookDeadLetters(ctx context.Context, olderThan time.Time) (int64, error)

func (*Store) PublishRegistryEntry

func (s *Store) PublishRegistryEntry(ctx context.Context, entry *models.RegistryEntry) error

PublishRegistryEntry follows the exact same transaction + RETURNING + conditional-version-snapshot pattern as UpsertAgent above -- see its comment for the full rationale (a single UPSERT's CASE expression can't also conditionally write a second table's row).

func (*Store) PutBoundOpaqueCheckpoint

func (s *Store) PutBoundOpaqueCheckpoint(ctx context.Context, binding state.RunCheckpointBinding, checkpointID string, data []byte, framework string, ifMatch *int64) (int64, error)

func (*Store) PutItem

func (s *Store) PutItem(ctx context.Context, item *models.StoreItem) error

func (*Store) PutOpaqueCheckpoint

func (s *Store) PutOpaqueCheckpoint(ctx context.Context, threadID, checkpointID string, data []byte, framework string, ifMatch *int64) (int64, error)

func (*Store) RecordConnectorActionDecision added in v0.7.0

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

func (*Store) ReleaseCronClaim

func (s *Store) ReleaseCronClaim(ctx context.Context, scheduleName string, fireTime time.Time) error

func (*Store) ReleaseThreadIfNoOtherActive

func (s *Store) ReleaseThreadIfNoOtherActive(ctx context.Context, threadID, excludeRunID string, status models.ThreadStatus) (bool, error)

ReleaseThreadIfNoOtherActive is a single conditional UPDATE -- the inverse of TryClaimThread -- so a late StatusCallback cannot idle a thread that a newer run already claimed.

func (*Store) ReleaseUsageHold

func (s *Store) ReleaseUsageHold(ctx context.Context, runID string) error

func (*Store) ReportRunUsage added in v0.8.0

func (s *Store) ReportRunUsage(ctx context.Context, binding state.RunUsageBinding, report models.RunUsageReport) (*models.RunUsageSnapshot, bool, error)

func (*Store) RetryActionDelivery added in v0.7.0

func (s *Store) RetryActionDelivery(ctx context.Context, tenantID, id string) error

func (*Store) SaveCachedRunResult

func (s *Store) SaveCachedRunResult(ctx context.Context, result *models.CachedRunResult) error

func (*Store) SaveCheckpoint

func (s *Store) SaveCheckpoint(ctx context.Context, threadID string, ts *models.ThreadState) error

func (*Store) SaveWebhookDeadLetter

func (s *Store) SaveWebhookDeadLetter(ctx context.Context, dl *models.WebhookDeadLetter) error

func (*Store) SearchActionDeliveries added in v0.7.0

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

func (*Store) SearchAgents

func (s *Store) SearchAgents(ctx context.Context, req *models.AgentSearchRequest) ([]*models.Agent, error)

func (*Store) SearchAuditEvents

func (s *Store) SearchAuditEvents(ctx context.Context, req *models.AuditSearchRequest) ([]*models.AuditEvent, error)

SearchAuditEvents lists policy decisions newest-first. Keyset cursor is (ts, id). System context sees every tenant unless TenantID is set; a normal tenant context is always scoped to that tenant.

func (*Store) SearchBreakGlassWindows

func (s *Store) SearchBreakGlassWindows(ctx context.Context, req *models.BreakGlassSearchRequest) ([]*models.BreakGlassWindow, error)

func (*Store) SearchConnectorActions added in v0.7.0

func (s *Store) SearchConnectorActions(ctx context.Context, req *models.ConnectorActionSearchRequest) ([]*models.ConnectorAction, error)

func (*Store) SearchItems

func (s *Store) SearchItems(ctx context.Context, req *models.StoreSearchRequest) ([]*models.StoreItem, error)

func (*Store) SearchKillSwitches

func (s *Store) SearchKillSwitches(ctx context.Context, req *models.KillSwitchSearchRequest) ([]*models.KillSwitch, error)

func (*Store) SearchMandatoryHITLRules

func (s *Store) SearchMandatoryHITLRules(ctx context.Context, req *models.MandatoryHITLSearchRequest) ([]*models.MandatoryHITLRule, error)

SearchMandatoryHITLRules lists rules with optional filters and keyset paging.

func (*Store) SearchPendingActions

func (s *Store) SearchPendingActions(ctx context.Context, req *models.PendingActionSearchRequest) ([]*models.PendingAction, error)

SearchPendingActions lists pending actions with optional filters.

func (*Store) SearchPolicyGrants

func (s *Store) SearchPolicyGrants(ctx context.Context, req *models.PolicyGrantSearchRequest) ([]*models.PolicyGrant, error)

SearchPolicyGrants lists grants with optional filters and keyset paging.

func (*Store) SearchRegistryEntries

func (s *Store) SearchRegistryEntries(ctx context.Context, req *models.RegistrySearchRequest) ([]*models.RegistryEntry, error)

func (*Store) SearchRuns

func (s *Store) SearchRuns(ctx context.Context, req *models.RunSearchRequest) ([]*models.Run, error)

func (*Store) SearchThreads

func (s *Store) SearchThreads(ctx context.Context, req *models.ThreadSearchRequest) ([]*models.Thread, error)

func (*Store) SearchUsageSummary

func (s *Store) SearchUsageSummary(ctx context.Context, req *models.UsageSummaryRequest) ([]models.UsageSummaryRow, error)

SearchUsageSummary groups usage_events by tenant/agent/UTC day.

func (*Store) SetPendingActionApproved

func (s *Store) SetPendingActionApproved(ctx context.Context, id, decidedBy string) error

SetPendingActionApproved moves pending → approved and records who decided.

func (*Store) SetPendingActionStatus

func (s *Store) SetPendingActionStatus(ctx context.Context, id, fromStatus, toStatus string) error

SetPendingActionStatus updates status if the row is still in fromStatus (optimistic). Returns ErrConflict if the row moved on.

func (*Store) SetThreadStatus

func (s *Store) SetThreadStatus(ctx context.Context, threadID string, status models.ThreadStatus) error

func (*Store) SumUsage

func (s *Store) SumUsage(ctx context.Context, tenantID, agentID string, since, until time.Time) (tokensIn, tokensOut int64, usd float64, err error)

SumUsage aggregates tokens and USD for a tenant (and optional agent) in [since, until).

func (*Store) SumUsageHolds

func (s *Store) SumUsageHolds(ctx context.Context, tenantID, agentID string, since, until time.Time) (usd float64, tokens int64, count int64, err error)

func (*Store) SupportsWorkloadIdentity added in v0.8.0

func (*Store) SupportsWorkloadIdentity() bool

func (*Store) TruncateAll

func (s *Store) TruncateAll(ctx context.Context) error

TruncateAll removes all rows from all tables. For testing only.

func (*Store) TryClaimCronFire

func (s *Store) TryClaimCronFire(ctx context.Context, scheduleName string, fireTime time.Time) (bool, error)

func (*Store) TryClaimTerminalHook

func (s *Store) TryClaimTerminalHook(ctx context.Context, runID string) (bool, error)

func (*Store) TryClaimThread

func (s *Store) TryClaimThread(ctx context.Context, threadID string) (bool, error)

func (*Store) TryMarkRunTimeout

func (s *Store) TryMarkRunTimeout(ctx context.Context, runID string, errMsg string) (bool, error)

func (*Store) UpdateRunStatus

func (s *Store) UpdateRunStatus(ctx context.Context, runID string, status models.RunStatus, output []byte, errMsg string) error

func (*Store) UpdateThread

func (s *Store) UpdateThread(ctx context.Context, threadID string, patch *models.ThreadPatch) (*models.Thread, error)

func (*Store) UpsertAgent

func (s *Store) UpsertAgent(ctx context.Context, agent *models.Agent) error

func (*Store) UpsertAgentSchema

func (s *Store) UpsertAgentSchema(ctx context.Context, schema *models.AgentSchema) error

func (*Store) UpsertCronSchedule

func (s *Store) UpsertCronSchedule(ctx context.Context, sched *models.CronSchedule) error

func (*Store) UpsertFinOpsOverlay

func (s *Store) UpsertFinOpsOverlay(ctx context.Context, o *models.FinOpsOverlay) error

UpsertFinOpsOverlay replaces the singleton overlay document.

func (*Store) UpsertKillSwitch

func (s *Store) UpsertKillSwitch(ctx context.Context, k *models.KillSwitch) error

func (*Store) UpsertMandatoryHITLRule

func (s *Store) UpsertMandatoryHITLRule(ctx context.Context, r *models.MandatoryHITLRule) error

UpsertMandatoryHITLRule inserts or replaces a rule by id; enforces unique (tenant_id, agent_id, connector).

func (*Store) UpsertPolicyGrant

func (s *Store) UpsertPolicyGrant(ctx context.Context, g *models.PolicyGrant) error

UpsertPolicyGrant inserts or replaces a grant by id; enforces unique (tenant_id, agent_id, connector).

func (*Store) UpsertUsageHold

func (s *Store) UpsertUsageHold(ctx context.Context, h *models.UsageHold) error

func (*Store) WriteAuditEvent

func (s *Store) WriteAuditEvent(ctx context.Context, ev *models.AuditEvent) error

WriteAuditEvent persists one policy/security decision. SQL backends (Postgres/MySQL/SQLite) implement this; Mongo callers type-assert and skip durable audit.

func (*Store) WriteUsageEvent

func (s *Store) WriteUsageEvent(ctx context.Context, ev *models.UsageEvent) error

WriteUsageEvent upserts one usage row keyed by (run_id, source).

Jump to

Keyboard shortcuts

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