Documentation
¶
Index ¶
- type Store
- func (s *Store) AddAuditEvent(ctx context.Context, e *repo.AuditEvent) error
- func (s *Store) BindingsForConsumer(ctx context.Context, consumerTileID string) ([]repo.ResourceBinding, error)
- func (s *Store) BurnDropLink(ctx context.Context, id string, vars []repo.Variable) (bool, error)
- func (s *Store) BurnJoinKey(ctx context.Context, key string) (bool, error)
- func (s *Store) BurnServerJoinKeys(ctx context.Context, serverID string) (int, error)
- func (s *Store) ClaimSecretLink(ctx context.Context, id, state string) (bool, error)
- func (s *Store) ClaimWorkItem(ctx context.Context, id string) (bool, error)
- func (s *Store) ClaimedNetworks(ctx context.Context) ([]string, error)
- func (s *Store) ClearDeclaredIntended(ctx context.Context, envID string) error
- func (s *Store) CloseOrphanCronRuns(ctx context.Context) error
- func (s *Store) CountStacksAwaitingPlan(ctx context.Context, orgID string) (int, error)
- func (s *Store) CountStagedByEnv(ctx context.Context, envID string) (int, error)
- func (s *Store) CountUnreadNotifications(ctx context.Context, userID string) (int, error)
- func (s *Store) CountUsers(ctx context.Context) (int, error)
- func (s *Store) Create(ctx context.Context, session *auth.Session) error
- func (s *Store) CreateAPIKey(ctx context.Context, k *repo.APIKey) error
- func (s *Store) CreateBackup(ctx context.Context, b *repo.Backup) error
- func (s *Store) CreateBackupDestination(ctx context.Context, d *repo.BackupDestination) error
- func (s *Store) CreateBackupRun(ctx context.Context, r *repo.BackupRun) error
- func (s *Store) CreateBinding(ctx context.Context, b *repo.ResourceBinding) error
- func (s *Store) CreateConfigPlan(ctx context.Context, p *repo.ConfigPlan) error
- func (s *Store) CreateConnector(ctx context.Context, cn *repo.Connector) error
- func (s *Store) CreateCronRun(ctx context.Context, r *repo.CronRun) error
- func (s *Store) CreateDeployment(ctx context.Context, d *repo.Deployment) error
- func (s *Store) CreateDomain(ctx context.Context, d *repo.Domain) error
- func (s *Store) CreateDomainResource(ctx context.Context, r *repo.DomainResource) error
- func (s *Store) CreateEnvironment(ctx context.Context, e *repo.Environment) error
- func (s *Store) CreateInvite(ctx context.Context, i *repo.Invite) error
- func (s *Store) CreateJoinKey(ctx context.Context, k *repo.JoinKey) error
- func (s *Store) CreateNotification(ctx context.Context, n *repo.Notification) error
- func (s *Store) CreateOrg(ctx context.Context, o *repo.Org) error
- func (s *Store) CreateOrgConfigPlan(ctx context.Context, p *repo.ConfigPlan) error
- func (s *Store) CreateOrgRegistryCredential(ctx context.Context, c *repo.OrgRegistryCredential) error
- func (s *Store) CreateProvision(ctx context.Context, p *repo.Provision) error
- func (s *Store) CreateRegistry(ctx context.Context, r *repo.Registry) error
- func (s *Store) CreateResource(ctx context.Context, r *repo.ManagedResource) error
- func (s *Store) CreateSecretLink(ctx context.Context, l *repo.SecretLink) error
- func (s *Store) CreateServer(ctx context.Context, sv *repo.Server) error
- func (s *Store) CreateStack(ctx context.Context, st *repo.Stack) error
- func (s *Store) CreateStagedChange(ctx context.Context, sc *repo.StagedChange) error
- func (s *Store) CreateStorage(ctx context.Context, st *repo.Storage) error
- func (s *Store) CreateStoragePath(ctx context.Context, p *repo.StoragePath) error
- func (s *Store) CreateTile(ctx context.Context, t *repo.Tile) error
- func (s *Store) CreateUser(ctx context.Context, user *repo.User) error
- func (s *Store) CreateWorkItem(ctx context.Context, w *repo.WorkItem) error
- func (s *Store) DB() *sqlx.DB
- func (s *Store) Delete(ctx context.Context, id string) error
- func (s *Store) DeleteAPIKey(ctx context.Context, id string) error
- func (s *Store) DeleteAllNotifications(ctx context.Context, userID string) error
- func (s *Store) DeleteAnnotation(ctx context.Context, ownerID, id string) error
- func (s *Store) DeleteBackup(ctx context.Context, id string) error
- func (s *Store) DeleteBackupDestination(ctx context.Context, id string) error
- func (s *Store) DeleteBinding(ctx context.Context, resourceID, consumerTileID string) error
- func (s *Store) DeleteBySubjectID(ctx context.Context, subjectID string) error
- func (s *Store) DeleteConnector(ctx context.Context, id string) error
- func (s *Store) DeleteDomain(ctx context.Context, id string) error
- func (s *Store) DeleteDomainResource(ctx context.Context, id string) error
- func (s *Store) DeleteEnvironment(ctx context.Context, id string) error
- func (s *Store) DeleteGraphGroup(ctx context.Context, ownerID, id string) error
- func (s *Store) DeleteIntended(ctx context.Context, envID, tileSlug, key string) error
- func (s *Store) DeleteInvite(ctx context.Context, id string) error
- func (s *Store) DeleteNodePositions(ctx context.Context, ownerID string) error
- func (s *Store) DeleteOrg(ctx context.Context, id string) error
- func (s *Store) DeleteOrgMember(ctx context.Context, orgID, userID string) error
- func (s *Store) DeleteOrgRegistryCredential(ctx context.Context, id string) error
- func (s *Store) DeleteProvision(ctx context.Context, id string) error
- func (s *Store) DeleteRegistry(ctx context.Context, id string) error
- func (s *Store) DeleteResource(ctx context.Context, id string) error
- func (s *Store) DeleteSecretLink(ctx context.Context, id string) error
- func (s *Store) DeleteServer(ctx context.Context, id string) error
- func (s *Store) DeleteStack(ctx context.Context, id string) error
- func (s *Store) DeleteStagedByEnv(ctx context.Context, envID string) error
- func (s *Store) DeleteStagedChange(ctx context.Context, id string) error
- func (s *Store) DeleteStorage(ctx context.Context, id string) error
- func (s *Store) DeleteStoragePath(ctx context.Context, id string) error
- func (s *Store) DeleteSystemOrgRegistryCredential(ctx context.Context, id string) error
- func (s *Store) DeleteTile(ctx context.Context, id string) error
- func (s *Store) DeleteVariable(ctx context.Context, ownerKind, ownerID, name string) error
- func (s *Store) EnvironmentsWithoutNetwork(ctx context.Context) ([]string, error)
- func (s *Store) FinishCronRun(ctx context.Context, r *repo.CronRun) error
- func (s *Store) FinishWorkItem(ctx context.Context, id, status, errMsg string) error
- func (s *Store) GetAPIKeyByHash(ctx context.Context, hash string) (*repo.APIKey, error)
- func (s *Store) GetBackup(ctx context.Context, id string) (*repo.Backup, error)
- func (s *Store) GetBackupDestination(ctx context.Context, id string) (*repo.BackupDestination, error)
- func (s *Store) GetBackupRun(ctx context.Context, id string) (*repo.BackupRun, error)
- func (s *Store) GetByToken(ctx context.Context, token string) (*auth.Session, error)
- func (s *Store) GetConfigPlan(ctx context.Context, id string) (*repo.ConfigPlan, error)
- func (s *Store) GetConnector(ctx context.Context, id string) (*repo.Connector, error)
- func (s *Store) GetCronRun(ctx context.Context, id string) (*repo.CronRun, error)
- func (s *Store) GetDeployment(ctx context.Context, id string) (*repo.Deployment, error)
- func (s *Store) GetDomain(ctx context.Context, id string) (*repo.Domain, error)
- func (s *Store) GetDomainByHostPath(ctx context.Context, host, path string) (*repo.Domain, error)
- func (s *Store) GetEnvironment(ctx context.Context, id string) (*repo.Environment, error)
- func (s *Store) GetEnvironmentBySlug(ctx context.Context, stackID, slug string) (*repo.Environment, error)
- func (s *Store) GetInvite(ctx context.Context, id string) (*repo.Invite, error)
- func (s *Store) GetJoinKey(ctx context.Context, key string) (*repo.JoinKey, error)
- func (s *Store) GetManagedRegistry(ctx context.Context) (*repo.Registry, error)
- func (s *Store) GetOrg(ctx context.Context, id string) (*repo.Org, error)
- func (s *Store) GetOrgBySlug(ctx context.Context, slug string) (*repo.Org, error)
- func (s *Store) GetOrgConfigPlan(ctx context.Context, id string) (*repo.ConfigPlan, error)
- func (s *Store) GetOrgMember(ctx context.Context, orgID, userID string) (*repo.OrgMember, error)
- func (s *Store) GetOrgRegistryCredential(ctx context.Context, id string) (*repo.OrgRegistryCredential, error)
- func (s *Store) GetOrgRegistryCredentialByHash(ctx context.Context, hash string) (*repo.OrgRegistryCredential, error)
- func (s *Store) GetOrgStorageBySlug(ctx context.Context, orgID, slug string) (*repo.Storage, error)
- func (s *Store) GetProvision(ctx context.Context, id string) (*repo.Provision, error)
- func (s *Store) GetRegistry(ctx context.Context, id string) (*repo.Registry, error)
- func (s *Store) GetResource(ctx context.Context, id string) (*repo.ManagedResource, error)
- func (s *Store) GetSecretLinkByHash(ctx context.Context, tokenHash string) (*repo.SecretLink, error)
- func (s *Store) GetServer(ctx context.Context, id string) (*repo.Server, error)
- func (s *Store) GetServerByNodeID(ctx context.Context, nodeID string) (*repo.Server, error)
- func (s *Store) GetSetting(ctx context.Context, key string) (string, error)
- func (s *Store) GetStack(ctx context.Context, id string) (*repo.Stack, error)
- func (s *Store) GetStackBySlug(ctx context.Context, orgID, slug string) (*repo.Stack, error)
- func (s *Store) GetStagedChange(ctx context.Context, id string) (*repo.StagedChange, error)
- func (s *Store) GetStorage(ctx context.Context, id string) (*repo.Storage, error)
- func (s *Store) GetStorageBySlug(ctx context.Context, slug string) (*repo.Storage, error)
- func (s *Store) GetStoragePath(ctx context.Context, id string) (*repo.StoragePath, error)
- func (s *Store) GetTile(ctx context.Context, id string) (*repo.Tile, error)
- func (s *Store) GetTileBySlug(ctx context.Context, envID, slug string) (*repo.Tile, error)
- func (s *Store) GetUserByEmail(ctx context.Context, email string) (*repo.User, error)
- func (s *Store) GetUserByID(ctx context.Context, id string) (*repo.User, error)
- func (s *Store) GetWorkItem(ctx context.Context, id string) (*repo.WorkItem, error)
- func (s *Store) Health(ctx context.Context) error
- func (s *Store) HomeEnvironment(ctx context.Context, stackID string) (*repo.Environment, error)
- func (s *Store) InsertMetric(ctx context.Context, m *repo.Metric) error
- func (s *Store) LatestConfigPlan(ctx context.Context, stackID string) (*repo.ConfigPlan, error)
- func (s *Store) LatestJoinKey(ctx context.Context, serverID string) (*repo.JoinKey, error)
- func (s *Store) LatestWorkItem(ctx context.Context, kind, dedupeKey string) (*repo.WorkItem, error)
- func (s *Store) ListAPIKeys(ctx context.Context) ([]repo.APIKey, error)
- func (s *Store) ListAllAuditEvents(ctx context.Context, actor, action string, limit int) ([]repo.AuditEvent, error)
- func (s *Store) ListAnnotations(ctx context.Context, ownerID string) ([]repo.Annotation, error)
- func (s *Store) ListAuditEvents(ctx context.Context, ownerKind, ownerID string, limit int) ([]repo.AuditEvent, error)
- func (s *Store) ListBackupDestinations(ctx context.Context) ([]repo.BackupDestination, error)
- func (s *Store) ListBackupRuns(ctx context.Context, backupID string, limit int) ([]repo.BackupRun, error)
- func (s *Store) ListBackups(ctx context.Context) ([]repo.Backup, error)
- func (s *Store) ListBackupsByTile(ctx context.Context, tileID string) ([]repo.Backup, error)
- func (s *Store) ListBindingsByResource(ctx context.Context, resourceID string) ([]repo.ResourceBinding, error)
- func (s *Store) ListConfigPlans(ctx context.Context, stackID string, limit int) ([]repo.ConfigPlan, error)
- func (s *Store) ListConnectors(ctx context.Context) ([]repo.Connector, error)
- func (s *Store) ListConnectorsByOrg(ctx context.Context, orgID string) ([]repo.Connector, error)
- func (s *Store) ListCronRuns(ctx context.Context, ref string, limit int) ([]repo.CronRun, error)
- func (s *Store) ListDeploymentsByStatus(ctx context.Context, status string) ([]repo.Deployment, error)
- func (s *Store) ListDeploymentsByTile(ctx context.Context, tileID string, limit int) ([]repo.Deployment, error)
- func (s *Store) ListDomainResources(ctx context.Context) ([]repo.DomainResource, error)
- func (s *Store) ListDomains(ctx context.Context) ([]repo.Domain, error)
- func (s *Store) ListDomainsByTile(ctx context.Context, tileID string) ([]repo.Domain, error)
- func (s *Store) ListEnvironmentsByStack(ctx context.Context, stackID string) ([]repo.Environment, error)
- func (s *Store) ListGraphGroups(ctx context.Context, ownerID string) ([]repo.GraphGroup, error)
- func (s *Store) ListIntended(ctx context.Context, envID string) ([]repo.Intended, error)
- func (s *Store) ListInvitesByOrg(ctx context.Context, orgID string) ([]repo.Invite, error)
- func (s *Store) ListMetrics(ctx context.Context, ref string, since time.Time) ([]repo.Metric, error)
- func (s *Store) ListNodePositions(ctx context.Context, ownerID string) ([]repo.NodePosition, error)
- func (s *Store) ListNotifications(ctx context.Context, userID string, limit int) ([]repo.Notification, error)
- func (s *Store) ListOpenCronRuns(ctx context.Context) ([]repo.CronRun, error)
- func (s *Store) ListOrgConfigPlans(ctx context.Context, orgID string, limit int) ([]repo.ConfigPlan, error)
- func (s *Store) ListOrgMembers(ctx context.Context, orgID string) ([]repo.OrgMember, error)
- func (s *Store) ListOrgRegistryCredentials(ctx context.Context, orgID string) ([]repo.OrgRegistryCredential, error)
- func (s *Store) ListOrgs(ctx context.Context) ([]repo.Org, error)
- func (s *Store) ListOrgsForUser(ctx context.Context, userID string) ([]repo.Org, error)
- func (s *Store) ListOutputs(ctx context.Context, resourceID string) ([]repo.ResourceOutput, error)
- func (s *Store) ListProvisionsByConsumer(ctx context.Context, consumerTileID string) ([]repo.Provision, error)
- func (s *Store) ListProvisionsByEnv(ctx context.Context, envID string) ([]repo.Provision, error)
- func (s *Store) ListProvisionsByInstance(ctx context.Context, instanceTileID string) ([]repo.Provision, error)
- func (s *Store) ListRegistries(ctx context.Context) ([]repo.Registry, error)
- func (s *Store) ListResourcesByEnv(ctx context.Context, envID string) ([]repo.ManagedResource, error)
- func (s *Store) ListResourcesByProvider(ctx context.Context, providerTileID string) ([]repo.ManagedResource, error)
- func (s *Store) ListSecretLinks(ctx context.Context, ownerKind, ownerID string) ([]repo.SecretLink, error)
- func (s *Store) ListServers(ctx context.Context) ([]repo.Server, error)
- func (s *Store) ListStacks(ctx context.Context) ([]repo.Stack, error)
- func (s *Store) ListStacksByOrg(ctx context.Context, orgID string) ([]repo.Stack, error)
- func (s *Store) ListStagedByEnv(ctx context.Context, envID string) ([]repo.StagedChange, error)
- func (s *Store) ListStagedByStack(ctx context.Context, stackID string) ([]repo.StagedChange, error)
- func (s *Store) ListStorage(ctx context.Context) ([]repo.Storage, error)
- func (s *Store) ListStoragePaths(ctx context.Context, storageID string) ([]repo.StoragePath, error)
- func (s *Store) ListTiles(ctx context.Context) ([]repo.Tile, error)
- func (s *Store) ListTilesByEnv(ctx context.Context, envID string) ([]repo.Tile, error)
- func (s *Store) ListTilesByStack(ctx context.Context, stackID string) ([]repo.Tile, error)
- func (s *Store) ListUsers(ctx context.Context) ([]repo.User, error)
- func (s *Store) ListVariableNames(ctx context.Context) ([]repo.Variable, error)
- func (s *Store) ListVariables(ctx context.Context, ownerKind, ownerID string) ([]repo.Variable, error)
- func (s *Store) ListWorkItemsByStatus(ctx context.Context, status string) ([]repo.WorkItem, error)
- func (s *Store) MarkAllNotificationsRead(ctx context.Context, userID string) error
- func (s *Store) MarkInviteUsed(ctx context.Context, id string) error
- func (s *Store) OpenCronRun(ctx context.Context, ref string) (*repo.CronRun, error)
- func (s *Store) PruneCronRuns(ctx context.Context, before time.Time) error
- func (s *Store) PruneMetrics(ctx context.Context, before time.Time) error
- func (s *Store) PruneNotifications(ctx context.Context, before time.Time) error
- func (s *Store) RecordTileRun(ctx context.Context, id, status, output string) error
- func (s *Store) RenameEnvironment(ctx context.Context, id, name, slug string) error
- func (s *Store) RenameTile(ctx context.Context, id, name, slug string) error
- func (s *Store) ReplaceTileVars(ctx context.Context, t *repo.Tile) error
- func (s *Store) RequeueWorkItem(ctx context.Context, id string) error
- func (s *Store) SaveNodePositions(ctx context.Context, ownerID string, ps []repo.NodePosition) error
- func (s *Store) SetConfigPlanError(ctx context.Context, id, msg string) error
- func (s *Store) SetConfigPlanStatus(ctx context.Context, id, status string) error
- func (s *Store) SetDomainCert(ctx context.Context, id, certPEM, keyPEM string) error
- func (s *Store) SetDomainForceHTTPS(ctx context.Context, id string, force bool) error
- func (s *Store) SetDomainHTTPS(ctx context.Context, id string, https bool) error
- func (s *Store) SetDomainResourceACME(ctx context.Context, id, email string) error
- func (s *Store) SetEnvironmentNetwork(ctx context.Context, envID, name string) error
- func (s *Store) SetEnvironmentProxy(ctx context.Context, envID, ip, cidr string) error
- func (s *Store) SetIntended(ctx context.Context, row *repo.Intended) error
- func (s *Store) SetOrgConfigPlanError(ctx context.Context, id, msg string) error
- func (s *Store) SetOrgConfigPlanStatus(ctx context.Context, id, status string) error
- func (s *Store) SetSetting(ctx context.Context, key, value string) error
- func (s *Store) SetStackOrg(ctx context.Context, stackID, orgID string) error
- func (s *Store) SetTileHomeNode(ctx context.Context, id, nodeID string) error
- func (s *Store) SetTileImageDigest(ctx context.Context, id, digest string) error
- func (s *Store) SetTileLatestDigest(ctx context.Context, id, digest string) error
- func (s *Store) SetTileSharedNet(ctx context.Context, tileID, name string) error
- func (s *Store) SetWorkItemProgress(ctx context.Context, id, step, progress string) error
- func (s *Store) SupersedePendingOrgPlans(ctx context.Context, orgID string) error
- func (s *Store) SupersedePendingPlans(ctx context.Context, stackID, envSlug string) error
- func (s *Store) SupersedeQueuedWorkItems(ctx context.Context, kind, dedupeKey, exceptID string) error
- func (s *Store) SweepStaleRuns(ctx context.Context) error
- func (s *Store) TouchOrgRegistryCredential(ctx context.Context, id string) error
- func (s *Store) TouchSecretLink(ctx context.Context, id string, attempts int, openedAt sql.NullTime) error
- func (s *Store) UpdateBackup(ctx context.Context, b *repo.Backup) error
- func (s *Store) UpdateBackupDestination(ctx context.Context, d *repo.BackupDestination) error
- func (s *Store) UpdateBackupRun(ctx context.Context, r *repo.BackupRun) error
- func (s *Store) UpdateConnector(ctx context.Context, cn *repo.Connector) error
- func (s *Store) UpdateDeployment(ctx context.Context, d *repo.Deployment) error
- func (s *Store) UpdateDomainResource(ctx context.Context, r *repo.DomainResource) error
- func (s *Store) UpdateEnvironment(ctx context.Context, e *repo.Environment) error
- func (s *Store) UpdateOrg(ctx context.Context, o *repo.Org) error
- func (s *Store) UpdateProvision(ctx context.Context, p *repo.Provision) error
- func (s *Store) UpdateRegistry(ctx context.Context, r *repo.Registry) error
- func (s *Store) UpdateResource(ctx context.Context, r *repo.ManagedResource) error
- func (s *Store) UpdateServer(ctx context.Context, sv *repo.Server) error
- func (s *Store) UpdateStack(ctx context.Context, st *repo.Stack) error
- func (s *Store) UpdateStorage(ctx context.Context, st *repo.Storage) error
- func (s *Store) UpdateTile(ctx context.Context, t *repo.Tile) error
- func (s *Store) UpdateTileStatus(ctx context.Context, id, status string) error
- func (s *Store) UpdateUser(ctx context.Context, user *repo.User) error
- func (s *Store) UpsertAnnotation(ctx context.Context, a *repo.Annotation) error
- func (s *Store) UpsertGraphGroup(ctx context.Context, g *repo.GraphGroup) error
- func (s *Store) UpsertNodePosition(ctx context.Context, p *repo.NodePosition) error
- func (s *Store) UpsertOrgMember(ctx context.Context, m *repo.OrgMember) error
- func (s *Store) UpsertOutput(ctx context.Context, o *repo.ResourceOutput) error
- func (s *Store) UpsertVariable(ctx context.Context, v *repo.Variable) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements repo.Store using SQLite.
func (*Store) AddAuditEvent ¶
func (*Store) BindingsForConsumer ¶
func (s *Store) BindingsForConsumer(ctx context.Context, consumerTileID string) ([]repo.ResourceBinding, error)
BindingsForConsumer is the resolver's authorization lookup: everything this tile is allowed to read outputs from.
func (*Store) BurnDropLink ¶
BurnDropLink is ClaimSecretLink(burned) plus the variable writes in one transaction: a failed write rolls the burn back too, so the link stays open and the sender can resubmit, never a burned link with half the values.
func (*Store) BurnJoinKey ¶
BurnJoinKey marks a key used. One-time by construction: the update only matches a key nobody has spent yet, so two joins racing the same key means exactly one of them gets a row back.
func (*Store) BurnServerJoinKeys ¶
BurnServerJoinKeys spends every key a server still has unspent, and returns how many it took.
This is what revoking means here. IssueKey only ever inserts, so before this existed a second "new script" left the first key working for the rest of its hour: an operator who pasted a join command somewhere they should not have had nothing in the product that would stop it.
func (*Store) ClaimSecretLink ¶
ClaimSecretLink flips an open link to state and reports whether this caller won the race. Callers must act only when it returns true, checking the state and then writing would let two concurrent submits both through.
func (*Store) ClaimWorkItem ¶
ClaimWorkItem moves one queued item to running, reporting whether this caller got it. The rows-affected check is the whole lock: two claimers race on the same UPDATE and exactly one sees a row change.
One panel process today, so this is enough, and it stays correct if a second ever appears, which matters because panel failover is on the roadmap (docs/notes.md, misc). No leases until there is a second writer.
func (*Store) ClaimedNetworks ¶
ClaimedNetworks lists every pooled network name a row still holds, from both owner tables at once. One query rather than walking stacks: the pool is global, and a name missed here is a network handed to a second tenant.
func (*Store) ClearDeclaredIntended ¶
func (*Store) CloseOrphanCronRuns ¶
CloseOrphanCronRuns finishes runs left open by a crash or a restart. The row is written before the work starts, and the in-memory overlap lock does not survive the process, so without this the panel shows a run as still going forever, and nothing will ever close it.
func (*Store) CountStacksAwaitingPlan ¶
CountStacksAwaitingPlan is how many of an org's stacks have a newest plan still waiting on someone (pending or error). Newest only: an old error plan that a later plan moved past is history, not a decision to make.
func (*Store) CountStagedByEnv ¶
func (*Store) CountUnreadNotifications ¶
func (*Store) Create ¶
Create inserts a new session row. To store extra metadata, add your own columns to the sessions table and populate them here, or store a JSON blob if you prefer.
func (*Store) CreateAPIKey ¶
func (*Store) CreateBackup ¶
func (*Store) CreateBackupDestination ¶
func (*Store) CreateBackupRun ¶
func (*Store) CreateBinding ¶
func (*Store) CreateConfigPlan ¶
func (*Store) CreateConnector ¶
func (*Store) CreateCronRun ¶
func (*Store) CreateDeployment ¶
func (*Store) CreateDomain ¶
func (*Store) CreateDomainResource ¶
func (*Store) CreateEnvironment ¶
func (*Store) CreateInvite ¶
func (*Store) CreateJoinKey ¶
func (*Store) CreateNotification ¶
func (*Store) CreateOrgConfigPlan ¶
func (*Store) CreateOrgRegistryCredential ¶
func (*Store) CreateProvision ¶
func (*Store) CreateRegistry ¶
func (*Store) CreateResource ¶
func (*Store) CreateSecretLink ¶
func (*Store) CreateServer ¶
func (*Store) CreateStack ¶
CreateStack inserts the stack and its home environment together: a stack without a home has nowhere to put a shared tile.
func (*Store) CreateStagedChange ¶
func (*Store) CreateStorage ¶
func (*Store) CreateStoragePath ¶
func (*Store) CreateWorkItem ¶
func (*Store) DeleteAllNotifications ¶
func (*Store) DeleteAnnotation ¶
func (*Store) DeleteBackupDestination ¶
func (*Store) DeleteBinding ¶
func (*Store) DeleteBySubjectID ¶
func (*Store) DeleteConnector ¶
func (*Store) DeleteDomainResource ¶
func (*Store) DeleteEnvironment ¶
func (*Store) DeleteGraphGroup ¶
func (*Store) DeleteIntended ¶
func (*Store) DeleteNodePositions ¶
func (*Store) DeleteOrg ¶
DeleteOrg removes the org and every canvas layout under it. The org's own layout plus one env- and one stack-scoped row set per stack: stacks cascade through their FK, but node_positions has none (it also holds org layouts), so those rows would be orphaned by the cascade.
func (*Store) DeleteOrgMember ¶
func (*Store) DeleteOrgRegistryCredential ¶
func (*Store) DeleteProvision ¶
func (*Store) DeleteResource ¶
DeleteResource takes its outputs and bindings with it, SQLite runs without foreign keys here, so nothing else would collect the orphans.
func (*Store) DeleteSecretLink ¶
func (*Store) DeleteStagedByEnv ¶
func (*Store) DeleteStagedChange ¶
func (*Store) DeleteStoragePath ¶
func (*Store) DeleteSystemOrgRegistryCredential ¶
DeleteSystemOrgRegistryCredential removes a system row, which the public delete refuses. The only caller is the repair path: the registry password changed, so the stored hash can never match again and the row is replaced.
func (*Store) DeleteVariable ¶
func (*Store) EnvironmentsWithoutNetwork ¶
EnvironmentsWithoutNetwork lists environments that hold no pooled overlay.
Only ever non-empty on an install upgraded across 009, which added the column with an empty default and backfilled nothing: every environment that existed before the upgrade sat on no overlay until its next deploy, and the proxy quietly left it out of its routing map in the meantime.
func (*Store) FinishCronRun ¶
FinishCronRun closes out a run inserted while it was still going. Only the three columns a finish can move are written, so nothing races the insert.
func (*Store) FinishWorkItem ¶
FinishWorkItem records how an item ended. errMsg empty means it worked.
func (*Store) GetAPIKeyByHash ¶
func (*Store) GetBackupDestination ¶
func (*Store) GetBackupRun ¶
func (*Store) GetByToken ¶
func (*Store) GetConfigPlan ¶
func (*Store) GetConnector ¶
func (*Store) GetCronRun ¶
func (*Store) GetDeployment ¶
func (*Store) GetDomainByHostPath ¶
GetDomainByHostPath finds the domain claiming a host+path (nil if free), the plain row before any rule row on it. Used to reject duplicate and cross-tenant host claims before insert: a rule row owns the host+path for its tile as much as a plain one does.
func (*Store) GetEnvironment ¶
func (*Store) GetEnvironmentBySlug ¶
func (*Store) GetJoinKey ¶
func (*Store) GetManagedRegistry ¶
func (*Store) GetOrgBySlug ¶
func (*Store) GetOrgConfigPlan ¶
func (*Store) GetOrgMember ¶
func (*Store) GetOrgRegistryCredential ¶
func (*Store) GetOrgRegistryCredentialByHash ¶
func (*Store) GetOrgStorageBySlug ¶ added in v0.2.0
func (*Store) GetProvision ¶
func (*Store) GetRegistry ¶
func (*Store) GetResource ¶
func (*Store) GetSecretLinkByHash ¶
func (*Store) GetServerByNodeID ¶
GetServerByNodeID finds the row mirroring one swarm node. Used to reconcile `docker node ls` against the table on every servers-list load.
func (*Store) GetSetting ¶
func (*Store) GetStackBySlug ¶
func (*Store) GetStagedChange ¶
func (*Store) GetStorage ¶
func (*Store) GetStorageBySlug ¶
GetStorageBySlug finds a server pool or share. Org shares are not found here: their slugs are only unique inside one org (GetOrgStorageBySlug).
func (*Store) GetStoragePath ¶
func (*Store) GetTileBySlug ¶
func (*Store) GetUserByEmail ¶
func (*Store) GetUserByID ¶
func (*Store) GetWorkItem ¶
func (*Store) HomeEnvironment ¶
func (*Store) InsertMetric ¶
func (*Store) LatestConfigPlan ¶
LatestConfigPlan returns the newest plan for a stack (nil if none).
func (*Store) LatestJoinKey ¶
LatestJoinKey is the newest key issued for a server, so a pending row can show its script again without minting a second one.
func (*Store) LatestWorkItem ¶
LatestWorkItem is the newest item of one kind and key, whatever its status. The plan page polls this to find the apply it just asked for without having to remember an id across a redirect.
func (*Store) ListAllAuditEvents ¶
func (s *Store) ListAllAuditEvents(ctx context.Context, actor, action string, limit int) ([]repo.AuditEvent, error)
ListAllAuditEvents is the admin view: every secret read and write on the server, newest first, optionally narrowed to one actor or one action.
Server-wide and so admin-only: the per-owner listing above is what a tenant sees, and it is already scoped by the owner they are looking at.
func (*Store) ListAnnotations ¶
func (*Store) ListAuditEvents ¶
func (s *Store) ListAuditEvents(ctx context.Context, ownerKind, ownerID string, limit int) ([]repo.AuditEvent, error)
rowid rather than created_at, see ListDeploymentsByTile / stacks.go.
func (*Store) ListBackupDestinations ¶
func (*Store) ListBackupRuns ¶
func (s *Store) ListBackupRuns(ctx context.Context, backupID string, limit int) ([]repo.BackupRun, error)
rowid rather than created_at, see ListDeploymentsByTile / stacks.go. Display-only: keep-count pruning does NOT read this list (backup.go's prune sorts S3 object keys), so the only consumers are the two limit-10 history views in internal/web/handler.
func (*Store) ListBackupsByTile ¶
func (*Store) ListBindingsByResource ¶
func (*Store) ListConfigPlans ¶
func (*Store) ListConnectors ¶
func (*Store) ListConnectorsByOrg ¶
func (*Store) ListCronRuns ¶
rowid rather than started_at (TEXT, format-sensitive), see LatestConfigPlan in stacks.go. PruneCronRuns below is fine as is: it compares against a bound time.Time, so the driver normalises both sides to one format.
func (*Store) ListDeploymentsByStatus ¶
func (s *Store) ListDeploymentsByStatus(ctx context.Context, status string) ([]repo.Deployment, error)
ListDeploymentsByStatus: every deployment in one state, the CI gate scans waiting_ci rows each tick. Oldest first so grace/timeout fire in order.
func (*Store) ListDeploymentsByTile ¶
func (s *Store) ListDeploymentsByTile(ctx context.Context, tileID string, limit int) ([]repo.Deployment, error)
Newest-first by rowid, i.e. insert order, see the long note over LatestConfigPlan in stacks.go. created_at is TEXT, so ordering by it is a character comparison that only works while every writer agrees on a timestamp format, and one row written by a script or a migration in ISO form pins itself at the top forever. rowid ignores idx_deployments_tile(tile_id, created_at DESC), so this sorts every matching row instead of range-reading LIMIT rows off the index (same in notifications/backups/cron_runs). Fine at these row counts; re-point the index at rowid if a table ever grows enough to feel it.
func (*Store) ListDomainResources ¶
ListDomainResources returns every resource, a handful of rows; callers filter by visibility (own stack, its org, the instance).
func (*Store) ListDomainsByTile ¶
ListDomainsByTile orders by declaration position first, the primary domain (STACKR_PUBLIC_URL) is the first row.
func (*Store) ListEnvironmentsByStack ¶
func (*Store) ListGraphGroups ¶
func (*Store) ListIntended ¶
func (*Store) ListInvitesByOrg ¶
rowid rather than created_at, see ListDeploymentsByTile / stacks.go.
func (*Store) ListMetrics ¶
func (*Store) ListNodePositions ¶
func (*Store) ListNotifications ¶
func (s *Store) ListNotifications(ctx context.Context, userID string, limit int) ([]repo.Notification, error)
rowid rather than created_at, see ListDeploymentsByTile / stacks.go.
func (*Store) ListOpenCronRuns ¶
ListOpenCronRuns is every run in flight, for the canvas: one query instead of one per cron card.
func (*Store) ListOrgConfigPlans ¶
func (*Store) ListOrgMembers ¶
func (*Store) ListOrgRegistryCredentials ¶
func (*Store) ListOrgsForUser ¶
func (*Store) ListOutputs ¶
func (*Store) ListProvisionsByConsumer ¶
func (*Store) ListProvisionsByEnv ¶
func (*Store) ListProvisionsByInstance ¶
func (*Store) ListRegistries ¶
func (*Store) ListResourcesByEnv ¶
func (*Store) ListResourcesByProvider ¶
func (*Store) ListSecretLinks ¶
func (s *Store) ListSecretLinks(ctx context.Context, ownerKind, ownerID string) ([]repo.SecretLink, error)
ListSecretLinks is the operator's view of one scope, newest first. Dead rows are kept: the row names fields but never holds values, so it is the audit line for the exchange.
func (*Store) ListStacksByOrg ¶
func (*Store) ListStagedByEnv ¶
Oldest-first by rowid, i.e. insert order, see the note over LatestConfigPlan in stacks.go for why created_at (TEXT, format-sensitive) cannot order rows. This one is load-bearing, not just display: staging replays these in order and later entries win (stackconf/staging.go), so a mis-sorted row would apply a stale edit over a newer one.
func (*Store) ListStagedByStack ¶
func (*Store) ListStorage ¶
func (*Store) ListStoragePaths ¶
func (*Store) ListTilesByEnv ¶
func (*Store) ListTilesByStack ¶
func (*Store) ListVariableNames ¶
ListVariableNames feeds global search: owner + name + secret flag only. value is deliberately not selected, so nothing is decrypted and no secret material ever flows through the search path.
func (*Store) ListVariables ¶
func (*Store) ListWorkItemsByStatus ¶
ListWorkItemsByStatus is oldest first: the runner takes them in the order they were asked for, and boot recovery walks the rows a dead process left behind in the same order.
func (*Store) MarkAllNotificationsRead ¶
func (*Store) OpenCronRun ¶
OpenCronRun is the newest run of ref that has not finished; nil when there is none. The panel header asks this to know whether a tile is mid-run, tiles.status never says "running" for a cron.
func (*Store) PruneCronRuns ¶
func (*Store) PruneMetrics ¶
func (*Store) PruneNotifications ¶
func (*Store) RecordTileRun ¶
RecordTileRun stores the outcome of one cron-kind tile run on the tile row.
tiles.status is deliberately untouched. It is the tile's lifecycle (idle, building, error from a deploy), and every card that rolls tiles up takes the worst status in the group (graph.WorstStatus), so writing a failed run there reddened the whole environment and stack card for one bad tick. The run outcome lives in last_status/last_output, which is what the cron card's last-run line and the runs list read.
func (*Store) RenameEnvironment ¶
RenameEnvironment is RenameTile for an environment: same rule, the slug is identity and stays out of the general update.
func (*Store) RenameTile ¶
UpdateTile writes the whole editable row. Deliberately NOT status: a settings save carries whatever status the form was rendered with, so saving after a deploy finished used to revert the tile to its old state. Status moves only through UpdateTileStatus/RecordTileRun.
shared_net and home_node are out for the same reason: both are infrastructure facts the panel discovers (which db-pool overlay the instance holds, which node its volume is on), not fields any form renders, so a settings save would write back whatever stale value it was rendered with. They move only through SetTileSharedNet and SetTileHomeNode. RenameTile writes the two columns UpdateTile deliberately leaves alone.
Slug is not in UpdateTile for the same reason status is not: it is identity, not settings, and a general save carrying a stale copy of it would rename the tile behind whoever asked. The cost of that was that the config engine's moved: entries set t.Slug and called UpdateTile, so a declared rename tore the service down and then wrote nothing at all.
func (*Store) ReplaceTileVars ¶
ReplaceTileVars projects the blob and drops every non-secret row the blob doesn't declare. Only config apply calls it: the file is the whole truth for a managed tile, so a variable deleted from the file has to disappear from the resolver's view too, that's the drift the config lock exists to prevent. Secret rows survive; they never came from the blob.
goes away with projectEnvVars at R7.
func (*Store) RequeueWorkItem ¶
RequeueWorkItem puts a running row back in the queue. Boot recovery uses it for the kinds that are safe to run again from the top.
func (*Store) SaveNodePositions ¶
func (s *Store) SaveNodePositions(ctx context.Context, ownerID string, ps []repo.NodePosition) error
SaveNodePositions writes a whole layout atomically. Validation lives here rather than in each handler: three canvases post to this and the payload is untrusted, so the single choke point is where the rules belong.
func (*Store) SetConfigPlanError ¶
func (*Store) SetConfigPlanStatus ¶
SetConfigPlanStatus updates a plan's lifecycle state.
func (*Store) SetDomainCert ¶
func (*Store) SetDomainForceHTTPS ¶
SetDomainForceHTTPS flips the plain-HTTP bounce on its own. Serving TLS and redirecting onto it are two questions; a host that must still answer on http can have a certificate without being redirected.
func (*Store) SetDomainHTTPS ¶
func (*Store) SetDomainResourceACME ¶
SetDomainResourceACME sets the Let's Encrypt account certificates under this resource are issued on. Blank uses the instance's.
func (*Store) SetEnvironmentNetwork ¶
SetEnvironmentNetwork records the pooled overlay this env holds. Separate from UpdateEnvironment for the same reason as SetEnvironmentProxy: the writer is the pool, not a settings form, and a stale blank here would hand a live network to the next environment.
func (*Store) SetEnvironmentProxy ¶
SetEnvironmentProxy records where traefik landed on this env's network. Separate from UpdateEnvironment because the writer is the proxy, not the panel: folding it into the general update would let any settings save carry a stale (or zero) address back over it, the same shape as the bug that had UpdateTile reverting tile status.
func (*Store) SetIntended ¶
func (*Store) SetOrgConfigPlanError ¶
func (*Store) SetOrgConfigPlanStatus ¶
func (*Store) SetStackOrg ¶
func (*Store) SetTileHomeNode ¶
SetTileHomeNode records which swarm node a pinned tile's volume lives on. Deliberately its own writer and absent from UpdateTile: the home node is state, set on first deploy and changed only by a completed volume move, so an unrelated settings save must never carry a stale value over it. Losing the assignment is how swarm schedules a database onto an empty volume (docs/plans/30-docker-swarm.md, addendum).
func (*Store) SetTileImageDigest ¶
SetTileImageDigest records what a deploy actually pulled. Deliberately not part of UpdateTile: digests are runtime state like status, a settings save must never carry them.
func (*Store) SetTileLatestDigest ¶
SetTileLatestDigest records the newest digest the registry watcher has seen.
func (*Store) SetTileSharedNet ¶
SetTileSharedNet records the pooled overlay a shared managed instance holds.
func (*Store) SetWorkItemProgress ¶
SetWorkItemProgress writes the coarse step and the progress blob. Called from inside a running job, often, so it touches nothing else on the row.
func (*Store) SupersedePendingOrgPlans ¶
SupersedePendingOrgPlans is SupersedePendingPlans for the org file. Same undecided set: 'clean' and 'error' rows are replaced by a newer plan too, they were not, so a clean run left the previous clean row sitting beside it and a parse failure stayed at the top of the list after the file was fixed. (stack_id holds the ORG id on this table, see the header comment.)
func (*Store) SupersedePendingPlans ¶
SupersedePendingPlans marks undecided plans with the same scope superseded (a newer plan replaces them). Env-scoped plans only supersede their own env.
'error' is in the list because a plan that failed to parse is as undecided as a pending one: the operator fixes the file, plans again, and the red row from the broken commit otherwise stays at the top of the list looking current forever. Only 'applied' and 'rejected' are decisions, and those two are history.
func (*Store) SupersedeQueuedWorkItems ¶
func (s *Store) SupersedeQueuedWorkItems(ctx context.Context, kind, dedupeKey, exceptID string) error
SupersedeQueuedWorkItems marks every waiting item of this kind and key superseded, except the one just enqueued. Only queued rows: a running job is already changing containers and databases, and abandoning it halfway is worse than letting it finish and be overwritten by the next one.
Older only, by rowid. "Everything but me" is not the same rule: two enqueues landing together each superseded the other and neither job ever ran, because ids are UUIDs and carry no order. rowid is already the queue order (ListWorkItemsByStatus, LatestWorkItem), so the later row wins and the earlier one is what gets dropped.
func (*Store) SweepStaleRuns ¶
SweepStaleRuns finishes work that died with the previous process. A deployment is only ever moved out of queued/running by the goroutine driving it, so anything still in those states at startup is orphaned; the tile it was building is marked stopped rather than error, and the metrics reconciler promotes it back to running on its next tick if the container is in fact up.
func (*Store) TouchOrgRegistryCredential ¶
func (*Store) TouchSecretLink ¶
func (s *Store) TouchSecretLink(ctx context.Context, id string, attempts int, openedAt sql.NullTime) error
TouchSecretLink writes back the two fields that move without burning the link: the failed-passphrase count and the first-access stamp. Callers pass the values they read, so "stamp only on first access" is decided in the service, not here.
func (*Store) UpdateBackup ¶
func (*Store) UpdateBackupDestination ¶
UpdateBackupDestination rewrites the editable fields. An empty SecretKey keeps the stored one, the form never renders the secret back, so a save that leaves the field blank must not blank the credential.
func (*Store) UpdateBackupRun ¶
func (*Store) UpdateConnector ¶
func (*Store) UpdateDeployment ¶
func (*Store) UpdateDomainResource ¶
func (*Store) UpdateEnvironment ¶
func (*Store) UpdateProvision ¶
func (*Store) UpdateRegistry ¶
func (*Store) UpdateResource ¶
func (*Store) UpdateServer ¶
func (*Store) UpdateStorage ¶
func (*Store) UpdateTileStatus ¶
func (*Store) UpdateUser ¶
UpdateUser also writes email and notification preferences, the account screen edits both, and leaving them out silently discarded the change.
func (*Store) UpsertAnnotation ¶
UpsertAnnotation validates then writes; the cap guards the same abuse the node-position limit does.
func (*Store) UpsertGraphGroup ¶
UpsertGraphGroup validates then writes; the cap guards the same abuse the annotation limit does.