Help us shape the future of Go! Take the 2026 Go Developer Survey

control

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package control holds shed's operations on projects, services, deployments, variables, domains, volumes, backups, metrics, and updates: the rules every interface to shed shares. The HTTP API and the MCP server call a Plane instead of the store and the deployer directly, so that both validate the same way, serialize deployments under the same lock, and show the same state.

Plane returns plain views (for example ServiceView) rather than wire types, and reports failures callers branch on as an *Error with a message fit to show, or as the sentinel errors of the packages below it; Explain turns either into a kind and a message.

Index

Constants

View Source
const MaxDeployments = 50

MaxDeployments is the most deployments Deployments returns.

View Source
const MaxLogLines = 2000

MaxLogLines is the most lines BuildLog, RuntimeLogs, and ShedLog return.

Variables

View Source
var (
	// ErrInvalid reports a request that breaks a rule, such as a service
	// name that is not a DNS label.
	ErrInvalid = errors.New("control: invalid")
	// ErrNotFound reports that a project, service, deployment, domain,
	// volume, or backup does not exist. It is store.ErrNotFound, so the
	// store's lookups match it as they are.
	ErrNotFound = store.ErrNotFound
	// ErrConflict reports a request that the current state does not allow,
	// such as a name already in use or a service that is busy.
	ErrConflict = errors.New("control: conflict")
	// ErrUpstream reports that GitHub or 1Password failed a request.
	ErrUpstream = errors.New("control: upstream")
	// ErrUnavailable reports that shed is shutting down.
	ErrUnavailable = errors.New("control: unavailable")
)

The kinds of failure an *Error reports.

Functions

This section is empty.

Types

type BackupList

type BackupList struct {
	Policy  backup.Policy
	Backups []BackupView
	// Restore is the service's latest restore, if any; always nil for
	// shed.db.
	Restore *store.Restore
}

BackupList is the backup policy and the newest backups of a service, or of shed.db.

type BackupView

type BackupView struct {
	store.Backup
	FileName string
}

BackupView is a backup with the name its archive downloads as.

type Backups

type Backups interface {
	BackUp(ctx context.Context, serviceID string) (store.Backup, error)
	Backups(ctx context.Context, serviceID string, limit int) ([]store.Backup, error)
	Restore(ctx context.Context, backupID string) (store.Restore, error)
	Delete(ctx context.Context, backupID string) error
	Open(ctx context.Context, backupID string) (io.ReadCloser, error)
	PauseService(ctx context.Context, serviceID string) (resume func(), err error)
	ForgetService(ctx context.Context, serviceID string) error
	Policy(ctx context.Context, serviceID string) (backup.Policy, error)
	SetPolicy(ctx context.Context, serviceID string, in backup.PolicyInput) (backup.Policy, error)
	Settings(ctx context.Context) (backup.Settings, error)
	SetSettings(ctx context.Context, in backup.SettingsInput) (backup.Settings, error)
	TestS3(ctx context.Context, in backup.S3Input) error
	Identity(ctx context.Context) (string, error)
}

Backups runs backups and restores and holds the backup settings. *backup.Manager implements it.

type Config

type Config struct {
	Store    Store
	Deployer Deployer
	Backups  Backups
	Metrics  Metrics
	Logs     Logs
	Updates  Updates
	// GitHub returns the GitHub client, or false until the GitHub App is
	// configured.
	GitHub      func() (GitHub, bool)
	OnePassword OnePassword
	// BaseURL is the public dashboard URL. Its host cannot be a service
	// domain.
	BaseURL string
	// BaseDomain is the parent of generated service domains; empty disables
	// them.
	BaseDomain string
	Log        *slog.Logger
}

Config configures a Plane.

type Deployer

type Deployer interface {
	Deploy(ctx context.Context, serviceID string, trigger store.Trigger, c deploy.Commit) (store.Deployment, error)
	Redeploy(ctx context.Context, deploymentID string) (store.Deployment, error)
	AvailableImages(ctx context.Context, serviceID string, images []string) (map[string]bool, error)
	Cancel(ctx context.Context, deploymentID string) (store.Deployment, error)
	ServiceStatuses(ctx context.Context, projectID string) (map[string]deploy.ServiceStatus, error)
	ApplyRoutes(ctx context.Context) error
	StopService(ctx context.Context, serviceID string) error
	StartService(ctx context.Context, serviceID string) error
	RestartService(ctx context.Context, serviceID string) error
	ClearRestoreFence(ctx context.Context, serviceID string) error
	DeleteService(ctx context.Context, serviceID string) error
	DeleteProject(ctx context.Context, projectID string) error
	DeleteVolume(ctx context.Context, volumeID string) error
	FollowLog(ctx context.Context, deploymentID string, line func(string), status func(store.DeploymentStatus)) error
	BuildLog(ctx context.Context, deploymentID string, n int) ([]string, error)
	RuntimeLogs(ctx context.Context, serviceID string, tail int, follow bool, w io.Writer) error
	ResolveVariables(ctx context.Context, serviceID string) (deploy.Resolved, error)
}

Deployer runs deployments and owns the Docker side of services. *deploy.Deployer implements it.

type DeploymentView

type DeploymentView struct {
	ID            string
	ServiceID     string
	Status        store.DeploymentStatus
	Trigger       store.Trigger
	CommitSHA     string
	CommitMessage string
	CommitAuthor  string
	Image         string
	Error         string
	CreatedAt     time.Time
	StartedAt     *time.Time
	FinishedAt    *time.Time
	// ImageAvailable reports whether the deployment's image is still on the
	// server, so that it can be redeployed. It is set only in deployment
	// lists, for deployments with an image, when Docker could be asked.
	ImageAvailable *bool
}

DeploymentView is a deployment without its runtime record, which holds the resolved variables its container was started with.

type Error

type Error struct {
	Kind error
	Msg  string
}

Error is a failure with a message fit to show to the user. Kind is one of ErrInvalid, ErrNotFound, ErrConflict, ErrUpstream, or ErrUnavailable, and errors.Is matches it.

func Explain

func Explain(err error) (*Error, bool)

Explain returns err as an *Error: itself if it is one, or the kind and message of a known condition, such as a missing record or a busy service. It returns false for unexpected errors, whose text is not meant for users.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns e.Kind.

type GitHub

type GitHub interface {
	Commit(ctx context.Context, fullName, ref string) (github.Commit, error)
	Repos(ctx context.Context) ([]github.Repo, error)
	Branches(ctx context.Context, fullName string) ([]string, error)
}

GitHub reads repositories through the GitHub App. *github.Client implements it.

type Logs

type Logs interface {
	Lines(n int) []string
	Follow(ctx context.Context, emit func(line string))
}

Logs holds the tail of shed's own log. *logtail.Tail implements it.

type Metrics

type Metrics interface {
	Query(ctx context.Context, serviceID string, r metrics.Range) (metrics.Series, error)
	QueryHost(ctx context.Context, r metrics.Range) (metrics.HostSeries, error)
}

Metrics answers resource usage queries. *metrics.Collector implements it.

type NewService

type NewService struct {
	// Name is the service's DNS label, unique in its project.
	Name string
	// Kind is "app" or a database kind of the catalog, such as "postgres".
	Kind string
	// Repo and Branch are the source of a repo app; Image that of an image
	// app.
	Repo   string
	Branch string
	Image  string
}

NewService describes a service to create.

type OnePassword added in v0.2.4

type OnePassword interface {
	Connected(ctx context.Context) (bool, error)
	Connect(ctx context.Context, token string) error
	Disconnect(ctx context.Context) error
	Variables(ctx context.Context, environmentID string) (map[string]string, error)
}

OnePassword holds the 1Password service account token and reads Environments with it. *onepassword.Client implements it.

type OnePasswordStatus added in v0.2.4

type OnePasswordStatus struct {
	// Connected is set while a service account token is saved.
	Connected bool
}

OnePasswordStatus says whether shed can read 1Password Environments.

type Plane

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

Plane carries out operations on shed's state. It is safe for concurrent use.

func New

func New(cfg Config) *Plane

New returns a Plane.

func (*Plane) BackUpService

func (p *Plane) BackUpService(ctx context.Context, serviceID string) (BackupView, error)

BackUpService starts a backup of a service.

func (*Plane) BackUpSystem

func (p *Plane) BackUpSystem(ctx context.Context) (BackupView, error)

BackUpSystem starts a backup of shed.db.

func (*Plane) BackupIdentity

func (p *Plane) BackupIdentity(ctx context.Context) (string, error)

BackupIdentity returns the age identity that decrypts backups.

func (*Plane) BackupSettings

func (p *Plane) BackupSettings(ctx context.Context) (backup.Settings, error)

BackupSettings returns the S3 destination and encryption settings.

func (*Plane) Branches

func (p *Plane) Branches(ctx context.Context, owner, repo string) ([]string, error)

Branches returns the branch names of a repository the GitHub App is installed on.

func (*Plane) BuildLog

func (p *Plane) BuildLog(ctx context.Context, deploymentID string, n int) ([]string, error)

BuildLog returns the last n lines of a deployment's build log, n clamped to 1 through MaxLogLines, with variable values masked.

func (*Plane) CancelDeployment

func (p *Plane) CancelDeployment(ctx context.Context, deploymentID string) (DeploymentView, error)

CancelDeployment cancels a deployment in progress.

func (*Plane) CheckUpdate

func (p *Plane) CheckUpdate(ctx context.Context) (update.Status, error)

CheckUpdate checks GitHub for a newer release now. A failed check is recorded in the status, like a failed background check, rather than returned.

func (*Plane) ClearRestoreFence

func (p *Plane) ClearRestoreFence(ctx context.Context, id string) error

ClearRestoreFence lifts the fence a failed restore left on a service, keeping its data as it is.

func (*Plane) ConnectOnePassword added in v0.2.4

func (p *Plane) ConnectOnePassword(ctx context.Context, token string) (OnePasswordStatus, error)

ConnectOnePassword signs in to 1Password with a service account token and saves it in place of the current one. A token 1Password rejects is invalid and not saved.

func (*Plane) CreateDomain

func (p *Plane) CreateDomain(ctx context.Context, serviceID, host string) (d store.Domain, routesPending bool, err error)

CreateDomain routes a host name to a service. An empty host generates <service>-<project>.<base domain>. The domain is kept even if the proxy cannot be updated now; routesPending then reports that SyncRoutes is retrying.

func (*Plane) CreateProject

func (p *Plane) CreateProject(ctx context.Context, name string) (ProjectView, error)

CreateProject creates an empty project.

func (*Plane) CreateService

func (p *Plane) CreateService(ctx context.Context, projectID string, req NewService) (ServiceView, error)

CreateService creates a service in a project and starts its first deployment. Database kinds get their template's image, port, volume, and variables; repo apps deploy the head of their branch.

func (*Plane) CreateVolume

func (p *Plane) CreateVolume(ctx context.Context, serviceID, mountPath string) (store.Volume, error)

CreateVolume adds a volume to a service, mounted at mountPath from its next deployment.

func (*Plane) DeleteBackup

func (p *Plane) DeleteBackup(ctx context.Context, id string) error

DeleteBackup deletes a backup's archives and record.

func (*Plane) DeleteDomain

func (p *Plane) DeleteDomain(ctx context.Context, id string) (routesPending bool, err error)

DeleteDomain removes a domain. As with CreateDomain, routesPending reports that the proxy is not updated yet.

func (*Plane) DeleteProject

func (p *Plane) DeleteProject(ctx context.Context, id string) error

DeleteProject deletes a project with its services, their containers, volumes, and backups.

func (*Plane) DeleteService

func (p *Plane) DeleteService(ctx context.Context, id string) error

DeleteService deletes a service with its container, volumes, and backups.

func (*Plane) DeleteVolume

func (p *Plane) DeleteVolume(ctx context.Context, id string) error

DeleteVolume deletes a volume and its data.

func (*Plane) Deploy

func (p *Plane) Deploy(ctx context.Context, serviceID string) (DeploymentView, error)

Deploy deploys the head of a service's branch, or its image.

func (*Plane) DeployPush

func (p *Plane) DeployPush(ctx context.Context, serviceID string)

DeployPush deploys a service's pending push and removes it, or keeps it to try again if the service cannot take a deployment now. A push is dropped instead if the service no longer deploys that branch on push, or if a deployment was created since the push arrived, which the push must not supersede.

func (*Plane) Deployment

func (p *Plane) Deployment(ctx context.Context, id string) (DeploymentView, error)

Deployment returns a deployment.

func (*Plane) Deployments

func (p *Plane) Deployments(ctx context.Context, serviceID string, limit int) ([]DeploymentView, error)

Deployments returns up to limit of a service's newest deployments, newest first, with whether each one's image is still on the server. A limit outside 1 to MaxDeployments means MaxDeployments.

func (*Plane) DisconnectOnePassword added in v0.2.4

func (p *Plane) DisconnectOnePassword(ctx context.Context) error

DisconnectOnePassword forgets the saved 1Password token. Services keep their linked Environments, which fail their next deployment until a token is connected again.

func (*Plane) DownloadUpdate

func (p *Plane) DownloadUpdate(ctx context.Context) (update.Status, error)

DownloadUpdate starts downloading the newest release.

func (*Plane) FollowBuildLog

func (p *Plane) FollowBuildLog(ctx context.Context, deploymentID string, line func(string), status func(store.DeploymentStatus)) error

FollowBuildLog replays a deployment's build log and follows it while the deployment is in progress, calling line for every line and status with the current status and each change. It returns nil once the deployment has finished, or the error of ctx if ctx ends first.

func (*Plane) FollowRuntimeLogs

func (p *Plane) FollowRuntimeLogs(ctx context.Context, serviceID string, tail int, w io.Writer) error

FollowRuntimeLogs writes the last tail lines of the output of a service's active container to w, then follows it until ctx ends or the container stops. The values of the variables the container was started with are masked. It returns deploy.ErrNoContainer if the service has no active container.

func (*Plane) FollowShedLog

func (p *Plane) FollowShedLog(ctx context.Context, emit func(line string))

FollowShedLog calls emit with the kept lines of shed's own log, then with each new line until ctx is done. Values are not masked.

func (*Plane) HostMetrics

func (p *Plane) HostMetrics(ctx context.Context, rng string) (metrics.HostSeries, error)

HostMetrics returns the host's resource usage over rng, as for ServiceMetrics.

func (*Plane) InstallUpdate

func (p *Plane) InstallUpdate(ctx context.Context) (update.Status, error)

InstallUpdate swaps in the downloaded release. shed runs it once restarted, which is up to the caller.

func (*Plane) ListProjects

func (p *Plane) ListProjects(ctx context.Context) ([]ProjectSummary, error)

ListProjects returns every project with a summary of its services.

func (*Plane) OnePassword added in v0.2.4

func (p *Plane) OnePassword(ctx context.Context) (OnePasswordStatus, error)

OnePassword returns whether a 1Password service account token is saved.

func (*Plane) OnePasswordVariables added in v0.2.4

func (p *Plane) OnePasswordVariables(ctx context.Context, serviceID string) (map[string]string, error)

OnePasswordVariables returns the variables of the 1Password Environment a service links, or none if it links none.

func (*Plane) OpenBackup

func (p *Plane) OpenBackup(ctx context.Context, id string) (rc io.ReadCloser, fileName string, err error)

OpenBackup opens a backup's archive, decrypted but still compressed, and returns the name it downloads as. The caller closes it.

func (*Plane) Project

func (p *Plane) Project(ctx context.Context, id string) (ProjectView, error)

Project returns a project with its full services.

func (*Plane) ProjectRecord

func (p *Plane) ProjectRecord(ctx context.Context, id string) (store.Project, error)

ProjectRecord returns the stored project, without the lookups of its services that Project makes.

func (*Plane) ReceivePush

func (p *Plane) ReceivePush(ctx context.Context, push store.PendingPush) error

ReceivePush stores push as its service's pending push and tries to deploy it. It returns only the error of storing it: a push that cannot deploy now is kept for ReplayPushes. Storing it under pushMu means the deployment recorded as its predecessor is the one any earlier push or manual deploy created, not one about to be created.

func (*Plane) Redeploy

func (p *Plane) Redeploy(ctx context.Context, deploymentID string) (DeploymentView, error)

Redeploy deploys the image of an earlier deployment again.

func (*Plane) RenameProject

func (p *Plane) RenameProject(ctx context.Context, id, name string) (ProjectView, error)

RenameProject renames a project.

func (*Plane) ReplayPushes

func (p *Plane) ReplayPushes(ctx context.Context)

ReplayPushes deploys pending pushes: right away, which replays those a restart interrupted, and then every few seconds, which deploys those that arrived while their service was held or fenced once it no longer is. It returns when ctx is done. Start it after the deployer has reconciled.

func (*Plane) Repos

func (p *Plane) Repos(ctx context.Context) ([]github.Repo, error)

Repos returns the repositories the GitHub App is installed on.

func (*Plane) ResolvedVariables

func (p *Plane) ResolvedVariables(ctx context.Context, serviceID string) (map[string]string, error)

ResolvedVariables returns the variables of a service's next deployment, injected ones included, with references expanded.

func (*Plane) RestartService

func (p *Plane) RestartService(ctx context.Context, id string) error

RestartService restarts a service's container.

func (*Plane) RestoreBackup

func (p *Plane) RestoreBackup(ctx context.Context, id string) (store.Restore, error)

RestoreBackup starts restoring a backup into its service, or into shed.db.

func (*Plane) RuntimeLogs

func (p *Plane) RuntimeLogs(ctx context.Context, serviceID string, n int) ([]string, error)

RuntimeLogs returns the last n lines of the output of a service's active container, n clamped to 1 through MaxLogLines, with the values of the variables it was started with masked. Each line starts with its RFC 3339 timestamp. It returns deploy.ErrNoContainer if the service has no active container.

func (*Plane) Service

func (p *Plane) Service(ctx context.Context, id string) (ServiceView, error)

Service returns a service with its live status and resources.

func (*Plane) ServiceBackups

func (p *Plane) ServiceBackups(ctx context.Context, serviceID string) (BackupList, error)

ServiceBackups returns a service's backup policy, its newest backups, and its latest restore.

func (*Plane) ServiceMetrics

func (p *Plane) ServiceMetrics(ctx context.Context, serviceID, rng string) (metrics.Series, error)

ServiceMetrics returns a service's resource usage over rng: "1h", "6h", "24h", or "7d", empty meaning "1h".

func (*Plane) ServiceRecord

func (p *Plane) ServiceRecord(ctx context.Context, id string) (store.Service, error)

ServiceRecord returns the stored settings of a service, without the lookups of its live state that Service makes.

func (*Plane) ServicesForPush

func (p *Plane) ServicesForPush(ctx context.Context, repo, branch string) ([]store.Service, error)

ServicesForPush returns the app services that deploy a branch of a repository on push.

func (*Plane) SetAutoDownload

func (p *Plane) SetAutoDownload(ctx context.Context, on bool) (update.Status, error)

SetAutoDownload sets whether new releases are downloaded when found.

func (*Plane) SetBackupSettings

func (p *Plane) SetBackupSettings(ctx context.Context, in backup.SettingsInput) (backup.Settings, error)

SetBackupSettings saves the S3 destination and encryption settings.

func (*Plane) SetServiceBackupPolicy

func (p *Plane) SetServiceBackupPolicy(ctx context.Context, serviceID string, in backup.PolicyInput) (backup.Policy, error)

SetServiceBackupPolicy saves a service's backup policy.

func (*Plane) SetSystemBackupPolicy

func (p *Plane) SetSystemBackupPolicy(ctx context.Context, in backup.PolicyInput) (backup.Policy, error)

SetSystemBackupPolicy saves the backup policy of shed.db.

func (*Plane) SetVariables

func (p *Plane) SetVariables(ctx context.Context, serviceID string, vars map[string]string) (map[string]string, error)

SetVariables replaces a service's own variables and returns them. They apply from its next deployment.

func (*Plane) ShedLog

func (p *Plane) ShedLog(ctx context.Context, n int) ([]string, error)

ShedLog returns the last n lines of shed's own log, n clamped to 1 through MaxLogLines, with the saved values of every service's variables masked.

func (*Plane) StartService

func (p *Plane) StartService(ctx context.Context, id string) error

StartService starts a stopped service.

func (*Plane) StopService

func (p *Plane) StopService(ctx context.Context, id string) error

StopService stops a service's container and keeps it stopped.

func (*Plane) SyncRoutes

func (p *Plane) SyncRoutes(ctx context.Context)

SyncRoutes applies routes again after a domain change failed to, with backoff, until it succeeds. It returns when ctx is done.

func (*Plane) SystemBackups

func (p *Plane) SystemBackups(ctx context.Context) (BackupList, error)

SystemBackups returns the backup policy and newest backups of shed.db.

func (*Plane) TestBackupS3

func (p *Plane) TestBackupS3(ctx context.Context, in backup.S3Input) error

TestBackupS3 checks that an S3 destination can be written, without saving it.

func (*Plane) UpdateService

func (p *Plane) UpdateService(ctx context.Context, id string, patch ServicePatch) (ServiceView, error)

UpdateService saves settings of a service. They apply from its next deployment.

func (*Plane) UpdateStatus

func (p *Plane) UpdateStatus(ctx context.Context) (update.Status, error)

UpdateStatus returns the state of shed's updates.

func (*Plane) VariableNames

func (p *Plane) VariableNames(ctx context.Context, serviceID string) (VariableNames, error)

VariableNames returns the names of the variables a service's next deployment would see: its own, the ones from its 1Password Environment, and the ones shed injects. It never returns values.

func (*Plane) Variables

func (p *Plane) Variables(ctx context.Context, serviceID string) (map[string]string, error)

Variables returns a service's own variables as saved, with references unexpanded.

type ProjectSummary

type ProjectSummary struct {
	store.Project
	Services []ServiceSummary
}

ProjectSummary is a project in a list, with a summary of each service.

type ProjectView

type ProjectView struct {
	store.Project
	Services []ServiceView
}

ProjectView is a project with its full services.

type ServicePatch

type ServicePatch struct {
	Repo            *string
	Branch          *string
	RootDir         *string
	Image           *string
	DockerfilePath  *string
	StartCommand    *string
	Port            *int
	HealthcheckPath *string
	PublicPort      *int
	CPULimit        *float64
	MemoryLimit     *int64
	AutoDeploy      *bool
	WaitForCI       *bool
	// OnePasswordEnvironment is a 1Password Environment ID, or "" to unlink
	// the service's Environment.
	OnePasswordEnvironment *string
}

ServicePatch holds the settings to change; nil fields are kept.

type ServiceSummary

type ServiceSummary struct {
	ID     string
	Name   string
	Kind   string
	Status deploy.ServiceStatus
}

ServiceSummary is the name, kind, and live status of a service.

type ServiceView

type ServiceView struct {
	store.Service
	// Status is derived from the service's deployments and container;
	// offline if it has neither.
	Status  deploy.ServiceStatus
	Domains []store.Domain
	Volumes []store.Volume
	// LatestDeployment is nil if the service has never been deployed.
	LatestDeployment *DeploymentView
	// RestoreFence is set while a failed restore keeps the service from
	// starting.
	RestoreFence *store.RestoreFence
}

ServiceView is a service with its settings, live status, domains, volumes, latest deployment, and restore fence. It holds no variable values.

type Store

type Store interface {
	Projects(ctx context.Context) ([]store.Project, error)
	Project(ctx context.Context, id string) (store.Project, error)
	CreateProject(ctx context.Context, name string) (store.Project, error)
	RenameProject(ctx context.Context, id, name string) error

	Services(ctx context.Context, projectID string) ([]store.Service, error)
	AllServices(ctx context.Context) ([]store.Service, error)
	Service(ctx context.Context, id string) (store.Service, error)
	CreateService(ctx context.Context, sv store.Service) (store.Service, error)
	UpdateService(ctx context.Context, sv store.Service) error
	DeleteService(ctx context.Context, id string) error
	ServicesForPush(ctx context.Context, repo, branch string) ([]store.Service, error)

	Variables(ctx context.Context, serviceID string) (map[string]string, error)
	SetVariables(ctx context.Context, serviceID string, vars map[string]string) error

	Domains(ctx context.Context, serviceID string) ([]store.Domain, error)
	CreateDomain(ctx context.Context, serviceID, host string, generated bool) (store.Domain, error)
	DeleteDomain(ctx context.Context, id string) error
	Volumes(ctx context.Context, serviceID string) ([]store.Volume, error)
	CreateVolume(ctx context.Context, serviceID, mountPath string) (store.Volume, error)

	Deployment(ctx context.Context, id string) (store.Deployment, error)
	Deployments(ctx context.Context, serviceID string, limit int) ([]store.Deployment, error)
	LatestDeployment(ctx context.Context, serviceID string) (store.Deployment, error)

	RestoreFence(ctx context.Context, serviceID string) (store.RestoreFence, error)
	LatestRestore(ctx context.Context, serviceID string) (store.Restore, error)
	Backup(ctx context.Context, id string) (store.Backup, error)

	SetPendingPush(ctx context.Context, p store.PendingPush) (store.PendingPush, error)
	PendingPush(ctx context.Context, serviceID string) (store.PendingPush, error)
	PendingPushes(ctx context.Context) ([]store.PendingPush, error)
	DeletePendingPush(ctx context.Context, serviceID, id string) error
}

Store is the state Plane reads and changes. *store.Store implements it.

type Updates

type Updates interface {
	Status(ctx context.Context) (update.Status, error)
	Check(ctx context.Context) (update.Status, error)
	Download(ctx context.Context) (update.Status, error)
	SetAutoDownload(ctx context.Context, on bool) (update.Status, error)
	Install(ctx context.Context) (update.Status, error)
}

Updates checks for, downloads, and installs new versions of shed. *update.Updater implements it.

type VariableName

type VariableName struct {
	Name string
	// Injected is set for variables shed provides, such as PORT and
	// SHED_PRIVATE_DOMAIN, and clear for the service's own.
	Injected bool
	// OnePassword is set for variables from the service's 1Password
	// Environment that it does not override with its own.
	OnePassword bool
	// Reference is set for own variables whose value refers to other
	// variables with ${{ }}.
	Reference bool
}

VariableName describes one variable of a service without its value.

type VariableNames

type VariableNames struct {
	// Variables are sorted by name. An own variable that overrides an
	// injected one is listed once, as own.
	Variables []VariableName
	// ResolveError says why the variables do not resolve, if they do not.
	// The injected and 1Password names are then missing.
	ResolveError string
}

VariableNames lists the variables a service's next deployment would see.

Jump to

Keyboard shortcuts

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