Documentation
¶
Overview ¶
Package store owns the controller's SQLite database (D5).
Writes go through a single connection so they are serialized; reads use a separate pool. Both run in WAL mode.
Index ¶
- Constants
- Variables
- type APIToken
- type AccessKey
- type AddressRecord
- type AlertChannel
- type AlertEvent
- type AlertRule
- type AlertState
- type Attachment
- type AuditEvent
- type AuditFilter
- type AuditRecord
- type Build
- type Certificate
- type CloudProvider
- type Database
- type DatabaseBackup
- type DatabaseEvent
- type DatabaseMember
- type DatabaseNetwork
- type DatabaseOrphan
- type DatabasePublic
- type DeployLock
- type Deployment
- type DeploymentEvent
- type DeploymentFilter
- type DeviceCode
- type Domain
- type Environment
- type EtcdMember
- type Failure
- type FirewallPolicy
- type FirewallRule
- type GCResult
- type GCRun
- type GitConnection
- type GitSource
- type IAMGroup
- type IAMPolicy
- type IAMRole
- type IAMUser
- type ImageStats
- type ImageWatch
- type Incident
- type IndexPool
- type Job
- type JobRun
- type JoinToken
- type LifecyclePolicy
- type Middleware
- type Node
- type NodeNetwork
- type NodePool
- type NullList
- type PoolEvent
- type PoolServer
- type PortRouting
- type Project
- type ProjectDeployment
- type Quota
- type RegistryEvent
- type Released
- type Retention
- type RoleTrust
- type RunAddress
- type S3Binding
- type S3Endpoint
- type ScalingEvent
- type ScalingPolicy
- type SecurityGroup
- type Service
- type Session
- type Store
- func (s *Store) APITokenByHash(ctx context.Context, hash string, now time.Time) (APIToken, error)
- func (s *Store) AccessKeyByID(ctx context.Context, id string) (AccessKey, error)
- func (s *Store) ActiveDeployment(ctx context.Context, serviceID string) (Deployment, error)
- func (s *Store) ActiveRunAddresses(ctx context.Context) ([]RunAddress, error)
- func (s *Store) ActiveRuns(ctx context.Context) ([]JobRun, error)
- func (s *Store) ActiveTasks(ctx context.Context) ([]Task, error)
- func (s *Store) AddAlertEvent(ctx context.Context, e AlertEvent) (int64, error)
- func (s *Store) AddDatabaseBackup(ctx context.Context, b DatabaseBackup) error
- func (s *Store) AddDatabaseEvent(ctx context.Context, e DatabaseEvent) error
- func (s *Store) AddDatabaseOrphan(ctx context.Context, o DatabaseOrphan) error
- func (s *Store) AddDeploymentEvent(ctx context.Context, depID, kind, message string, at time.Time) error
- func (s *Store) AddDomain(ctx context.Context, d Domain) error
- func (s *Store) AddPoolEvent(ctx context.Context, e PoolEvent) error
- func (s *Store) AddRevision(ctx context.Context, serviceID, spec, createdBy string, now time.Time) (rev int, changed bool, err error)
- func (s *Store) AddScalingEvent(ctx context.Context, e ScalingEvent) error
- func (s *Store) AddUsage(ctx context.Context, u UsageRow) error
- func (s *Store) AddressHistory(ctx context.Context, ip string, limit int) ([]AddressRecord, error)
- func (s *Store) AlertChannel(ctx context.Context, id string) (AlertChannel, error)
- func (s *Store) AllDatabaseMembers(ctx context.Context) ([]DatabaseMember, error)
- func (s *Store) AllocateNodeNetwork(ctx context.Context, nodeID string, mesh, subnet IndexPool, ...) (NodeNetwork, error)
- func (s *Store) ApproveDeviceCode(ctx context.Context, hash, userID, credential string) error
- func (s *Store) AssignAddress(ctx context.Context, ip, ownerID, owner, nodeID string, at time.Time) error
- func (s *Store) Attach(ctx context.Context, a Attachment, at time.Time) error
- func (s *Store) AutoDeployWatches(ctx context.Context) ([]ImageWatch, error)
- func (s *Store) BuildByCheckRun(ctx context.Context, runID string) (Build, error)
- func (s *Store) BuildByID(ctx context.Context, id string) (Build, error)
- func (s *Store) BuildByRun(ctx context.Context, runID string) (Build, error)
- func (s *Store) BuildsByStatus(ctx context.Context, statuses ...string) ([]Build, error)
- func (s *Store) Close() error
- func (s *Store) CloseIncident(ctx context.Context, id string, at time.Time) error
- func (s *Store) ConfirmNodeCert(ctx context.Context, id string) error
- func (s *Store) CountUsers(ctx context.Context) (int, error)
- func (s *Store) CreateAPIToken(ctx context.Context, t APIToken) error
- func (s *Store) CreateAccessKey(ctx context.Context, k AccessKey) error
- func (s *Store) CreateBuild(ctx context.Context, b Build) error
- func (s *Store) CreateDatabase(ctx context.Context, d Database) error
- func (s *Store) CreateDatabaseMember(ctx context.Context, m DatabaseMember) error
- func (s *Store) CreateDeviceCode(ctx context.Context, d DeviceCode) error
- func (s *Store) CreateEnvironment(ctx context.Context, e Environment) error
- func (s *Store) CreateEtcdMember(ctx context.Context, m EtcdMember) error
- func (s *Store) CreateGCRun(ctx context.Context, r GCRun) error
- func (s *Store) CreateGitConnection(ctx context.Context, c GitConnection) error
- func (s *Store) CreateJoinToken(ctx context.Context, t JoinToken) error
- func (s *Store) CreateProject(ctx context.Context, p Project, env Environment) error
- func (s *Store) CreateRootUser(ctx context.Context, u User) error
- func (s *Store) CreateRun(ctx context.Context, x JobRun) error
- func (s *Store) CreateService(ctx context.Context, sv Service, spec string, createdBy string) error
- func (s *Store) CreateSession(ctx context.Context, ss Session) error
- func (s *Store) CreateTask(ctx context.Context, t Task) error
- func (s *Store) CreateTempCredential(ctx context.Context, c TempCredential) error
- func (s *Store) CreateUser(ctx context.Context, u IAMUser) error
- func (s *Store) DatabaseBackupByID(ctx context.Context, id string) (DatabaseBackup, error)
- func (s *Store) DatabaseBackups(ctx context.Context, databaseID string, limit int) ([]DatabaseBackup, error)
- func (s *Store) DatabaseByID(ctx context.Context, id string) (Database, error)
- func (s *Store) DatabaseByName(ctx context.Context, name string) (Database, error)
- func (s *Store) DatabaseEvents(ctx context.Context, databaseID string, limit int, before string) ([]DatabaseEvent, error)
- func (s *Store) DatabaseEventsAfter(ctx context.Context, kind string, afterID int64) ([]DatabaseEvent, error)
- func (s *Store) DatabaseMemberByID(ctx context.Context, id string) (DatabaseMember, error)
- func (s *Store) DatabaseMembers(ctx context.Context, databaseID string) ([]DatabaseMember, error)
- func (s *Store) DatabaseNameTaken(ctx context.Context, environmentID, name string) (bool, error)
- func (s *Store) DatabaseOrphanByTask(ctx context.Context, taskID string) (DatabaseOrphan, error)
- func (s *Store) DefaultSecurityGroup(ctx context.Context, projectID string) (SecurityGroup, error)
- func (s *Store) DeleteAPIToken(ctx context.Context, userID, id string) error
- func (s *Store) DeleteAccessKey(ctx context.Context, userID, id string) error
- func (s *Store) DeleteAlertChannel(ctx context.Context, id string) error
- func (s *Store) DeleteAlertRule(ctx context.Context, id string) error
- func (s *Store) DeleteAlertState(ctx context.Context, ruleID, key string) error
- func (s *Store) DeleteCertificate(ctx context.Context, host string) error
- func (s *Store) DeleteCloudProvider(ctx context.Context, id string) error
- func (s *Store) DeleteDatabase(ctx context.Context, id string, now time.Time) error
- func (s *Store) DeleteDatabaseMember(ctx context.Context, id string) error
- func (s *Store) DeleteDatabaseOrphan(ctx context.Context, taskID string) error
- func (s *Store) DeleteDeviceCode(ctx context.Context, hash string) error
- func (s *Store) DeleteDomain(ctx context.Context, serviceID, ref string) error
- func (s *Store) DeleteEnvironment(ctx context.Context, id string) error
- func (s *Store) DeleteEtcdMember(ctx context.Context, id string) error
- func (s *Store) DeleteExpiredJoinTokens(ctx context.Context, now time.Time) error
- func (s *Store) DeleteExpiredSessions(ctx context.Context, now time.Time) (int64, error)
- func (s *Store) DeleteFirewallPolicy(ctx context.Context, id string) error
- func (s *Store) DeleteGitConnection(ctx context.Context, id string) error
- func (s *Store) DeleteGitSource(ctx context.Context, serviceID string) error
- func (s *Store) DeleteIAMGroup(ctx context.Context, id string) error
- func (s *Store) DeleteIAMPolicy(ctx context.Context, id string) error
- func (s *Store) DeleteIAMRole(ctx context.Context, id string) error
- func (s *Store) DeleteJob(ctx context.Context, id string) error
- func (s *Store) DeleteJoinToken(ctx context.Context, id string) error
- func (s *Store) DeleteLifecyclePolicy(ctx context.Context, repo string) error
- func (s *Store) DeleteMiddleware(ctx context.Context, id string) error
- func (s *Store) DeleteNode(ctx context.Context, id string) error
- func (s *Store) DeleteNodePool(ctx context.Context, id string) error
- func (s *Store) DeletePoolServer(ctx context.Context, poolID, serverID string) error
- func (s *Store) DeleteProject(ctx context.Context, id string) error
- func (s *Store) DeleteQuota(ctx context.Context, projectID, envID string) error
- func (s *Store) DeleteS3Endpoint(ctx context.Context, id string) error
- func (s *Store) DeleteScalingPolicy(ctx context.Context, serviceID string) error
- func (s *Store) DeleteSecurityGroup(ctx context.Context, id string) error
- func (s *Store) DeleteService(ctx context.Context, id string) error
- func (s *Store) DeleteSession(ctx context.Context, hash string) error
- func (s *Store) DeleteSetting(ctx context.Context, key string) error
- func (s *Store) DeleteTempCredential(ctx context.Context, id string) error
- func (s *Store) DeleteUpstreamCredential(ctx context.Context, id string) error
- func (s *Store) DeleteUser(ctx context.Context, id string) error
- func (s *Store) DeploymentByID(ctx context.Context, id string) (Deployment, error)
- func (s *Store) DeploymentEvents(ctx context.Context, depID string) ([]DeploymentEvent, error)
- func (s *Store) DeploymentRuns(ctx context.Context, depID string) ([]JobRun, error)
- func (s *Store) Detach(ctx context.Context, a Attachment) error
- func (s *Store) DeviceCodeByHash(ctx context.Context, hash string, now time.Time) (DeviceCode, error)
- func (s *Store) DeviceCodeByUserCode(ctx context.Context, code string, now time.Time) (DeviceCode, error)
- func (s *Store) DrainNode(ctx context.Context, id string) error
- func (s *Store) EndpointS3Bindings(ctx context.Context, endpointID string) ([]S3Binding, error)
- func (s *Store) EnsureDatabaseVIPs(ctx context.Context, id string, pool IndexPool, cooldown time.Duration, ...) (int, int, error)
- func (s *Store) EnsureServiceVIP(ctx context.Context, serviceID string, pool IndexPool, cooldown time.Duration, ...) (int, error)
- func (s *Store) EnvironmentByID(ctx context.Context, id string) (Environment, error)
- func (s *Store) EnvironmentByName(ctx context.Context, projectID, name string) (Environment, error)
- func (s *Store) EnvironmentContents(ctx context.Context, id string) (services int, databases []string, err error)
- func (s *Store) EtcdMemberByID(ctx context.Context, id string) (EtcdMember, error)
- func (s *Store) EtcdMembers(ctx context.Context) ([]EtcdMember, error)
- func (s *Store) FailRunningGCRuns(ctx context.Context, now time.Time) error
- func (s *Store) FailedSince(ctx context.Context, t time.Time) ([]Failure, error)
- func (s *Store) FinishDatabaseBackup(ctx context.Context, id, state, errText string, at time.Time) (bool, error)
- func (s *Store) FinishDeployment(ctx context.Context, id, status, message string, now time.Time) error
- func (s *Store) FinishGCRun(ctx context.Context, r GCRun) error
- func (s *Store) FirewallPolicy(ctx context.Context, id string) (FirewallPolicy, error)
- func (s *Store) GC(ctx context.Context, r Retention, now time.Time) (GCResult, error)
- func (s *Store) GCRuns(ctx context.Context, limit int) ([]GCRun, error)
- func (s *Store) GetSetting(ctx context.Context, key string) (string, bool, error)
- func (s *Store) GitConnection(ctx context.Context, idOrName string) (GitConnection, error)
- func (s *Store) GitSourceByID(ctx context.Context, id string) (GitSource, error)
- func (s *Store) GitSourceByService(ctx context.Context, serviceID string) (GitSource, error)
- func (s *Store) GitSourcesByConnection(ctx context.Context, connectionID string) ([]GitSource, error)
- func (s *Store) GitSourcesByRepo(ctx context.Context, connectionID, repo string) ([]GitSource, error)
- func (s *Store) IAMUser(ctx context.Context, id string) (IAMUser, error)
- func (s *Store) ImageStatsFor(ctx context.Context, repo string) ([]ImageStats, error)
- func (s *Store) ImageWatch(ctx context.Context, serviceID string) (ImageWatch, error)
- func (s *Store) ImageWatchByWebhook(ctx context.Context, hash string) (ImageWatch, error)
- func (s *Store) IncDeploymentFailures(ctx context.Context, id string) (int, error)
- func (s *Store) JobByID(ctx context.Context, id string) (Job, error)
- func (s *Store) JobByName(ctx context.Context, environmentID, name string) (Job, error)
- func (s *Store) JobRuns(ctx context.Context, jobID string, limit int, before string) ([]JobRun, error)
- func (s *Store) JoinNode(ctx context.Context, tokenHash string, n Node, now time.Time) error
- func (s *Store) LastDatabaseEventID(ctx context.Context) (int64, error)
- func (s *Store) LastPoolEvent(ctx context.Context, poolID, kind string) (PoolEvent, error)
- func (s *Store) LifecyclePolicy(ctx context.Context, repo string) (LifecyclePolicy, error)
- func (s *Store) ListAPITokens(ctx context.Context, userID string) ([]APIToken, error)
- func (s *Store) ListAccessKeys(ctx context.Context, userID string) ([]AccessKey, error)
- func (s *Store) ListAlertChannels(ctx context.Context) ([]AlertChannel, error)
- func (s *Store) ListAlertEvents(ctx context.Context, limit int, before string) ([]AlertEvent, error)
- func (s *Store) ListAlertRules(ctx context.Context) ([]AlertRule, error)
- func (s *Store) ListAlertStates(ctx context.Context) ([]AlertState, error)
- func (s *Store) ListAttachments(ctx context.Context) ([]Attachment, error)
- func (s *Store) ListCertificates(ctx context.Context) ([]Certificate, error)
- func (s *Store) ListCloudProviders(ctx context.Context) ([]CloudProvider, error)
- func (s *Store) ListDatabases(ctx context.Context) ([]Database, error)
- func (s *Store) ListDeployments(ctx context.Context, serviceID string, limit int, before string) ([]Deployment, error)
- func (s *Store) ListDomains(ctx context.Context, serviceID string) ([]Domain, error)
- func (s *Store) ListEnvironments(ctx context.Context, projectID string) ([]Environment, error)
- func (s *Store) ListFirewallPolicies(ctx context.Context) ([]FirewallPolicy, error)
- func (s *Store) ListGitConnections(ctx context.Context) ([]GitConnection, error)
- func (s *Store) ListGitSources(ctx context.Context) ([]GitSource, error)
- func (s *Store) ListIAMGroups(ctx context.Context) ([]IAMGroup, error)
- func (s *Store) ListIAMPolicies(ctx context.Context) ([]IAMPolicy, error)
- func (s *Store) ListIAMRoles(ctx context.Context) ([]IAMRole, error)
- func (s *Store) ListIAMUsers(ctx context.Context) ([]IAMUser, error)
- func (s *Store) ListIncidents(ctx context.Context, serviceID string, openOnly bool, limit int) ([]Incident, error)
- func (s *Store) ListJobs(ctx context.Context) ([]Job, error)
- func (s *Store) ListJobsIn(ctx context.Context, environmentID string) ([]Job, error)
- func (s *Store) ListJoinTokens(ctx context.Context, now time.Time) ([]JoinToken, error)
- func (s *Store) ListLifecyclePolicies(ctx context.Context) ([]LifecyclePolicy, error)
- func (s *Store) ListMiddlewares(ctx context.Context) ([]Middleware, error)
- func (s *Store) ListNodeNetworks(ctx context.Context) ([]NodeNetwork, error)
- func (s *Store) ListNodePools(ctx context.Context) ([]NodePool, error)
- func (s *Store) ListNodes(ctx context.Context) ([]Node, error)
- func (s *Store) ListPoolEvents(ctx context.Context, poolID string, limit int, before string) ([]PoolEvent, error)
- func (s *Store) ListPoolServers(ctx context.Context, poolID string) ([]PoolServer, error)
- func (s *Store) ListProjectDeployments(ctx context.Context, projectID string, f DeploymentFilter, limit int, ...) ([]ProjectDeployment, error)
- func (s *Store) ListProjects(ctx context.Context) ([]Project, error)
- func (s *Store) ListQuotas(ctx context.Context) ([]Quota, error)
- func (s *Store) ListRegistryEvents(ctx context.Context, repo string, limit int, before string) ([]RegistryEvent, error)
- func (s *Store) ListReleased(ctx context.Context) ([]Released, error)
- func (s *Store) ListRouting(ctx context.Context, serviceID string) ([]PortRouting, error)
- func (s *Store) ListS3Endpoints(ctx context.Context) ([]S3Endpoint, error)
- func (s *Store) ListScalingPolicies(ctx context.Context) ([]ScalingPolicy, error)
- func (s *Store) ListSecurityGroups(ctx context.Context) ([]SecurityGroup, error)
- func (s *Store) ListServices(ctx context.Context) ([]Service, error)
- func (s *Store) ListServicesIn(ctx context.Context, environmentID string) ([]Service, error)
- func (s *Store) ListTaskDefinitions(ctx context.Context, serviceID string) ([]TaskDefinition, error)
- func (s *Store) ListUpstreamCredentials(ctx context.Context) ([]UpstreamCredential, error)
- func (s *Store) ListUsage(ctx context.Context, project, from, to string) ([]UsageRow, error)
- func (s *Store) MarkDatabaseDeleting(ctx context.Context, id string, now time.Time) error
- func (s *Store) MarkEnvironmentDeleting(ctx context.Context, id string) error
- func (s *Store) MarkProjectDeleting(ctx context.Context, id string) error
- func (s *Store) MarkServiceDeleting(ctx context.Context, id string, now time.Time) error
- func (s *Store) NodeByID(ctx context.Context, id string) (Node, error)
- func (s *Store) NodeByName(ctx context.Context, name string) (Node, error)
- func (s *Store) NodeCertSerials(ctx context.Context, id string) (cur, prev string, err error)
- func (s *Store) NodeDatabaseMembers(ctx context.Context, nodeID string) ([]DatabaseMember, error)
- func (s *Store) NodeDatabaseOrphans(ctx context.Context, nodeID string) ([]DatabaseOrphan, error)
- func (s *Store) NodeNetwork(ctx context.Context, nodeID string) (NodeNetwork, error)
- func (s *Store) NodeTasks(ctx context.Context, nodeID string) ([]Task, error)
- func (s *Store) OpenIncident(ctx context.Context, i Incident) error
- func (s *Store) ProjectByID(ctx context.Context, id string) (Project, error)
- func (s *Store) ProjectByName(ctx context.Context, name string) (Project, error)
- func (s *Store) PruneRegistryEvents(ctx context.Context, before time.Time) error
- func (s *Store) PruneRuns(ctx context.Context, jobID string, keep int) error
- func (s *Store) PruneTasks(ctx context.Context, serviceID string, keep int) error
- func (s *Store) PutAlertChannel(ctx context.Context, c AlertChannel) error
- func (s *Store) PutAlertRule(ctx context.Context, r AlertRule) error
- func (s *Store) PutAlertState(ctx context.Context, a AlertState) error
- func (s *Store) PutCertificate(ctx context.Context, c Certificate) error
- func (s *Store) PutCloudProvider(ctx context.Context, p CloudProvider) error
- func (s *Store) PutFirewallPolicy(ctx context.Context, p FirewallPolicy) error
- func (s *Store) PutGitSource(ctx context.Context, g GitSource) error
- func (s *Store) PutIAMGroup(ctx context.Context, g IAMGroup) error
- func (s *Store) PutIAMPolicy(ctx context.Context, p IAMPolicy) error
- func (s *Store) PutIAMRole(ctx context.Context, r IAMRole) error
- func (s *Store) PutImageWatchSettings(ctx context.Context, serviceID string, autoDeploy bool, pollSeconds int, ...) error
- func (s *Store) PutJob(ctx context.Context, j Job) error
- func (s *Store) PutLifecyclePolicy(ctx context.Context, p LifecyclePolicy) error
- func (s *Store) PutMiddleware(ctx context.Context, m Middleware) error
- func (s *Store) PutNodePool(ctx context.Context, p NodePool) error
- func (s *Store) PutPoolServer(ctx context.Context, x PoolServer) error
- func (s *Store) PutQuota(ctx context.Context, q Quota) error
- func (s *Store) PutS3Endpoint(ctx context.Context, e S3Endpoint) error
- func (s *Store) PutScalingPolicy(ctx context.Context, p ScalingPolicy) error
- func (s *Store) PutSecurityGroup(ctx context.Context, g SecurityGroup) error
- func (s *Store) PutUpstreamCredential(ctx context.Context, c UpstreamCredential) error
- func (s *Store) QueryAudit(ctx context.Context, f AuditFilter, limit int) ([]AuditRecord, error)
- func (s *Store) RecentBuilds(ctx context.Context, limit int, before string) ([]Build, error)
- func (s *Store) RecordGitCheck(ctx context.Context, id, sha, errMsg string, now time.Time) error
- func (s *Store) RecordGitWebhook(ctx context.Context, id string, now time.Time) error
- func (s *Store) RecordImageCheck(ctx context.Context, serviceID, digest, errMsg string, deployed bool, ...) error
- func (s *Store) RecordRegistryEvents(ctx context.Context, evs []RegistryEvent) (int, error)
- func (s *Store) RejoinTarget(ctx context.Context, tokenHash string, now time.Time) (Node, bool, error)
- func (s *Store) ReleaseAddress(ctx context.Context, ownerID string, at time.Time) error
- func (s *Store) ReleaseService(ctx context.Context, id string) error
- func (s *Store) RootUser(ctx context.Context) (User, error)
- func (s *Store) RotateNodeCert(ctx context.Context, id, newSerial string) error
- func (s *Store) RunByID(ctx context.Context, id string) (JobRun, error)
- func (s *Store) RunsIn(ctx context.Context, environmentID string, limit int) ([]JobRun, error)
- func (s *Store) S3EndpointByRef(ctx context.Context, ref string) (S3Endpoint, error)
- func (s *Store) ScalingEvents(ctx context.Context, serviceID string, limit int) ([]ScalingEvent, error)
- func (s *Store) ScalingPolicy(ctx context.Context, serviceID string) (ScalingPolicy, error)
- func (s *Store) SecurityGroupByName(ctx context.Context, projectID, name string) (SecurityGroup, error)
- func (s *Store) ServiceBuilds(ctx context.Context, serviceID string, limit int, before string) ([]Build, error)
- func (s *Store) ServiceByID(ctx context.Context, id string) (Service, error)
- func (s *Store) ServiceByName(ctx context.Context, environmentID, name string) (Service, error)
- func (s *Store) ServiceS3Bindings(ctx context.Context, serviceID string) ([]S3Binding, error)
- func (s *Store) ServiceTasks(ctx context.Context, serviceID string, history int) ([]Task, error)
- func (s *Store) SessionByHash(ctx context.Context, hash string, now time.Time) (Session, error)
- func (s *Store) SetAlertDelivery(ctx context.Context, id int64, delivery string) error
- func (s *Store) SetDatabaseNetwork(ctx context.Context, id, network string, now time.Time) error
- func (s *Store) SetDatabaseSpec(ctx context.Context, id, spec string, now time.Time) error
- func (s *Store) SetDatabaseState(ctx context.Context, id, state string) error
- func (s *Store) SetDatabaseStatus(ctx context.Context, id, status string) error
- func (s *Store) SetDeploymentStatus(ctx context.Context, id, status, message string, finished *time.Time) error
- func (s *Store) SetEnvironmentPolicy(ctx context.Context, id string, autoDeploy bool, lock *DeployLock) error
- func (s *Store) SetGitBuildSettings(ctx context.Context, serviceID, settings string, varsEnc []byte) error
- func (s *Store) SetGitHook(ctx context.Context, id, hookID, hookErr string) error
- func (s *Store) SetGitRefs(ctx context.Context, id string, refs map[string]string) error
- func (s *Store) SetImageWebhook(ctx context.Context, serviceID, hash string, now time.Time) error
- func (s *Store) SetJobScheduled(ctx context.Context, id string, at time.Time) error
- func (s *Store) SetMFA(ctx context.Context, id string, secret []byte, enabled bool) error
- func (s *Store) SetNodePool(ctx context.Context, id, poolID string, protected bool) error
- func (s *Store) SetNodeSchedulable(ctx context.Context, id string, on bool) error
- func (s *Store) SetNodeStatus(ctx context.Context, id, status string, at, lastSeen time.Time) error
- func (s *Store) SetNodeWireGuard(ctx context.Context, nodeID, publicKey, endpoint string, now time.Time) (bool, error)
- func (s *Store) SetPassword(ctx context.Context, id, hash string) error
- func (s *Store) SetProjectNodes(ctx context.Context, id string, nodes []string) error
- func (s *Store) SetRouting(ctx context.Context, serviceID string, rs []PortRouting) error
- func (s *Store) SetRunIP(ctx context.Context, id, ip string) (changed bool, err error)
- func (s *Store) SetServiceRevision(ctx context.Context, serviceID string, rev int, now time.Time) error
- func (s *Store) SetServiceS3Bindings(ctx context.Context, serviceID string, bs []S3Binding) error
- func (s *Store) SetServiceStatus(ctx context.Context, id, status string) error
- func (s *Store) SetSetting(ctx context.Context, key, value string) error
- func (s *Store) SetSharedEnv(ctx context.Context, envID string, vars map[string]string) error
- func (s *Store) SetTaskDesired(ctx context.Context, id, desired, state string, now time.Time) error
- func (s *Store) StartDeployment(ctx context.Context, d Deployment) error
- func (s *Store) TaskByID(ctx context.Context, id string) (Task, error)
- func (s *Store) TaskDefinition(ctx context.Context, serviceID string, revision int) (TaskDefinition, error)
- func (s *Store) TempCredentialByID(ctx context.Context, id string, now time.Time) (TempCredential, error)
- func (s *Store) TouchAPIToken(ctx context.Context, id, ip string, at time.Time) error
- func (s *Store) TouchAccessKey(ctx context.Context, id, ip string, at time.Time) error
- func (s *Store) TouchLogin(ctx context.Context, id string, at time.Time) error
- func (s *Store) TouchSession(ctx context.Context, hash string, seen, expires time.Time) error
- func (s *Store) TouchTempCredential(ctx context.Context, id string, at time.Time) error
- func (s *Store) UpdateBuild(ctx context.Context, b Build) error
- func (s *Store) UpdateDatabaseMember(ctx context.Context, m DatabaseMember, now time.Time) error
- func (s *Store) UpdateEtcdMember(ctx context.Context, m EtcdMember, now time.Time) error
- func (s *Store) UpdateIncident(ctx context.Context, id, state, cause string) error
- func (s *Store) UpdateNodeInfo(ctx context.Context, id, info string) error
- func (s *Store) UpdateProjectSettings(ctx context.Context, id, description string, rollbackWindow int) error
- func (s *Store) UpdateRun(ctx context.Context, x JobRun) error
- func (s *Store) UpdateService(ctx context.Context, id, spec string, desired int, createdBy string, ...) (int, error)
- func (s *Store) UpdateTaskStatus(ctx context.Context, t Task) error
- func (s *Store) UpdateUser(ctx context.Context, id, name string, disabled bool, passwordHash string) error
- func (s *Store) UserByEmail(ctx context.Context, email string) (User, error)
- func (s *Store) UserByID(ctx context.Context, id string) (User, error)
- func (s *Store) WriteAudit(ctx context.Context, e AuditEvent) error
- type Task
- type TaskDefinition
- type TempCredential
- type UpstreamCredential
- type UsageRow
- type User
Constants ¶
const ( UserHuman = "user" UserService = "service" // service account: keys and tokens only, no console login )
User kinds.
const ( TempRole = "role" // sts assume-role TempDevice = "device" // synctl login TempShell = "shell" // Cloud Shell )
Kinds of temporary credentials.
const ( RunPending = "pending" RunRunning = "running" RunSucceeded = "succeeded" RunFailed = "failed" RunTimedOut = "timed_out" RunCancelled = "cancelled" RunSkipped = "skipped" )
Job run statuses.
const ( NodePending = "pending" // joined, never connected NodeReady = "ready" NodeSuspect = "suspect" // no heartbeat for 20s NodeNotReady = "not_ready" // no heartbeat for 60s )
Node statuses (§5.6).
const ( DefaultGroupName = "default" DefaultGroupDescription = "Services in the same environment can reach each other; all outbound traffic is allowed." DefaultGroupInbound = `[{"protocol":"any","ports":"","peers":["environment:self"],"description":"Services in the same environment"}]` DefaultGroupOutbound = `[{"protocol":"any","ports":"","peers":["any"],"description":"All outbound traffic"}]` )
Rules of a project's default security group (§8.3), as JSON. The same text is used by the migration for existing projects.
const ( SettingSetupTokenHash = "setup.token_hash" SettingSetupTokenExpires = "setup.token_expires" SettingBaseDomain = "domain.base" // SettingRecoverySuffixHash lets the setup wizard confirm the user saved the // recovery key (they type its last 6 characters). SettingRecoverySuffixHash = "recovery.suffix_hash" // SettingRecoveryKey is the recovery key, sealed with the master key, so // the root user can look it up later. SettingRecoveryKey = "recovery.key" )
Setting keys.
const ( TaskPending = "pending" TaskPulling = "pulling" TaskStarting = "starting" TaskRunning = "running" TaskExited = "exited" TaskFailed = "failed" TaskStopped = "stopped" TaskLost = "lost" )
Task states.
const ( DeployInProgress = "in_progress" DeploySucceeded = "succeeded" DeployFailed = "failed" DeployRolledBack = "rolled_back" DeploySuperseded = "superseded" )
Deployment statuses.
const ( TriggerManual = "manual" TriggerGit = "git" TriggerRollback = "rollback" TriggerAutoRollback = "auto-rollback" TriggerVariables = "variables" TriggerRedeploy = "redeploy" TriggerConfig = "config" // TriggerImage: a new push of the service's image tag (auto-deploy or // the deploy webhook). TriggerImage = "image" )
Deployment triggers: what started a deployment.
const DeployCancelled = "cancelled"
DeployCancelled marks a deployment stopped by a user.
const DeployWaitingHook = "waiting_hook"
Deployment status while a pre-deploy hook runs (§5.11).
const MaxAccessKeysPerUser = 2
MaxAccessKeysPerUser allows rotation: create the new key, switch, delete the old one (§7.1).
const MaxRollbackWindow = 50
MaxRollbackWindow is the most revisions a project may keep images for (task definitions beyond the GC retention are gone anyway).
const PullDedupWindow = 30 * time.Second
PullDedupWindow merges the manifest requests of one pull.
Variables ¶
var DefaultRetention = Retention{ Audit: 365 * 24 * time.Hour, Incidents: 90 * 24 * time.Hour, Deployments: 90 * 24 * time.Hour, Builds: 90 * 24 * time.Hour, Usage: 400 * 24 * time.Hour, Revisions: 50, }
DefaultRetention is what the controller applies unless configured.
var ErrInUse = errors.New("in use")
ErrInUse means something still refers to the object.
var ErrLimitReached = errors.New("limit reached")
var ErrNameTaken = errors.New("name already taken")
var ErrNotEmpty = errors.New("not empty")
ErrNotEmpty means the resource still has children.
var ErrNotFound = errors.New("not found")
var ErrPoolExhausted = errors.New("address pool exhausted")
ErrPoolExhausted means no index is free.
var ErrSetupDone = errors.New("setup already completed")
Functions ¶
This section is empty.
Types ¶
type AddressRecord ¶
type AddressRecord struct {
IP string `json:"ip"`
OwnerID string `json:"ownerId"`
Owner string `json:"owner"`
NodeID string `json:"nodeId"`
AssignedAt time.Time `json:"assignedAt"`
ReleasedAt *time.Time `json:"releasedAt"`
}
AddressRecord is one assignment of a container address (§8.2).
type AlertChannel ¶
type AlertEvent ¶
type AlertEvent struct {
ID int64 `json:"id"`
RuleID string `json:"ruleId"`
RuleName string `json:"rule"`
Severity string `json:"severity"`
Kind string `json:"kind"`
Key string `json:"key"`
Label string `json:"label"`
Message string `json:"message"`
Value *float64 `json:"value"`
Delivery string `json:"delivery"`
At time.Time `json:"at"`
}
AlertEvent is a notification: an alert firing or resolving, or a one-off event (a failed deployment).
type AlertState ¶
type AlertState struct {
RuleID string `json:"ruleId"`
Key string `json:"key"`
Label string `json:"label"`
State string `json:"state"` // pending | firing
Since time.Time `json:"since"`
Value *float64 `json:"value"`
Message string `json:"message"`
}
AlertState is a rule instance whose condition holds.
type Attachment ¶
type AuditEvent ¶
type AuditFilter ¶
type AuditFilter struct {
ActorID, Action, Resource, Text string
Since, Until time.Time
BeforeID int64 // paging: events older than this ID
}
AuditFilter selects events; empty fields match everything.
type AuditRecord ¶
type AuditRecord struct {
ID int64 `json:"id"`
At time.Time `json:"at"`
ActorID string `json:"actorId"`
Actor string `json:"actor"` // email, joined in
Action string `json:"action"`
Resource string `json:"resource"`
IP string `json:"ip"`
UserAgent string `json:"userAgent"`
Detail map[string]any `json:"detail"`
}
AuditRecord is a stored audit event.
type Build ¶
type Build struct {
ID string `json:"id"`
ServiceID string `json:"serviceId"`
SHA string `json:"sha"`
Ref string `json:"ref"`
Trigger string `json:"trigger"`
Status string `json:"status"`
Image string `json:"image"`
RunID string `json:"runId"`
Message string `json:"message"`
Deployed bool `json:"deployed"`
BaseSHA string `json:"baseSha"`
// CheckRunID is the run of the after-build checks (Phase 15b).
CheckRunID string `json:"checkRunId,omitempty"`
CreatedAt time.Time `json:"createdAt"`
StartedAt *time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt"`
}
type Certificate ¶
type CloudProvider ¶
type Database ¶
type Database struct {
ID string
EnvironmentID string
Project string // names, joined in
Environment string
Name string // unique in the cluster
Engine string
Version string
Spec string
State string
Network string
Secrets []byte
Status string
Deleting bool
VIPRW, VIPRO int // 0 = not allocated
CreatedAt time.Time
UpdatedAt time.Time
}
Database is a managed database (Phase 12). Spec, State and Network are JSON owned by package dbs; Secrets are sealed. A standalone database has no environment (EnvironmentID, Project and Environment are "").
func (Database) ParseNetwork ¶
func (d Database) ParseNetwork() DatabaseNetwork
ParseNetwork returns the database's network settings with defaults.
func (Database) Standalone ¶
Standalone reports a database outside any project.
type DatabaseBackup ¶
type DatabaseBackup struct {
ID string // the task ID
DatabaseID string
NodeID string
Member string
Trigger string // schedule | manual
State string // running | ok | failed
Error string
StartedAt time.Time
FinishedAt *time.Time
}
DatabaseBackup is one base backup run of a PostgreSQL cluster (Phase 13c).
type DatabaseEvent ¶
type DatabaseEvent struct {
ID int64 `json:"id"`
DatabaseID string `json:"-"`
At time.Time `json:"at"`
Kind string `json:"kind"`
From string `json:"from"`
To string `json:"to"`
Reason string `json:"reason"`
Actor string `json:"actor"`
}
DatabaseEvent is a scaling or failover event.
type DatabaseMember ¶
type DatabaseMember struct {
ID string
DatabaseID string
Kind string // data | sentinel
Ordinal int
NodeID string
Desired string // running | stopped
State string // pending | running | exited | failed | stopped | lost
IP string
Error string
SpecHash string
CreatedAt time.Time
UpdatedAt time.Time
}
DatabaseMember is one container of a database: a data member or a sentinel.
type DatabaseNetwork ¶
type DatabaseNetwork struct {
// Access lists the internal peers allowed in. Absent (nil) means the
// default: a project database's own environment; nothing for a
// standalone one.
Access NullList[string] `json:"access"`
Public DatabasePublic `json:"public"`
}
DatabaseNetwork is who may reach a database: internal peers (security group peer syntax, fully qualified) and the public endpoint.
type DatabaseOrphan ¶
DatabaseOrphan is a removed database member whose container and volume still have to be removed from its node.
type DatabasePublic ¶
type DatabasePublic struct {
Enabled bool `json:"enabled"`
Allow []string `json:"allow"` // client CIDRs
// RequireTLS refuses plain connections on the dedicated ports.
RequireTLS bool `json:"requireTls,omitempty"`
// Port and ReadPort are the dedicated read-write and read-only ports,
// assigned by the controller while the endpoint is on (Phase 18).
Port int `json:"port,omitempty"`
ReadPort int `json:"readPort,omitempty"`
}
DatabasePublic is the endpoint Traefik serves from outside the cluster.
type DeployLock ¶
type DeployLock struct {
Reason string `json:"reason"`
By string `json:"by"`
At time.Time `json:"at"`
}
DeployLock is why an environment takes no deployments, and since when.
type Deployment ¶
type Deployment struct {
ID string `json:"id"`
ServiceID string `json:"serviceId"`
FromRev int `json:"fromRevision"`
ToRev int `json:"toRevision"`
Status string `json:"status"`
Failed int `json:"failedTasks"`
Message string `json:"message"`
StartedAt time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt"`
Trigger string `json:"trigger"`
Actor string `json:"actor"`
BuildID string `json:"buildId,omitempty"`
Image string `json:"image"`
Changes string `json:"-"` // JSON, decoded by the workload package
}
type DeploymentEvent ¶
type DeploymentEvent struct {
ID int64 `json:"id"`
At time.Time `json:"at"`
Kind string `json:"kind"`
Message string `json:"message"`
}
DeploymentEvent is one step of a deployment's timeline.
type DeploymentFilter ¶
DeploymentFilter narrows ListProjectDeployments.
type DeviceCode ¶
type Domain ¶
type Domain struct {
ID string `json:"id"`
ServiceID string `json:"serviceId"`
Host string `json:"host"`
// Path is a path prefix ("" = the whole host); several services can
// share a host by path.
Path string `json:"path"`
PortName string `json:"port"`
StripPrefix bool `json:"stripPrefix"`
RedirectTo string `json:"redirectTo"` // answer with a 301 to this host instead
CreatedAt time.Time `json:"createdAt"`
}
type Environment ¶
type Environment struct {
ID string `json:"id"`
ProjectID string `json:"projectId"`
Name string `json:"name"`
CreatedAt time.Time `json:"createdAt"`
// AutoDeploy lets builds deploy themselves (Phase 15d; the Git source's
// own switch applies too).
AutoDeploy bool `json:"autoDeploy"`
// Lock, when set, blocks deployments other than rollbacks and cancels.
Lock *DeployLock `json:"lock"`
Deleting bool `json:"deleting"`
}
type EtcdMember ¶
type EtcdMember struct {
ID string
Ordinal int
NodeID string
State string // pending | running | exited | failed | stopped
IP string
Error string
SpecHash string
Cluster string // the initial-cluster it was started with
NewCluster bool // started with initial-cluster-state new
MemberID string // etcd's member ID (hex), once known
CreatedAt time.Time
UpdatedAt time.Time
}
EtcdMember is one member of the platform etcd (Phase 13).
type Failure ¶
type Failure struct {
Kind string // deployment | build | job
ID string
ServiceID string
JobName string
Message string
At time.Time
}
FailedSince lists what failed after t: deployments, builds and job runs, for event alerts. Each item is (kind, id, service ID, message, when).
type FirewallPolicy ¶
type FirewallPolicy struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Targets []string `json:"targets"`
Rules []FirewallRule `json:"rules"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
func (FirewallPolicy) AppliesTo ¶
func (p FirewallPolicy) AppliesTo(nodeID string) bool
AppliesTo reports whether the policy targets nodeID.
type FirewallRule ¶
type GCRun ¶
type GCRun struct {
ID string `json:"id"`
Trigger string `json:"trigger"`
Status string `json:"status"`
Expired int `json:"expired"`
ReclaimedBytes int64 `json:"reclaimedBytes"`
Message string `json:"message"`
Details string `json:"-"`
StartedAt time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt"`
}
type GitConnection ¶
type GitConnection struct {
ID string
Kind string // github-app | github | gitlab | gitea
Name string
APIURL string
WebURL string
Account string // the user or organization it acts as
AppID int64 // GitHub App
AppSlug string // GitHub App
SecretsEnc []byte
CreatedAt time.Time
}
GitConnection is a connected Git provider (§5.8).
type GitSource ¶
type GitSource struct {
ID string
ServiceID string
URL string
Branch string
Dockerfile string
Context string
TokenEnc []byte
AutoDeploy bool
PollSeconds int
WebhookSecret string
LastSHA string
LastCheckedAt *time.Time
LastError string
Failures int
CreatedAt time.Time
Tags string // tag pattern ("" = tags are not watched)
Paths []string // path filters ("!" excludes); empty = any change
Builder string // auto | dockerfile | nixpacks | static
RefSHAs map[string]string // last seen commit of each matching ref
LastWebhookAt *time.Time
// From a Git connection (§5.8): the connection, the repository's full
// name, the webhook SynCloud created on it and why creating it failed.
ConnectionID string
Repo string
HookID string
HookError string
// BuildSettings is the builds package's JSON (command overrides and
// after-build checks); BuildVarsEnc its encrypted build-time variables.
BuildSettings string
BuildVarsEnc []byte
}
type IAMUser ¶
type IAMUser struct {
User
Kind string
Disabled bool
MFAEnabled bool
MFASecret []byte // sealed
LastLoginAt *time.Time
Groups []string // group IDs
}
IAMUser is a user with its IAM fields.
type ImageStats ¶
type ImageStats struct {
Repository string `json:"repository"`
Digest string `json:"digest"`
Pushes int `json:"pushes"`
Pulls int `json:"pulls"`
LastPushedAt *time.Time `json:"lastPushedAt"`
LastPulledAt *time.Time `json:"lastPulledAt"`
}
ImageStats are the push and pull counters of one digest.
type ImageWatch ¶ added in v0.1.7
type ImageWatch struct {
ServiceID string
AutoDeploy bool
PollSeconds int
// WebhookHash is the sha256 (hex) of the deploy webhook's token; "" = none.
WebhookHash string
CheckedAt *time.Time
LastDigest string
LastError string
LastDeployAt *time.Time
UpdatedAt time.Time
}
ImageWatch is a service's auto-deploy of new pushes of its image.
type IndexPool ¶
type IndexPool struct {
Kind string
Min, Max int
// Skip excludes indexes (e.g. ones that map to .0/.255 addresses).
Skip func(int) bool
// Prefer is tried first when free (e.g. 1 for the controller node).
Prefer int
}
IndexPool describes the allocatable indexes of one kind.
type LifecyclePolicy ¶
type Middleware ¶
type Node ¶
type Node struct {
ID string
Name string
Status string
Info string // JSON
CertSerial string
CreatedAt time.Time
StatusAt time.Time
LastSeenAt *time.Time
// Schedulable allows new tasks on the node.
Schedulable bool
// Draining moves the node's tasks elsewhere.
Draining bool
// PoolID is the node pool ("" for none: the default pool).
PoolID string
// ScaleInProtected keeps the cluster autoscaler from removing the node.
ScaleInProtected bool
}
type NodeNetwork ¶
type NodeNetwork struct {
NodeID string
NodeName string
MeshIndex int
SubnetIndex int
PublicKey string
Endpoint string
UpdatedAt time.Time
}
NodeNetwork is a node's mesh allocation and WireGuard identity.
type NullList ¶ added in v0.1.5
type NullList[T any] []T
NullList is a list whose nil means something else than empty (a default, "all"): it encodes as null, even through the API, whose encoder turns other nil lists into [] (api.writeJSON).
func (NullList[T]) MarshalJSON ¶ added in v0.1.5
MarshalJSON writes null for nil and the list otherwise.
type PoolServer ¶
type PoolServer struct {
PoolID string `json:"poolId"`
ServerID string `json:"serverId"`
Name string `json:"name"`
State string `json:"state"` // creating | joined | failed | deleting
NodeID string `json:"nodeId,omitempty"`
Message string `json:"message,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
PoolServer is a server a pool created at its provider.
type PortRouting ¶
type PortRouting struct {
ServiceID string
PortName string
Generated bool // http: the generated address is served
Label string // http: replaces the generated name ("" = none)
PublicPort int // tcp/udp: the public port (0 = not public)
Allow []string // tcp/udp: client CIDRs (none = anyone)
}
PortRouting is how one port of a service is reached (Phase 15c).
type Project ¶
type Project struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
// Nodes are the node names the project's workloads may run on (empty = any).
Nodes []string `json:"nodes"`
// RollbackWindow is how many of each service's latest revisions keep
// their images through registry cleanup (Phase 15a).
RollbackWindow int `json:"rollbackWindow"`
CreatedAt time.Time `json:"createdAt"`
// Deleting: the project goes once its environments are gone (15d).
Deleting bool `json:"deleting"`
}
type ProjectDeployment ¶
type ProjectDeployment struct {
Deployment
Service string `json:"service"`
Environment string `json:"environment"`
}
ProjectDeployment is a deployment with its service's name and environment.
type RegistryEvent ¶
type RegistryEvent struct {
ID int64 `json:"id"`
EventID string `json:"-"`
At time.Time `json:"at"`
Action string `json:"action"`
Repository string `json:"repository"`
Tag string `json:"tag"`
Digest string `json:"digest"`
Actor string `json:"actor"`
Addr string `json:"addr"`
UserAgent string `json:"userAgent"`
}
RegistryEvent is one manifest push, pull or delete reported by the registry.
type Released ¶
type Released struct {
Kind string `json:"kind"` // mesh | subnet | vip
Index int `json:"index"`
ReleasedAt time.Time `json:"releasedAt"`
}
Released is an address-pool index in its cool-down.
type Retention ¶
type Retention struct {
Audit time.Duration // audit log
Incidents time.Duration // closed incidents
Deployments time.Duration // finished deployments
Builds time.Duration // finished builds (the deployed build of a service is kept)
Usage time.Duration // daily usage rows
Revisions int // task definitions per service (current, previous and in-flight ones are kept)
}
Retention of history the controller keeps (§Phase 9 GC). Zero keeps forever.
type RoleTrust ¶
type RoleTrust struct {
Users []string `json:"users"` // user IDs
Groups []string `json:"groups"` // group IDs
RequireMFA bool `json:"requireMfa"`
}
RoleTrust says who may assume a role.
type RunAddress ¶
type RunAddress struct {
ID, ServiceID, EnvironmentID, IP string
}
RunAddress is an active job run with its container address.
type S3Binding ¶
type S3Binding struct {
ID string `json:"id"`
ServiceID string `json:"serviceId"`
EndpointID string `json:"endpointId"`
Endpoint string `json:"endpoint"` // name, joined in
Bucket string `json:"bucket"`
Prefix string `json:"prefix"`
EnvPrefix string `json:"envPrefix"`
CreatedAt time.Time `json:"createdAt"`
// Joined in for listings.
Project string `json:"project"`
Environment string `json:"environment"`
Service string `json:"service"`
}
type S3Endpoint ¶
type ScalingEvent ¶
type ScalingEvent struct {
ID int64 `json:"id"`
ServiceID string `json:"-"`
At time.Time `json:"at"`
From int `json:"from"`
To int `json:"to"`
Metric string `json:"metric"`
Value *float64 `json:"value"` // nil when there was no data (min/max clamp)
Target float64 `json:"target"`
Reason string `json:"reason"`
}
ScalingEvent is one autoscaler decision that changed the desired count.
type ScalingPolicy ¶
type ScalingPolicy struct {
ServiceID string `json:"-"`
Enabled bool `json:"enabled"`
Min int `json:"min"`
Max int `json:"max"`
Metric string `json:"metric"`
Target float64 `json:"target"`
ScaleOutCooldown int `json:"scaleOutCooldown"`
ScaleInCooldown int `json:"scaleInCooldown"`
ScaleInChecks int `json:"scaleInChecks"`
UpdatedAt time.Time `json:"updatedAt"`
UpdatedBy string `json:"updatedBy"`
}
ScalingPolicy is a service's target tracking policy (§5.5).
type SecurityGroup ¶
type Service ¶
type Service struct {
ID string
EnvironmentID string
Project string // names, joined in
Environment string
Name string
Revision int
DesiredCount int
Deleting bool
Status string
// Held: the first deployment waits on its pre-deploy jobs, so no task
// runs yet.
Held bool
CreatedAt time.Time
UpdatedAt time.Time
}
type Store ¶
type Store struct {
// W is the single writer connection. Use it for every INSERT/UPDATE/DELETE.
W *sql.DB
// R is the read pool.
R *sql.DB
}
func (*Store) APITokenByHash ¶
APITokenByHash returns ErrNotFound for unknown or expired tokens.
func (*Store) AccessKeyByID ¶
func (*Store) ActiveDeployment ¶
ActiveDeployment returns the service's in-progress deployment.
func (*Store) ActiveRunAddresses ¶
func (s *Store) ActiveRunAddresses(ctx context.Context) ([]RunAddress, error)
ActiveRunAddresses lists pending and running runs that have an address.
func (*Store) ActiveRuns ¶
ActiveRuns returns pending and running runs.
func (*Store) AddAlertEvent ¶
AddAlertEvent records a notification; events older than 90 days go.
func (*Store) AddDatabaseBackup ¶
func (s *Store) AddDatabaseBackup(ctx context.Context, b DatabaseBackup) error
AddDatabaseBackup records a run that has started, keeping the newest 200.
func (*Store) AddDatabaseEvent ¶
func (s *Store) AddDatabaseEvent(ctx context.Context, e DatabaseEvent) error
func (*Store) AddDatabaseOrphan ¶
func (s *Store) AddDatabaseOrphan(ctx context.Context, o DatabaseOrphan) error
AddDatabaseOrphan records a member volume to remove (idempotent).
func (*Store) AddDeploymentEvent ¶
func (s *Store) AddDeploymentEvent(ctx context.Context, depID, kind, message string, at time.Time) error
AddDeploymentEvent appends a step to a deployment's timeline.
func (*Store) AddPoolEvent ¶
AddPoolEvent records a decision; 500 are kept per pool.
func (*Store) AddRevision ¶
func (s *Store) AddRevision(ctx context.Context, serviceID, spec, createdBy string, now time.Time) (rev int, changed bool, err error)
AddRevision stores spec as a new revision without making it current. It returns the current revision when spec equals it (nothing to deploy).
func (*Store) AddScalingEvent ¶
func (s *Store) AddScalingEvent(ctx context.Context, e ScalingEvent) error
AddScalingEvent records a decision and keeps the newest 500 per service.
func (*Store) AddressHistory ¶
AddressHistory lists assignments, newest first; ip filters when set.
func (*Store) AlertChannel ¶
func (*Store) AllDatabaseMembers ¶
func (s *Store) AllDatabaseMembers(ctx context.Context) ([]DatabaseMember, error)
AllDatabaseMembers is every member of every database.
func (*Store) AllocateNodeNetwork ¶
func (s *Store) AllocateNodeNetwork(ctx context.Context, nodeID string, mesh, subnet IndexPool, cooldown time.Duration, now time.Time) (NodeNetwork, error)
AllocateNodeNetwork returns the node's allocation, creating one on first use with the lowest free index of each pool.
func (*Store) ApproveDeviceCode ¶
ApproveDeviceCode records the approving user and the credential issued.
func (*Store) AssignAddress ¶
func (s *Store) AssignAddress(ctx context.Context, ip, ownerID, owner, nodeID string, at time.Time) error
AssignAddress records that ownerID now holds ip, closing any open record of that address or owner.
func (*Store) AutoDeployWatches ¶ added in v0.1.7
func (s *Store) AutoDeployWatches(ctx context.Context) ([]ImageWatch, error)
AutoDeployWatches lists the watches that watch their registry.
func (*Store) BuildByCheckRun ¶
BuildByCheckRun finds the build whose after-build checks a run is.
func (*Store) BuildByRun ¶
func (*Store) BuildsByStatus ¶
func (*Store) CloseIncident ¶
func (*Store) ConfirmNodeCert ¶
ConfirmNodeCert drops the previous serial once the node uses the current one.
func (*Store) CreateAPIToken ¶
func (*Store) CreateAccessKey ¶
CreateAccessKey enforces the per-user limit inside the write transaction.
func (*Store) CreateBuild ¶
CreateBuild records a build; ErrNameTaken means this commit was built already.
func (*Store) CreateDatabase ¶
CreateDatabase stores a new database. Its name must be free among all databases, and for a project database also among its environment's services (they share DNS names).
func (*Store) CreateDatabaseMember ¶
func (s *Store) CreateDatabaseMember(ctx context.Context, m DatabaseMember) error
func (*Store) CreateDeviceCode ¶
func (s *Store) CreateDeviceCode(ctx context.Context, d DeviceCode) error
func (*Store) CreateEnvironment ¶
func (s *Store) CreateEnvironment(ctx context.Context, e Environment) error
func (*Store) CreateEtcdMember ¶
func (s *Store) CreateEtcdMember(ctx context.Context, m EtcdMember) error
func (*Store) CreateGitConnection ¶
func (s *Store) CreateGitConnection(ctx context.Context, c GitConnection) error
func (*Store) CreateJoinToken ¶
func (*Store) CreateProject ¶
CreateProject creates a project with one environment, in one transaction.
func (*Store) CreateRootUser ¶
CreateRootUser creates the first account and consumes the setup token in one transaction, so two concurrent setup requests cannot both succeed.
func (*Store) CreateService ¶
CreateService creates a service with its first revision.
func (*Store) CreateTempCredential ¶
func (s *Store) CreateTempCredential(ctx context.Context, c TempCredential) error
func (*Store) CreateUser ¶
CreateUser adds a user or service account. ErrNameTaken: the email is used.
func (*Store) DatabaseBackupByID ¶
DatabaseBackupByID returns one run.
func (*Store) DatabaseBackups ¶
func (s *Store) DatabaseBackups(ctx context.Context, databaseID string, limit int) ([]DatabaseBackup, error)
DatabaseBackups lists a cluster's runs, newest first.
func (*Store) DatabaseByID ¶
func (*Store) DatabaseByName ¶
func (*Store) DatabaseEvents ¶
func (s *Store) DatabaseEvents(ctx context.Context, databaseID string, limit int, before string) ([]DatabaseEvent, error)
DatabaseEvents returns the newest events, older than the event before names when set.
func (*Store) DatabaseEventsAfter ¶ added in v0.2.0
func (s *Store) DatabaseEventsAfter(ctx context.Context, kind string, afterID int64) ([]DatabaseEvent, error)
DatabaseEventsAfter returns events of a kind with IDs after afterID, oldest first (for alerts).
func (*Store) DatabaseMemberByID ¶
func (*Store) DatabaseMembers ¶
func (*Store) DatabaseNameTaken ¶
DatabaseNameTaken reports whether a database of the environment uses the name (services check it).
func (*Store) DatabaseOrphanByTask ¶
DatabaseOrphanByTask returns the orphan of a task.
func (*Store) DefaultSecurityGroup ¶
DefaultSecurityGroup returns a project's default group.
func (*Store) DeleteAPIToken ¶
func (*Store) DeleteAccessKey ¶
DeleteAccessKey deletes a key owned by userID. It returns ErrNotFound otherwise.
func (*Store) DeleteAlertChannel ¶
func (*Store) DeleteAlertRule ¶
func (*Store) DeleteAlertState ¶
func (*Store) DeleteCertificate ¶
func (*Store) DeleteCloudProvider ¶
func (*Store) DeleteDatabase ¶
DeleteDatabase removes a database and its members, releasing its VIPs into the cooldown.
func (*Store) DeleteDatabaseMember ¶
func (*Store) DeleteDatabaseOrphan ¶
DeleteDatabaseOrphan forgets an orphan once its node removed it.
func (*Store) DeleteDeviceCode ¶
DeleteDeviceCode is called once the CLI has picked up its credential.
func (*Store) DeleteDomain ¶
DeleteDomain removes a service's domain by ID, or every route of a host when ref is a host name.
func (*Store) DeleteEnvironment ¶
func (*Store) DeleteEtcdMember ¶
func (*Store) DeleteExpiredJoinTokens ¶
DeleteExpiredJoinTokens removes tokens that can no longer be used.
func (*Store) DeleteExpiredSessions ¶
func (*Store) DeleteFirewallPolicy ¶
func (*Store) DeleteGitConnection ¶
DeleteGitConnection removes a connection no source uses.
func (*Store) DeleteGitSource ¶
func (*Store) DeleteIAMPolicy ¶
func (*Store) DeleteJoinToken ¶
func (*Store) DeleteLifecyclePolicy ¶
func (*Store) DeleteMiddleware ¶
func (*Store) DeletePoolServer ¶
func (*Store) DeleteProject ¶
DeleteProject removes a project without services.
func (*Store) DeleteQuota ¶
func (*Store) DeleteS3Endpoint ¶
DeleteS3Endpoint deletes an endpoint no service is bound to.
func (*Store) DeleteScalingPolicy ¶
func (*Store) DeleteSecurityGroup ¶
func (*Store) DeleteTempCredential ¶
func (*Store) DeleteUpstreamCredential ¶
func (*Store) DeploymentByID ¶
func (*Store) DeploymentEvents ¶
DeploymentEvents returns a deployment's timeline, oldest first.
func (*Store) DeploymentRuns ¶
DeploymentRuns returns the hook runs of a deployment, oldest first.
func (*Store) DeviceCodeByHash ¶
func (*Store) DeviceCodeByUserCode ¶
func (*Store) EndpointS3Bindings ¶
func (*Store) EnsureDatabaseVIPs ¶
func (s *Store) EnsureDatabaseVIPs(ctx context.Context, id string, pool IndexPool, cooldown time.Duration, now time.Time) (int, int, error)
EnsureDatabaseVIPs allocates the read-write and read-only VIPs from the same pool as service VIPs.
func (*Store) EnsureServiceVIP ¶
func (s *Store) EnsureServiceVIP(ctx context.Context, serviceID string, pool IndexPool, cooldown time.Duration, now time.Time) (int, error)
EnsureServiceVIP returns the service's VIP index, allocating the lowest free one on first use.
func (*Store) EnvironmentByID ¶
func (*Store) EnvironmentByName ¶
func (*Store) EnvironmentContents ¶
func (s *Store) EnvironmentContents(ctx context.Context, id string) (services int, databases []string, err error)
EnvironmentContents counts what is left in an environment.
func (*Store) EtcdMemberByID ¶
func (*Store) EtcdMembers ¶
func (s *Store) EtcdMembers(ctx context.Context) ([]EtcdMember, error)
EtcdMembers lists the members by ordinal.
func (*Store) FailRunningGCRuns ¶
FailRunningGCRuns marks runs interrupted by a controller restart.
func (*Store) FailedSince ¶
func (*Store) FinishDatabaseBackup ¶
func (s *Store) FinishDatabaseBackup(ctx context.Context, id, state, errText string, at time.Time) (bool, error)
FinishDatabaseBackup ends a running run (no-op when it already ended).
func (*Store) FinishDeployment ¶
func (*Store) FirewallPolicy ¶
func (*Store) GetSetting ¶
GetSetting returns ("", false, nil) when the key is not set.
func (*Store) GitConnection ¶
func (*Store) GitSourceByID ¶
func (*Store) GitSourceByService ¶
func (*Store) GitSourcesByConnection ¶
func (s *Store) GitSourcesByConnection(ctx context.Context, connectionID string) ([]GitSource, error)
GitSourcesByConnection returns every source of a connection.
func (*Store) GitSourcesByRepo ¶
func (s *Store) GitSourcesByRepo(ctx context.Context, connectionID, repo string) ([]GitSource, error)
GitSourcesByRepo returns the sources building a connection's repository.
func (*Store) ImageStatsFor ¶
ImageStatsFor returns the counters of every digest of repo ("" = all).
func (*Store) ImageWatch ¶ added in v0.1.7
ImageWatch returns a service's image watch; ErrNotFound when it has none.
func (*Store) ImageWatchByWebhook ¶ added in v0.1.7
ImageWatchByWebhook finds the watch whose deploy webhook token hashes to hash.
func (*Store) IncDeploymentFailures ¶
IncDeploymentFailures counts a failed task of the deployment's revision.
func (*Store) JobRuns ¶
func (s *Store) JobRuns(ctx context.Context, jobID string, limit int, before string) ([]JobRun, error)
JobRuns returns a job's newest runs, older than the run before names when set.
func (*Store) JoinNode ¶
JoinNode consumes a join token and creates the node in one transaction. It returns ErrNotFound if the token is unknown, expired or used up, and ErrNameTaken if the node name exists.
func (*Store) LastDatabaseEventID ¶ added in v0.2.0
LastDatabaseEventID is the newest event's ID (0 = none).
func (*Store) LastPoolEvent ¶
LastPoolEvent returns the newest event of a kind ("" any).
func (*Store) LifecyclePolicy ¶
func (*Store) ListAPITokens ¶
func (*Store) ListAccessKeys ¶
func (*Store) ListAlertChannels ¶
func (s *Store) ListAlertChannels(ctx context.Context) ([]AlertChannel, error)
func (*Store) ListAlertEvents ¶
func (s *Store) ListAlertEvents(ctx context.Context, limit int, before string) ([]AlertEvent, error)
ListAlertEvents returns the newest events, older than the event before names when set (cursor pagination).
func (*Store) ListAlertRules ¶
func (*Store) ListAlertStates ¶
func (s *Store) ListAlertStates(ctx context.Context) ([]AlertState, error)
func (*Store) ListAttachments ¶
func (s *Store) ListAttachments(ctx context.Context) ([]Attachment, error)
func (*Store) ListCertificates ¶
func (s *Store) ListCertificates(ctx context.Context) ([]Certificate, error)
func (*Store) ListCloudProviders ¶
func (s *Store) ListCloudProviders(ctx context.Context) ([]CloudProvider, error)
func (*Store) ListDatabases ¶
func (*Store) ListDeployments ¶
func (s *Store) ListDeployments(ctx context.Context, serviceID string, limit int, before string) ([]Deployment, error)
ListDeployments returns a service's newest deployments, older than the deployment before names when set.
func (*Store) ListDomains ¶
ListDomains returns custom domains of one service ("" = all).
func (*Store) ListEnvironments ¶
func (*Store) ListFirewallPolicies ¶
func (s *Store) ListFirewallPolicies(ctx context.Context) ([]FirewallPolicy, error)
func (*Store) ListGitConnections ¶
func (s *Store) ListGitConnections(ctx context.Context) ([]GitConnection, error)
func (*Store) ListGitSources ¶
func (*Store) ListIAMGroups ¶
func (*Store) ListIAMPolicies ¶
func (*Store) ListIncidents ¶
func (s *Store) ListIncidents(ctx context.Context, serviceID string, openOnly bool, limit int) ([]Incident, error)
ListIncidents returns incidents, newest first (open only when openOnly).
func (*Store) ListJobsIn ¶
func (*Store) ListJoinTokens ¶
func (*Store) ListLifecyclePolicies ¶
func (s *Store) ListLifecyclePolicies(ctx context.Context) ([]LifecyclePolicy, error)
func (*Store) ListMiddlewares ¶
func (s *Store) ListMiddlewares(ctx context.Context) ([]Middleware, error)
func (*Store) ListNodeNetworks ¶
func (s *Store) ListNodeNetworks(ctx context.Context) ([]NodeNetwork, error)
func (*Store) ListNodePools ¶
func (*Store) ListPoolEvents ¶
func (s *Store) ListPoolEvents(ctx context.Context, poolID string, limit int, before string) ([]PoolEvent, error)
ListPoolEvents returns the newest events, older than the event before names when set.
func (*Store) ListPoolServers ¶
func (*Store) ListProjectDeployments ¶
func (s *Store) ListProjectDeployments(ctx context.Context, projectID string, f DeploymentFilter, limit int, before string) ([]ProjectDeployment, error)
ListProjectDeployments returns the newest deployments of every service in a project, older than the deployment before names when set.
func (*Store) ListRegistryEvents ¶
func (s *Store) ListRegistryEvents(ctx context.Context, repo string, limit int, before string) ([]RegistryEvent, error)
ListRegistryEvents returns the newest events, of one repository when repo is set, older than the event before names when set.
func (*Store) ListRouting ¶
ListRouting returns the routing rows of one service ("" = all).
func (*Store) ListS3Endpoints ¶
func (s *Store) ListS3Endpoints(ctx context.Context) ([]S3Endpoint, error)
func (*Store) ListScalingPolicies ¶
func (s *Store) ListScalingPolicies(ctx context.Context) ([]ScalingPolicy, error)
func (*Store) ListSecurityGroups ¶
func (s *Store) ListSecurityGroups(ctx context.Context) ([]SecurityGroup, error)
ListSecurityGroups returns every group, by project and name.
func (*Store) ListServicesIn ¶
func (*Store) ListTaskDefinitions ¶
func (*Store) ListUpstreamCredentials ¶
func (s *Store) ListUpstreamCredentials(ctx context.Context) ([]UpstreamCredential, error)
func (*Store) ListUsage ¶
ListUsage returns days in [from, to] (YYYY-MM-DD), optionally for one project.
func (*Store) MarkDatabaseDeleting ¶
func (*Store) MarkEnvironmentDeleting ¶
MarkEnvironmentDeleting flags an environment to go once its services are gone; its jobs go at once (no new runs start).
func (*Store) MarkProjectDeleting ¶
MarkProjectDeleting flags a project to go once its environments are gone.
func (*Store) MarkServiceDeleting ¶
MarkServiceDeleting scales the service to zero; the reconciler deletes it once its tasks are gone.
func (*Store) NodeByName ¶
func (*Store) NodeCertSerials ¶
NodeCertSerials returns the accepted serials (current, previous).
func (*Store) NodeDatabaseMembers ¶
func (*Store) NodeDatabaseOrphans ¶
NodeDatabaseOrphans lists a node's orphans.
func (*Store) NodeNetwork ¶
func (*Store) ProjectByID ¶
func (*Store) ProjectByName ¶
func (*Store) PruneRegistryEvents ¶
PruneRegistryEvents deletes events older than before.
func (*Store) PruneTasks ¶
PruneTasks deletes stopped tasks beyond keep per service.
func (*Store) PutAlertChannel ¶
func (s *Store) PutAlertChannel(ctx context.Context, c AlertChannel) error
func (*Store) PutAlertState ¶
func (s *Store) PutAlertState(ctx context.Context, a AlertState) error
func (*Store) PutCertificate ¶
func (s *Store) PutCertificate(ctx context.Context, c Certificate) error
func (*Store) PutCloudProvider ¶
func (s *Store) PutCloudProvider(ctx context.Context, p CloudProvider) error
func (*Store) PutFirewallPolicy ¶
func (s *Store) PutFirewallPolicy(ctx context.Context, p FirewallPolicy) error
PutFirewallPolicy creates or replaces a policy. It returns ErrNameTaken when another policy has the name.
func (*Store) PutIAMGroup ¶
PutIAMGroup creates or updates a group and replaces its members.
func (*Store) PutImageWatchSettings ¶ added in v0.1.7
func (s *Store) PutImageWatchSettings(ctx context.Context, serviceID string, autoDeploy bool, pollSeconds int, now time.Time) error
PutImageWatchSettings sets a service's auto-deploy and polling interval.
func (*Store) PutLifecyclePolicy ¶
func (s *Store) PutLifecyclePolicy(ctx context.Context, p LifecyclePolicy) error
func (*Store) PutMiddleware ¶
func (s *Store) PutMiddleware(ctx context.Context, m Middleware) error
PutMiddleware creates or updates a middleware and replaces its attachments.
func (*Store) PutPoolServer ¶
func (s *Store) PutPoolServer(ctx context.Context, x PoolServer) error
func (*Store) PutS3Endpoint ¶
func (s *Store) PutS3Endpoint(ctx context.Context, e S3Endpoint) error
PutS3Endpoint creates or updates an endpoint (by ID).
func (*Store) PutScalingPolicy ¶
func (s *Store) PutScalingPolicy(ctx context.Context, p ScalingPolicy) error
func (*Store) PutSecurityGroup ¶
func (s *Store) PutSecurityGroup(ctx context.Context, g SecurityGroup) error
PutSecurityGroup creates or updates a group and replaces its attachments.
func (*Store) PutUpstreamCredential ¶
func (s *Store) PutUpstreamCredential(ctx context.Context, c UpstreamCredential) error
PutUpstreamCredential creates or replaces the credential for c.Host.
func (*Store) QueryAudit ¶
func (s *Store) QueryAudit(ctx context.Context, f AuditFilter, limit int) ([]AuditRecord, error)
func (*Store) RecentBuilds ¶
RecentBuilds returns the newest builds, older than the build before names when set.
func (*Store) RecordGitCheck ¶
RecordGitCheck stores a poll result. sha is set only on success.
func (*Store) RecordGitWebhook ¶
RecordGitWebhook notes a webhook delivery (polling then slows down).
func (*Store) RecordImageCheck ¶ added in v0.1.7
func (s *Store) RecordImageCheck(ctx context.Context, serviceID, digest, errMsg string, deployed bool, now time.Time) error
RecordImageCheck stores the result of a check of the registry.
func (*Store) RecordRegistryEvents ¶
RecordRegistryEvents stores events, skipping ones already seen (the registry retries deliveries), and updates the per-digest counters. It returns how many were new.
func (*Store) RejoinTarget ¶
func (s *Store) RejoinTarget(ctx context.Context, tokenHash string, now time.Time) (Node, bool, error)
RejoinTarget is the existing node a join token re-joins, if any: the token is bound to a node name that exists.
func (*Store) ReleaseAddress ¶
ReleaseAddress closes ownerID's open record.
func (*Store) ReleaseService ¶
ReleaseService lets a held service run its tasks.
func (*Store) RootUser ¶ added in v0.2.0
RootUser returns the root account (ErrNotFound before setup).
func (*Store) RotateNodeCert ¶
RotateNodeCert records a renewed certificate; the current serial becomes the previous one and stays valid until the node connects with the new one.
func (*Store) S3EndpointByRef ¶
S3EndpointByRef finds an endpoint by ID or name.
func (*Store) ScalingEvents ¶
func (*Store) ScalingPolicy ¶
func (*Store) SecurityGroupByName ¶
func (*Store) ServiceBuilds ¶
func (s *Store) ServiceBuilds(ctx context.Context, serviceID string, limit int, before string) ([]Build, error)
ServiceBuilds returns a service's newest builds, older than the build before names when set.
func (*Store) ServiceByID ¶
func (*Store) ServiceByName ¶
func (*Store) ServiceS3Bindings ¶
func (*Store) ServiceTasks ¶
ServiceTasks returns a service's tasks, newest first; history limits stopped ones.
func (*Store) SessionByHash ¶
SessionByHash returns ErrNotFound for unknown or expired sessions.
func (*Store) SetAlertDelivery ¶
func (*Store) SetDatabaseNetwork ¶
func (*Store) SetDatabaseSpec ¶
func (*Store) SetDatabaseState ¶
func (*Store) SetDatabaseStatus ¶
func (*Store) SetDeploymentStatus ¶
func (s *Store) SetDeploymentStatus(ctx context.Context, id, status, message string, finished *time.Time) error
SetDeploymentStatus moves a deployment to status (e.g. from waiting_hook).
func (*Store) SetEnvironmentPolicy ¶
func (s *Store) SetEnvironmentPolicy(ctx context.Context, id string, autoDeploy bool, lock *DeployLock) error
SetEnvironmentPolicy sets an environment's auto-deploy switch and deploy lock (lock nil: unlocked).
func (*Store) SetGitBuildSettings ¶
func (s *Store) SetGitBuildSettings(ctx context.Context, serviceID, settings string, varsEnc []byte) error
SetGitBuildSettings stores a source's build settings and encrypted build-time variables.
func (*Store) SetGitHook ¶
SetGitHook records the webhook created on the repository (or why not).
func (*Store) SetGitRefs ¶
SetGitRefs stores the last seen commit of every watched ref.
func (*Store) SetImageWebhook ¶ added in v0.1.7
SetImageWebhook sets (or with "" removes) the deploy webhook's token hash.
func (*Store) SetJobScheduled ¶
func (*Store) SetNodePool ¶
SetNodePool moves a node into a pool ("" for none).
func (*Store) SetNodeSchedulable ¶
func (*Store) SetNodeStatus ¶
SetNodeStatus records a status transition.
func (*Store) SetNodeWireGuard ¶
func (s *Store) SetNodeWireGuard(ctx context.Context, nodeID, publicKey, endpoint string, now time.Time) (bool, error)
SetNodeWireGuard records the node's public key and endpoint. It reports whether anything changed.
func (*Store) SetPassword ¶
SetPassword changes any user's password (including root) and ends their sessions.
func (*Store) SetProjectNodes ¶
SetProjectNodes sets the nodes a project's workloads may run on (nil = any).
func (*Store) SetRouting ¶
SetRouting replaces a service's routing rows in one transaction. ErrNameTaken means a label or public port belongs to another service.
func (*Store) SetRunIP ¶
SetRunIP records a job run container's address; changed is false when it was known already.
func (*Store) SetServiceRevision ¶
func (s *Store) SetServiceRevision(ctx context.Context, serviceID string, rev int, now time.Time) error
SetServiceRevision makes rev current.
func (*Store) SetServiceS3Bindings ¶
SetServiceS3Bindings replaces a service's bindings.
func (*Store) SetServiceStatus ¶
func (*Store) SetSharedEnv ¶
SetSharedEnv replaces an environment's shared variables.
func (*Store) SetTaskDesired ¶
SetTaskDesired marks a task to be stopped (or a stopped one's final state).
func (*Store) StartDeployment ¶
func (s *Store) StartDeployment(ctx context.Context, d Deployment) error
StartDeployment supersedes any running deployment of the service and records a new one.
func (*Store) TaskDefinition ¶
func (*Store) TempCredentialByID ¶
func (s *Store) TempCredentialByID(ctx context.Context, id string, now time.Time) (TempCredential, error)
TempCredentialByID returns ErrNotFound for unknown or expired credentials.
func (*Store) TouchAPIToken ¶
func (*Store) TouchAccessKey ¶
func (*Store) TouchLogin ¶
func (*Store) TouchSession ¶
TouchSession extends a session's expiry (sliding expiration).
func (*Store) TouchTempCredential ¶
func (*Store) UpdateDatabaseMember ¶
UpdateDatabaseMember saves a member's observed and desired state.
func (*Store) UpdateEtcdMember ¶
UpdateEtcdMember saves a member's observed state and spec.
func (*Store) UpdateIncident ¶
func (*Store) UpdateNodeInfo ¶
UpdateNodeInfo stores the NodeInfo from an agent's Hello.
func (*Store) UpdateProjectSettings ¶
func (s *Store) UpdateProjectSettings(ctx context.Context, id, description string, rollbackWindow int) error
UpdateProjectSettings sets a project's description and rollback window.
func (*Store) UpdateService ¶
func (s *Store) UpdateService(ctx context.Context, id, spec string, desired int, createdBy string, now time.Time) (int, error)
UpdateService records a new revision when spec differs from the current one, and sets the desired count. It returns the resulting revision.
func (*Store) UpdateTaskStatus ¶
UpdateTaskStatus applies an agent report.
func (*Store) UpdateUser ¶
func (s *Store) UpdateUser(ctx context.Context, id, name string, disabled bool, passwordHash string) error
UpdateUser changes a user's name, disabled flag and (when set) password.
func (*Store) UserByEmail ¶
func (*Store) WriteAudit ¶
func (s *Store) WriteAudit(ctx context.Context, e AuditEvent) error
type TaskDefinition ¶
type TempCredential ¶
type UpstreamCredential ¶
type UsageRow ¶
type UsageRow struct {
Project string `json:"project"`
Environment string `json:"environment"`
Day string `json:"day"`
CPUReservedHours float64 `json:"cpuReservedHours"`
MemReservedHours float64 `json:"memReservedGiBHours"`
CPUUsedHours float64 `json:"cpuUsedHours"`
MemUsedHours float64 `json:"memUsedGiBHours"`
NetOutBytes int64 `json:"netOutBytes"`
LogBytes int64 `json:"logBytes"`
BuildSeconds int64 `json:"buildSeconds"`
}
UsageRow is one project-environment-day of metered usage.
Source Files
¶
- alerts.go
- audit.go
- autoscale.go
- builds.go
- certificates.go
- credentials.go
- databases.go
- dbbackups.go
- etcd.go
- firewall.go
- fs.go
- gc.go
- gitconn.go
- iam.go
- imagewatch.go
- ipam.go
- jobs.go
- middlewares.go
- network.go
- nodes.go
- nulllist.go
- orphans.go
- pools.go
- quotas.go
- regevents.go
- registry.go
- s3.go
- secgroups.go
- sessions.go
- settings.go
- store.go
- upstreams.go
- users.go
- workloads.go