runtime

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: GPL-3.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelManaged = "cashpilot.managed"
	LabelService = "cashpilot.service"
	LabelVersion = "cashpilot.version"
	LabelRuntime = "cashpilot.runtime"
)
View Source
const LabelCustom = "cashpilot.custom"

LabelCustom is "true" on a container deployed from a service the user added from an image reference (internal/services/custom.go) rather than from the reviewed catalog. The web worker uses the same label.

View Source
const LabelInstance = "cashpilot.instance"

LabelInstance says which copy of a service a container is, when the service runs more than once on this machine. The first copy has no such label and keeps the name it always had (cashpilot-<slug>); copy N is cashpilot-<slug>-N and carries "N". The web worker uses the same label, so either side can read the other's containers.

View Source
const NativeRuntimeKind = "native"

NativeRuntimeKind is the runtime-kind key the NativeProcessProvider registers under in the services manager. A service that declares a native binary for the host is routed onto this runtime; image-only services stay on Docker.

View Source
const OwnImagePrefix = "drumsergio/cashpilot-"

OwnImagePrefix marks the repositories CashPilot builds itself; the catalog pins their tag.

Variables

View Source
var ErrNoStateRuntime = errors.New("this service's runtime cannot export its state")

ErrNoStateRuntime is returned when the service runs somewhere that cannot read container state.

Functions

func AllowedDevice added in v0.20.0

func AllowedDevice(host string) bool

AllowedDevice reports whether a host device is inside the ceiling. The compose export checks against this same list, so a file CashPilot writes can never map a device the app itself would refuse to deploy.

func ArchFamily added in v0.17.8

func ArchFamily(machine string) string

ArchFamily folds a reported architecture onto amd64, arm64 or arm. It returns "" for anything it does not recognise, which callers must read as "cannot say" and never as a family.

func ArchLabel added in v0.17.8

func ArchLabel(family string) string

ArchLabel is how a family reads to a person ("64-bit ARM"). An unknown family is returned unchanged so a message never renders an empty gap.

func CriticalTargets added in v0.17.8

func CriticalTargets(svc catalog.Service) map[string]string

CriticalTargets maps the container paths a catalog entry marks unrecoverable to what is lost if they are destroyed. The result is always non-nil, so a caller can tell "the catalog says none" (empty) from "nobody could say" (nil, which the caller supplies itself when there is no entry at all).

Paths are normalised, because a catalog entry written "/app/identity/" has to match Docker's "/app/identity" or the guard fails open on the only irreversible path there is.

func DeviceHostname added in v0.11.0

func DeviceHostname() string

DeviceHostname returns this machine's hostname for {hostname} expansion, falling back to "desktop" when the OS can't report one. Exported so the app layer can offer the same value as the form default the deploy path will substitute.

func HasBuildFor added in v0.17.8

func HasBuildFor(dc catalog.DockerConfig, machine string) (runs bool, known bool)

HasBuildFor reports whether a catalog entry declares a build that runs on this machine. known is false when the question cannot be answered — an architecture nothing folds, or an entry that declares no platforms and no per-arch override — and callers must read that as "not checked", never as a pass.

An image_by_arch override counts for its whole family: the tag is a separate single-arch image whose registry label lies (that is exactly why it exists), so its variant cannot be read.

func ImageForArch added in v0.17.8

func ImageForArch(dc catalog.DockerConfig, machine string) string

ImageForArch is the image a machine of this architecture should pull.

Docker picks the right build out of a multi-arch manifest by itself, so almost every entry needs only docker.image. image_by_arch exists for the images whose ARM builds Docker CANNOT select: traffmonetizer/cli_v2 publishes separate arm64v8 and arm32v7 tags and labels every one of them linux/amd64, so a machine on a Raspberry Pi pulling the default tag gets an x86-64 binary that cannot start. An unknown architecture, or a family the entry does not name, falls back to docker.image.

func NewDockerClient added in v0.34.0

func NewDockerClient() (*client.Client, error)

dockerClient builds a Docker API client. With no host argument (or an empty one) it reads the connection from the environment via client.FromEnv — the default Docker context / DOCKER_HOST — exactly as before. A non-empty host is a seam for a future bundled-runtime provider that must talk to a specific socket/endpoint instead of the ambient context; no current caller passes one, so today's behavior is unchanged.

There is no WithAPIVersionNegotiation option any more: the moby client negotiates the API version by default, lazily on the first versioned request, so the old explicit option is a deprecated no-op. NewDockerClient is a client for the same daemon every other call here uses.

func RunsOn added in v0.17.8

func RunsOn(build, target ArchTarget) bool

RunsOn reports whether a build of this platform runs on that machine. Families must match exactly; within 32-bit ARM a lower-or-equal variant runs (a v7 board runs a v6 build, a v6 board does not run a v7 build).

func ShapeDrift added in v0.30.0

func ShapeDrift(svc catalog.Service, shape ContainerShape, customImage string) []string

ShapeDrift is each way shape differs from what a redeploy would build from svc today. customImage is the image the user chose for this service, if any. An empty list means the container matches.

func ShapeFingerprint added in v0.30.0

func ShapeFingerprint(svc catalog.Service) string

ShapeFingerprint is a short hash of what the catalog says about the fields ShapeDrift judges. An Ignore is tied to it, so a later catalog fix to any of them shows again, while an edit to a service's notes or description does not.

func StopTimeoutSeconds added in v0.17.8

func StopTimeoutSeconds(svc catalog.Service) int

StopTimeoutSeconds is the grace period a service's own catalog entry asks for. Zero or negative means the entry is silent, and the shared default applies.

Types

type ArchTarget added in v0.17.8

type ArchTarget struct {
	Family  string
	Variant int
}

ArchTarget is one architecture, with the ARM variant kept because 32-bit ARM compatibility is directional. Variant is 0 (and meaningless) for amd64 and arm64.

func MachineTarget added in v0.17.8

func MachineTarget(machine string) (ArchTarget, bool)

MachineTarget is what a machine can run, in the same shape PlatformTarget gives builds: "armv6l" -> {arm 6}, "armhf" -> {arm 7}, "aarch64" -> {arm64}. ok is false when the architecture is not one of the three families.

func PlatformTarget added in v0.17.8

func PlatformTarget(platform string) (ArchTarget, bool)

PlatformTarget parses a catalog platform string: "linux/amd64" -> {amd64}, "linux/arm64/v8" -> {arm64}, "linux/arm/v6" -> {arm 6}, bare "linux/arm" -> {arm 7}. ok is false for a non-linux platform or a family nothing folds ("linux/386").

type ContainerInfo

type ContainerInfo struct {
	Slug        string  `json:"slug"`
	ContainerID string  `json:"containerId"`
	Name        string  `json:"name"`
	Image       string  `json:"image"`
	Status      string  `json:"status"`
	CPUPercent  float64 `json:"cpuPercent"`
	MemoryMB    float64 `json:"memoryMb"`
	// Instance is which copy of its service this unit is: 1 for the first (and for
	// every unit of a runtime that has no copies), N for cashpilot-<slug>-N.
	Instance int `json:"instance"`
	// What the usage graphs (internal/usage) need beyond the two numbers above.
	// CPUKnown and MemoryKnown say whether each was actually read: a failed stats
	// read leaves 0 in the field, and 0 is not a reading. NetRxBytes and NetTxBytes
	// are the cumulative network counters since the container started, nil when
	// none exist (host networking, a native program): unknown, never 0.
	CPUKnown    bool    `json:"-"`
	MemoryKnown bool    `json:"-"`
	NetRxBytes  *uint64 `json:"-"`
	NetTxBytes  *uint64 `json:"-"`
}

type ContainerShape added in v0.30.0

type ContainerShape struct {
	Slug     string
	Instance int
	// Arch is the daemon's architecture, which picks the catalog's per-arch image.
	Arch        string
	Image       string
	CapAdd      []string
	CapDrop     []string
	Privileged  bool
	NetworkMode string
	Devices     []string
	Ports       []string
	Mounts      []string
	EnvKeys     []string
	Entrypoint  []string
}

ContainerShape is what a managed container was created with, on the settings that decide whether it works. Names only, never values: env keys without their values, mount targets without their sources, and no command at all (it carries credentials).

type CopyProvider added in v0.23.0

type CopyProvider interface {
	// Copies lists the copy numbers above 1 that exist for slug, in order.
	Copies(ctx context.Context, slug string) ([]int, error)
	StopCopy(ctx context.Context, slug string, n, stopTimeoutSeconds int) error
	StartCopy(ctx context.Context, slug string, n int) error
	LogsCopy(ctx context.Context, slug string, n, lines int) (string, error)
	// RemoveCopy removes copy n and nothing else. Copies only exist for services
	// with no volumes, so there is no data to keep or delete.
	RemoveCopy(ctx context.Context, slug string, n, stopTimeoutSeconds int) error
}

CopyProvider is a runtime that can run copies 2..N of a service next to the first. Only Docker has them: a copy is another container from the same image, and the native runtime runs one process per service. The first copy is still driven through Provider, exactly as before, so a single-copy service never touches this.

type DataMount added in v0.17.8

type DataMount struct {
	// Target is the path inside the container.
	Target string `json:"target"`
	// Source is the named volume, or the host folder for a bind mount.
	Source string `json:"source"`
	// Volume is true for a named Docker volume — the only kind Remove can delete.
	// A bind mount is a folder the user owns and is always left alone.
	Volume bool `json:"volume"`
	// Critical marks data that cannot be recovered if it is destroyed.
	Critical bool `json:"critical"`
	// Holds is what is lost, in plain words, for the confirmation the user reads.
	Holds string `json:"holds"`
}

DataMount is one place a deployed service keeps data on this machine.

type DeploySpec

type DeploySpec struct {
	Slug    string
	Service catalog.Service
	Env     map[string]string
	// Instance is which copy of the service this is. 0 and 1 both mean the first,
	// which keeps the name and labels it always had; see LabelInstance.
	Instance int
}

type DockerProvider

type DockerProvider struct{}

func NewDockerProvider

func NewDockerProvider() *DockerProvider

func (*DockerProvider) ContainerShapes added in v0.30.0

func (p *DockerProvider) ContainerShapes(ctx context.Context) ([]ContainerShape, error)

ContainerShapes reads the shape of every container this app made.

func (*DockerProvider) Copies added in v0.23.0

func (p *DockerProvider) Copies(ctx context.Context, slug string) ([]int, error)

func (*DockerProvider) Deploy

func (p *DockerProvider) Deploy(ctx context.Context, spec DeploySpec, progress func(string)) (ContainerInfo, error)

func (*DockerProvider) ExecRunning added in v0.29.0

func (p *DockerProvider) ExecRunning(ctx context.Context, slug string, cmd []string, timeout time.Duration) ([]noderead.Output, error)

ExecRunning runs cmd in every running container CashPilot manages for slug, each under its own timeout, and returns what each printed (stdout and stderr together, as the web worker's exec_run does). It is how the collector reads a node's own earnings (internal/noderead); the command always comes from the catalog.

func (*DockerProvider) LastRunLogs added in v0.28.1

func (p *DockerProvider) LastRunLogs(ctx context.Context, slug string, lines int) (string, error)

LastRunLogs returns the log of the service's last finished run only, for judging whether the provider refused it (internal/health). It ports the web worker's _fatal_entry:

  • restarting, exited or dead: the log since the last start, so an earlier run's refusal is not judged as this one's;
  • running for under refusedRunProvenAfter: the log before this start, that is the run before;
  • running longer, or never finished a run: "" (nothing to judge).

func (*DockerProvider) List

func (p *DockerProvider) List(ctx context.Context) ([]ContainerInfo, error)

func (*DockerProvider) Logs

func (p *DockerProvider) Logs(ctx context.Context, slug string, lines int) (string, error)

func (*DockerProvider) LogsCopy added in v0.23.0

func (p *DockerProvider) LogsCopy(ctx context.Context, slug string, n, lines int) (string, error)

func (*DockerProvider) LogsMatching added in v0.25.3

func (p *DockerProvider) LogsMatching(ctx context.Context, slug string, since time.Duration, match *regexp.Regexp, lines int) (string, error)

LogsMatching returns the newest `lines` log lines of the last `since` that match `match`. The window is streamed and filtered here, so megabytes of a chatty service's logs are never held at once.

func (*DockerProvider) PlanRemoval added in v0.17.8

func (p *DockerProvider) PlanRemoval(ctx context.Context, slug string, critical map[string]string) (RemovalPlan, error)

PlanRemoval reports what removing this service would delete.

func (*DockerProvider) ReadState added in v0.31.0

func (p *DockerProvider) ReadState(ctx context.Context, slug string, targets []string, limit int64) ([]byte, []string, error)

func (*DockerProvider) Remove

func (p *DockerProvider) Remove(ctx context.Context, slug string, opts RemoveOptions) error

Remove removes the service's container. The data it kept survives unless opts asks for it to go, and the volumes the catalog marks unrecoverable need the separate yes in opts.AllowCritical on top of that — see RemoveOptions.

func (*DockerProvider) RemoveCopy added in v0.23.0

func (p *DockerProvider) RemoveCopy(ctx context.Context, slug string, n, stopTimeoutSeconds int) error

func (*DockerProvider) ResolveImage added in v0.17.8

func (p *DockerProvider) ResolveImage(ctx context.Context, svc catalog.Service) string

ResolveImage reports the image a deploy of svc would pull right now, resolved against the daemon's architecture exactly as Deploy resolves it.

An entry with no per-architecture override needs no daemon at all, which is nearly every entry, so this costs a round trip only where the answer can actually differ. A daemon that cannot be reached yields the catalog's default rather than an error: this only labels a history entry, and it must never be the reason a deploy fails.

func (*DockerProvider) Restart

func (p *DockerProvider) Restart(ctx context.Context, slug string, stopTimeoutSeconds int) error

func (*DockerProvider) Start added in v0.6.0

func (p *DockerProvider) Start(ctx context.Context, slug string) error

func (*DockerProvider) StartCopy added in v0.23.0

func (p *DockerProvider) StartCopy(ctx context.Context, slug string, n int) error

func (*DockerProvider) StateFingerprint added in v0.31.0

func (p *DockerProvider) StateFingerprint(ctx context.Context, slug string, targets []string) (string, error)

func (*DockerProvider) Status

func (p *DockerProvider) Status(ctx context.Context) Status

func (*DockerProvider) Stop

func (p *DockerProvider) Stop(ctx context.Context, slug string, stopTimeoutSeconds int) error

func (*DockerProvider) StopCopy added in v0.23.0

func (p *DockerProvider) StopCopy(ctx context.Context, slug string, n, stopTimeoutSeconds int) error

type ImageResolver added in v0.17.8

type ImageResolver interface {
	ResolveImage(ctx context.Context, svc catalog.Service) string
}

ImageResolver is a provider that can say, before a deploy runs, which image it would actually pull on this machine. It is optional: a provider that does not implement it simply has the catalog's default image recorded, which is what every provider did before this existed.

It exists because the answer depends on the DAEMON's architecture, which only the provider can ask for, while the caller that records the deploy history holds the catalog. Returning "" means "cannot say", and the caller keeps its own answer.

type InstallGuide

type InstallGuide struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Platforms   []string `json:"platforms"`
	URL         string   `json:"url"`
	Commands    []string `json:"commands"`
	Notes       []string `json:"notes"`
}

func InstallGuides

func InstallGuides() []InstallGuide

func (InstallGuide) Supports added in v0.4.4

func (g InstallGuide) Supports(osName string) bool

type KeptMount added in v0.17.8

type KeptMount struct {
	// Target is the path inside the container.
	Target string
	// Kept is where the data actually lives and stays.
	Kept string
	// Requested is where the catalog entry would have put it.
	Requested string
}

KeptMount records one mount a redeploy kept where it already was, so the deploy can say so out loud instead of moving data silently.

type ManagedRuntimePlan

type ManagedRuntimePlan struct {
	Summary   string   `json:"summary"`
	Phases    []string `json:"phases"`
	Risks     []string `json:"risks"`
	Providers []string `json:"providers"`
}

func ManagedRuntimeRoadmap

func ManagedRuntimeRoadmap() ManagedRuntimePlan

type NativeProcessProvider added in v0.10.0

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

NativeProcessProvider runs catalog services as supervised native child processes, with no container runtime. It downloads each service's SHA-256-pinned binary over HTTPS, verifies it (fail-closed on mismatch or a missing/invalid checksum), extracts it under <appDir>/native/<slug>/, and launches it with an argv built from the service's native.command via the same shell-safe tokenizeCommand/substitute path Docker uses. stdout+stderr are captured to a bounded rotating log; a supervisor goroutine restarts a crashed process with bounded backoff (the native equivalent of Docker's restart policy). A JSON registry at <appDir>/native/state.json records each managed process (pid, binary, args, source url/sha, startedAt, desired state) so List/Start/Stop/Remove survive an app restart.

It implements runtime.Provider. ContainerInfo fields are repurposed for a process: ContainerID is the pid, Image is the source binary URL, Status is running/stopped, and CPU/memory come from gopsutil best-effort.

func NewNativeProcessProvider added in v0.10.0

func NewNativeProcessProvider(appDir string) *NativeProcessProvider

NewNativeProcessProvider builds a provider rooted at <appDir>/native with production defaults.

func (*NativeProcessProvider) Deploy added in v0.10.0

func (p *NativeProcessProvider) Deploy(ctx context.Context, spec DeploySpec, progress func(string)) (ContainerInfo, error)

Deploy downloads+verifies+extracts the service's native binary for this host and launches it as a supervised process. It mirrors DockerProvider.Deploy's shape (progress callbacks, redeploy replaces a prior instance) but targets a native process instead of a container.

func (*NativeProcessProvider) List added in v0.10.0

List reports every registry entry as a ContainerInfo, checking each recorded pid's liveness (and best-effort CPU/memory) via gopsutil. A process that isn't reachable reports zeros and status "stopped"; it never panics on a dead/reused pid.

Alive entries are sampled CONCURRENTLY (mirroring DockerProvider.statsForContainers): each goroutine owns its own out[i] slot, so no locking/shared map is needed, and a buffered semaphore bounds how many statFn calls run at once. A serial loop would make this O(N * cpuStatInterval); with the fan-out the added latency stays ~one interval regardless of N. Stopped entries are written synchronously (no sampling needed), and the result stays sorted by slug just like the previous serial loop.

func (*NativeProcessProvider) Logs added in v0.10.0

func (p *NativeProcessProvider) Logs(ctx context.Context, slug string, lines int) (string, error)

Logs returns the tail of the service's captured stdout+stderr, reading the rotated previous generation then the current one, bounded so a huge log cannot be loaded in full. An absent log yields an empty string (not an error).

func (*NativeProcessProvider) PlanRemoval added in v0.17.8

func (p *NativeProcessProvider) PlanRemoval(ctx context.Context, slug string, critical map[string]string) (RemovalPlan, error)

PlanRemoval reports what removing a native service would delete. A native service keeps only its downloaded binary and its logs in the per-slug directory, both of which are re-created on the next deploy, so there is nothing here that a user could lose: the plan is empty and Remove has nothing to ask about.

func (*NativeProcessProvider) Remove added in v0.10.0

func (p *NativeProcessProvider) Remove(ctx context.Context, slug string, opts RemoveOptions) error

Remove stops the service, deletes its per-slug directory (binary + logs), and drops its registry entry — the native analogue of removing a container. Only opts.StopTimeout is read: the directory holds nothing but the binary and the logs, which the next deploy re-creates, so there is no stored data to decide about.

func (*NativeProcessProvider) Restart added in v0.10.0

func (p *NativeProcessProvider) Restart(ctx context.Context, slug string, stopTimeoutSeconds int) error

Restart stops then starts the service.

func (*NativeProcessProvider) SetEventRecorder added in v0.10.0

func (p *NativeProcessProvider) SetEventRecorder(fn func(slug, event, detail string))

SetEventRecorder wires a lifecycle-event sink (typically store.RecordEvent) so the supervisor's autonomous crashes and respawns are recorded into the same event stream HealthScores aggregates. Call once at wiring time, before the first Deploy — it is read (without locking) only from supervise goroutines, which are created later by Deploy.

func (*NativeProcessProvider) Start added in v0.10.0

func (p *NativeProcessProvider) Start(ctx context.Context, slug string) error

Start (re)launches a previously-deployed service from the registry. It is a no-op if the service is already running (as our child or as a live orphan pid).

func (*NativeProcessProvider) Status added in v0.10.0

Status reports the native runtime as always available: unlike Docker it has no external dependency (no daemon/socket), so it can always run a native process.

func (*NativeProcessProvider) Stop added in v0.10.0

func (p *NativeProcessProvider) Stop(ctx context.Context, slug string, stopTimeoutSeconds int) error

Stop stops the service: a managed child is signalled gracefully then killed after the grace period; an orphan pid recorded by a previous session is signalled by pid. It marks the registry entry as desired=stopped so List reports it stopped.

type Provider

type Provider interface {
	Status(ctx context.Context) Status
	Deploy(ctx context.Context, spec DeploySpec, progress func(string)) (ContainerInfo, error)
	Start(ctx context.Context, slug string) error
	// Stop and Restart take the grace period the service's catalog entry asks for,
	// in seconds. 0 means the caller had no entry to read (a service the catalog has
	// dropped), and the provider falls back to what the running unit itself says.
	// The value has to be passed in because only the caller holds the catalog, and
	// reading it off the container instead would pin every service already deployed
	// to the number its entry carried on the day it was created.
	Stop(ctx context.Context, slug string, stopTimeoutSeconds int) error
	Restart(ctx context.Context, slug string, stopTimeoutSeconds int) error
	// Remove removes the running unit. It destroys stored data only when
	// RemoveOptions says so; see RemoveOptions for why the default is to keep it.
	Remove(ctx context.Context, slug string, opts RemoveOptions) error
	// PlanRemoval reports what removing this service would delete, so the question
	// put to the user names the actual data. critical maps container paths the
	// catalog marks unrecoverable to what is lost; nil means no catalog entry could
	// be consulted, which counts as "assume all of it matters".
	PlanRemoval(ctx context.Context, slug string, critical map[string]string) (RemovalPlan, error)
	Logs(ctx context.Context, slug string, lines int) (string, error)
	List(ctx context.Context) ([]ContainerInfo, error)
}

type RemovalPlan added in v0.17.8

type RemovalPlan struct {
	Slug string `json:"slug"`
	// Name is the container that will be removed.
	Name string `json:"name"`
	// Volumes are the named volumes that "delete the data too" would destroy.
	Volumes []DataMount `json:"volumes"`
	// Binds are host folders the service uses. They are never deleted; they are
	// reported so the user can see their data survives.
	Binds []DataMount `json:"binds"`
	// CatalogKnown is false when this service is no longer in the catalog, so nothing
	// could be checked for criticality and every volume is treated as irreplaceable.
	CatalogKnown bool `json:"catalogKnown"`
}

RemovalPlan is what removing a service would do, so the question put to the user can name the actual data rather than "and its Docker volumes".

func (RemovalPlan) HasCritical added in v0.17.8

func (p RemovalPlan) HasCritical() bool

HasCritical reports whether deleting the data would destroy something unrecoverable.

type RemoveOptions added in v0.17.8

type RemoveOptions struct {
	// DeleteData also deletes the named volumes the container mounts. Default false:
	// the container goes, the data stays, and deploying the service again picks it
	// back up. Host folders (bind mounts) are never touched either way.
	DeleteData bool

	// Critical maps container paths whose contents cannot be recovered to a plain
	// sentence saying what is lost. A nil map means nobody could say — no catalog
	// entry for this service — and is treated as "assume every volume is critical",
	// because an unknown must never quietly unlock an irreversible delete. An empty
	// non-nil map means the catalog was read and declared none.
	Critical map[string]string

	// AllowCritical is the separate, explicit yes to destroying the volumes named in
	// Critical. Without it a delete that would touch one is refused and names it, so
	// the dangerous act cannot happen as a side effect of the ordinary one.
	AllowCritical bool

	// StopTimeout is the grace period, in seconds, the service's catalog entry asks
	// for. Remove stops the container before deleting it, and data that is being kept
	// has to be left consistent, so a storage node that asks for 300 seconds gets
	// them here too. 0 means the caller had no entry to read, and the runtime falls
	// back to what the container itself says.
	StopTimeout int
}

RemoveOptions is how far a Remove is allowed to go.

type StateProvider added in v0.31.0

type StateProvider interface {
	// StateFingerprint is statebackup.Fingerprint for the service's container.
	StateFingerprint(ctx context.Context, slug string, targets []string) (string, error)
	// ReadState returns Docker's archive of each target, one after another, and the
	// targets read. The container is paused while it reads.
	ReadState(ctx context.Context, slug string, targets []string, limit int64) ([]byte, []string, error)
}

StateProvider is a runtime that can fingerprint and read a service's irreplaceable state. Only Docker can: the native runtime keeps no volumes the catalog marks critical.

type Status

type Status struct {
	Available bool `json:"available"`
	// NativeAvailable reports whether the always-on native process runtime is
	// registered (and therefore available: it has no external dependency, no daemon
	// or socket to reach). It is an ADDITIVE signal set by the app layer from the
	// services manager — Available keeps its Docker-only meaning, which other code
	// still reads — so onboarding can proceed on Docker OR native.
	NativeAvailable bool              `json:"nativeAvailable"`
	Kind            string            `json:"kind"`
	Message         string            `json:"message"`
	Version         string            `json:"version"`
	Context         string            `json:"context"`
	Tools           map[string]string `json:"tools"`
}

Jump to

Keyboard shortcuts

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