mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-10-28 07:41:27 +00:00
Agents report per-container net IO at heartbeat; the sleeper measures idleness from those counters for remote services, removes replicas via the agent queue, and repoints the domain route at the backend's new /internal/wake-page endpoint (replacePath + priority-100 route in the file provider). First hit serves a reloading page and retriggers the wake reconcile, which recreates replicas and restores real upstreams. Manual POST /services/:id/sleep also routes remote; local sleep/wake flow is unchanged. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
160 lines
12 KiB
Go
160 lines
12 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.31.1
|
|
|
|
package sqlcdb
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
"encoding/json"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Querier interface {
|
|
ClearServiceNodePins(ctx context.Context, nodeID sql.NullString) (int64, error)
|
|
CompleteCommand(ctx context.Context, arg CompleteCommandParams) (AgentCommand, error)
|
|
CountDatabaseServicesByUserAndName(ctx context.Context, arg CountDatabaseServicesByUserAndNameParams) (int64, error)
|
|
CountDatabasesUsingBackupTarget(ctx context.Context, targetID sql.NullString) (int64, error)
|
|
CountProjectsByUser(ctx context.Context, arg CountProjectsByUserParams) (int64, error)
|
|
CountServicesByProjectAndName(ctx context.Context, arg CountServicesByProjectAndNameParams) (int64, error)
|
|
CountUnreadNotificationsByUser(ctx context.Context, userID uuid.UUID) (int64, error)
|
|
CreateAgent(ctx context.Context, arg CreateAgentParams) (NodeAgent, error)
|
|
CreateAgentAuthToken(ctx context.Context, arg CreateAgentAuthTokenParams) (AgentAuthToken, error)
|
|
CreateBackupTarget(ctx context.Context, arg CreateBackupTargetParams) error
|
|
CreateBanner(ctx context.Context, arg CreateBannerParams) (Banner, error)
|
|
CreateCommand(ctx context.Context, arg CreateCommandParams) (AgentCommand, error)
|
|
CreateContainer(ctx context.Context, arg CreateContainerParams) (ContainerInstance, error)
|
|
CreateDatabaseBackup(ctx context.Context, arg CreateDatabaseBackupParams) error
|
|
CreateDatabaseService(ctx context.Context, arg CreateDatabaseServiceParams) error
|
|
CreateExternalDatabaseService(ctx context.Context, arg CreateExternalDatabaseServiceParams) error
|
|
CreateNotification(ctx context.Context, arg CreateNotificationParams) error
|
|
CreateOutboundWebhook(ctx context.Context, arg CreateOutboundWebhookParams) error
|
|
CreateProject(ctx context.Context, arg CreateProjectParams) (Project, error)
|
|
CreateServiceFromTemplate(ctx context.Context, arg CreateServiceFromTemplateParams) error
|
|
CreateUserInvite(ctx context.Context, arg CreateUserInviteParams) (UserInvite, error)
|
|
CreateUserTemplate(ctx context.Context, arg CreateUserTemplateParams) error
|
|
CreateUserToken(ctx context.Context, arg CreateUserTokenParams) (UserToken, error)
|
|
CreateWebhookDelivery(ctx context.Context, arg CreateWebhookDeliveryParams) error
|
|
DatabaseServiceExistsByIDAndUser(ctx context.Context, arg DatabaseServiceExistsByIDAndUserParams) (bool, error)
|
|
DeleteAgent(ctx context.Context, id string) error
|
|
DeleteBackupTargetByIDAndUser(ctx context.Context, arg DeleteBackupTargetByIDAndUserParams) error
|
|
DeleteBanner(ctx context.Context, id uuid.UUID) error
|
|
DeleteDatabaseServiceByID(ctx context.Context, id string) error
|
|
DeleteDatabaseServiceByIDAndUser(ctx context.Context, arg DeleteDatabaseServiceByIDAndUserParams) error
|
|
DeleteOutboundWebhookByIDAndUser(ctx context.Context, arg DeleteOutboundWebhookByIDAndUserParams) error
|
|
DeleteProjectByID(ctx context.Context, projectID uuid.UUID) (int64, error)
|
|
DeleteServiceContainersOnAgent(ctx context.Context, arg DeleteServiceContainersOnAgentParams) error
|
|
DeleteUserInvite(ctx context.Context, id uuid.UUID) error
|
|
DeleteUserTemplate(ctx context.Context, arg DeleteUserTemplateParams) (int64, error)
|
|
GetActiveAgentAuthTokenByHash(ctx context.Context, tokenHash string) (AgentAuthToken, error)
|
|
GetAgent(ctx context.Context, id string) (NodeAgent, error)
|
|
GetAgentByHostAndIP(ctx context.Context, arg GetAgentByHostAndIPParams) (NodeAgent, error)
|
|
GetBackupTargetByID(ctx context.Context, id string) (BackupTarget, error)
|
|
GetBackupTargetByIDAndUser(ctx context.Context, arg GetBackupTargetByIDAndUserParams) (BackupTarget, error)
|
|
GetBannerByID(ctx context.Context, id uuid.UUID) (Banner, error)
|
|
GetCommandForAgent(ctx context.Context, arg GetCommandForAgentParams) (AgentCommand, error)
|
|
GetContainer(ctx context.Context, id string) (ContainerInstance, error)
|
|
GetContainerForAgent(ctx context.Context, arg GetContainerForAgentParams) (ContainerInstance, error)
|
|
GetDatabaseBackupByIDAndDatabaseAndUser(ctx context.Context, arg GetDatabaseBackupByIDAndDatabaseAndUserParams) (DatabaseBackup, error)
|
|
GetDatabaseServiceByID(ctx context.Context, id string) (DatabaseService, error)
|
|
GetDatabaseServiceByIDAndUser(ctx context.Context, arg GetDatabaseServiceByIDAndUserParams) (DatabaseService, error)
|
|
GetDatabaseServiceOwnerID(ctx context.Context, id string) (string, error)
|
|
GetLastAgentCommandByType(ctx context.Context, arg GetLastAgentCommandByTypeParams) (AgentCommand, error)
|
|
GetOutboundWebhookByID(ctx context.Context, id uuid.UUID) (OutboundWebhook, error)
|
|
GetOutboundWebhookByIDAndUser(ctx context.Context, arg GetOutboundWebhookByIDAndUserParams) (OutboundWebhook, error)
|
|
GetProjectByIDForUser(ctx context.Context, arg GetProjectByIDForUserParams) (Project, error)
|
|
GetProjectOwnerByID(ctx context.Context, projectID uuid.UUID) (uuid.UUID, error)
|
|
GetProjectOwnerID(ctx context.Context, id uuid.UUID) (uuid.UUID, error)
|
|
GetProjectRoleForUser(ctx context.Context, arg GetProjectRoleForUserParams) (string, error)
|
|
GetServiceTemplateByID(ctx context.Context, id string) (ServiceTemplate, error)
|
|
GetUserInviteByTokenHash(ctx context.Context, tokenHash string) (UserInvite, error)
|
|
GetUserTokenByHash(ctx context.Context, tokenHash string) (UserToken, error)
|
|
InsertAgentHeartbeat(ctx context.Context, arg InsertAgentHeartbeatParams) error
|
|
InsertProjectEnvironment(ctx context.Context, arg InsertProjectEnvironmentParams) error
|
|
ListActiveBanners(ctx context.Context) ([]Banner, error)
|
|
ListAgentAuthTokens(ctx context.Context) ([]AgentAuthToken, error)
|
|
ListAgentHeartbeatsSince(ctx context.Context, arg ListAgentHeartbeatsSinceParams) ([]AgentHeartbeat, error)
|
|
ListAgents(ctx context.Context) ([]NodeAgent, error)
|
|
ListAllDatabaseServices(ctx context.Context) ([]DatabaseService, error)
|
|
ListBackupTargetsByUser(ctx context.Context, userID string) ([]BackupTarget, error)
|
|
ListBanners(ctx context.Context) ([]Banner, error)
|
|
ListCommandsForAgent(ctx context.Context, nodeAgentID string) ([]AgentCommand, error)
|
|
ListContainersForAgent(ctx context.Context, nodeAgentID string) ([]ContainerInstance, error)
|
|
ListDatabaseBackupsByDatabaseAndUser(ctx context.Context, arg ListDatabaseBackupsByDatabaseAndUserParams) ([]DatabaseBackup, error)
|
|
ListDatabaseServicesByProject(ctx context.Context, projectID uuid.NullUUID) ([]DatabaseService, error)
|
|
ListDatabaseServicesByUser(ctx context.Context, userID string) ([]DatabaseService, error)
|
|
ListDueDatabaseBackups(ctx context.Context) ([]ListDueDatabaseBackupsRow, error)
|
|
ListEnabledOutboundWebhooks(ctx context.Context) ([]OutboundWebhook, error)
|
|
ListNotificationsByUser(ctx context.Context, arg ListNotificationsByUserParams) ([]Notification, error)
|
|
ListOutboundWebhooksByUser(ctx context.Context, userID uuid.UUID) ([]OutboundWebhook, error)
|
|
ListPendingCommands(ctx context.Context, nodeAgentID string) ([]AgentCommand, error)
|
|
ListPendingProjects(ctx context.Context) ([]Project, error)
|
|
// Visibility model: a project is readable when it is approved for public
|
|
// display, when the caller owns or is a member of it, or when the caller is a
|
|
// platform admin. Anonymous callers pass user_id = uuid.Nil, is_admin = false.
|
|
ListProjectsWithStatsByUser(ctx context.Context, arg ListProjectsWithStatsByUserParams) ([]ListProjectsWithStatsByUserRow, error)
|
|
ListSchedulableAgents(ctx context.Context) ([]ListSchedulableAgentsRow, error)
|
|
// Only agents carrying every required placement tag (jsonb array containment).
|
|
ListSchedulableAgentsMatching(ctx context.Context, dollar_1 json.RawMessage) ([]ListSchedulableAgentsMatchingRow, error)
|
|
// Distinct agents holding inventory rows for a service.
|
|
ListServiceAgents(ctx context.Context, serviceID string) ([]string, error)
|
|
ListServiceContainers(ctx context.Context, serviceID string) ([]ListServiceContainersRow, error)
|
|
ListServiceTemplatesByCategoryForUser(ctx context.Context, arg ListServiceTemplatesByCategoryForUserParams) ([]ServiceTemplate, error)
|
|
ListServiceTemplatesForUser(ctx context.Context, ownerID uuid.NullUUID) ([]ServiceTemplate, error)
|
|
ListUserInvites(ctx context.Context) ([]UserInvite, error)
|
|
ListUserTokens(ctx context.Context, userID uuid.UUID) ([]UserToken, error)
|
|
ListWebhookDeliveriesByWebhook(ctx context.Context, webhookID uuid.UUID) ([]WebhookDelivery, error)
|
|
MarkAllNotificationsReadByUser(ctx context.Context, arg MarkAllNotificationsReadByUserParams) error
|
|
MarkNotificationReadByIDAndUser(ctx context.Context, arg MarkNotificationReadByIDAndUserParams) error
|
|
MarkUserInviteUsed(ctx context.Context, arg MarkUserInviteUsedParams) error
|
|
// Resource-aware: lowest memory utilisation first, then cpu, then container
|
|
// count. Agents without telemetry sort last (NULL → worst score).
|
|
PickLeastLoadedAgent(ctx context.Context) (string, error)
|
|
// Same resource-aware ordering as PickLeastLoadedAgent, restricted to agents
|
|
// carrying every required placement tag.
|
|
PickLeastLoadedAgentMatching(ctx context.Context, dollar_1 json.RawMessage) (string, error)
|
|
RevokeAgentAuthToken(ctx context.Context, id uuid.UUID) (AgentAuthToken, error)
|
|
RevokeUserToken(ctx context.Context, arg RevokeUserTokenParams) (int64, error)
|
|
ScrubCommandPayload(ctx context.Context, arg ScrubCommandPayloadParams) error
|
|
SetAgentSchedulable(ctx context.Context, arg SetAgentSchedulableParams) error
|
|
SetAgentTags(ctx context.Context, arg SetAgentTagsParams) error
|
|
SetDatabaseBackupRemoteKeyByID(ctx context.Context, arg SetDatabaseBackupRemoteKeyByIDParams) error
|
|
SetDatabaseBackupScheduleByIDAndUser(ctx context.Context, arg SetDatabaseBackupScheduleByIDAndUserParams) error
|
|
SetDatabaseBackupStatusByID(ctx context.Context, arg SetDatabaseBackupStatusByIDParams) error
|
|
SetDatabaseBackupTargetByIDAndUser(ctx context.Context, arg SetDatabaseBackupTargetByIDAndUserParams) error
|
|
SetDatabaseNextBackupAt(ctx context.Context, arg SetDatabaseNextBackupAtParams) error
|
|
SetDatabaseServicePublicPortByIDAndUser(ctx context.Context, arg SetDatabaseServicePublicPortByIDAndUserParams) error
|
|
SetDatabaseServiceStatusAndConnectionByID(ctx context.Context, arg SetDatabaseServiceStatusAndConnectionByIDParams) error
|
|
SetDatabaseServiceStatusByID(ctx context.Context, arg SetDatabaseServiceStatusByIDParams) error
|
|
SetDatabaseServiceStatusByIDAndUser(ctx context.Context, arg SetDatabaseServiceStatusByIDAndUserParams) error
|
|
SetProjectApproved(ctx context.Context, arg SetProjectApprovedParams) (int64, error)
|
|
TouchAgentAuthToken(ctx context.Context, tokenHash string) error
|
|
TouchUserToken(ctx context.Context, id uuid.UUID) error
|
|
UpdateAgent(ctx context.Context, arg UpdateAgentParams) (NodeAgent, error)
|
|
UpdateAgentHeartbeat(ctx context.Context, arg UpdateAgentHeartbeatParams) error
|
|
UpdateBackupTargetByIDAndUser(ctx context.Context, arg UpdateBackupTargetByIDAndUserParams) error
|
|
UpdateBanner(ctx context.Context, arg UpdateBannerParams) (Banner, error)
|
|
// Agent reports the real host bindings after create — persist them with
|
|
// the status flip so ingress can route to the assigned port.
|
|
UpdateContainerPorts(ctx context.Context, arg UpdateContainerPortsParams) error
|
|
// Agent heartbeat reports real docker state + net counters; reconcile
|
|
// inventory for rows this node owns. Tombstones win — never resurrect a
|
|
// removed replica. $4 is the cumulative rx+tx byte counter.
|
|
UpdateContainerStateByName(ctx context.Context, arg UpdateContainerStateByNameParams) error
|
|
UpdateContainerStatus(ctx context.Context, arg UpdateContainerStatusParams) error
|
|
UpdateDatabaseServiceNameAndPlanByIDAndUser(ctx context.Context, arg UpdateDatabaseServiceNameAndPlanByIDAndUserParams) error
|
|
UpdateDatabaseServiceNameByIDAndUser(ctx context.Context, arg UpdateDatabaseServiceNameByIDAndUserParams) error
|
|
UpdateDatabaseServicePlanByIDAndUser(ctx context.Context, arg UpdateDatabaseServicePlanByIDAndUserParams) error
|
|
UpdateOutboundWebhook(ctx context.Context, arg UpdateOutboundWebhookParams) error
|
|
UpdateProjectByID(ctx context.Context, arg UpdateProjectByIDParams) (int64, error)
|
|
UpdateUserTemplate(ctx context.Context, arg UpdateUserTemplateParams) (int64, error)
|
|
UpdateWebhookDeliveryResult(ctx context.Context, arg UpdateWebhookDeliveryResultParams) error
|
|
UpsertEnvironmentVariable(ctx context.Context, arg UpsertEnvironmentVariableParams) error
|
|
UpsertServiceContainer(ctx context.Context, arg UpsertServiceContainerParams) error
|
|
UpsertServiceTemplate(ctx context.Context, arg UpsertServiceTemplateParams) error
|
|
}
|
|
|
|
var _ Querier = (*Queries)(nil)
|