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

volume

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package volume keeps the records of a stack's installations in a volume of its target, where whoever reaches the target finds them: the CI that deployed the stack, and anyone who imported its manifest.

The volume is reached through a container that never starts, of an empty image nemo makes on the target: Docker's archive API copies the records in and out of it, over the connection to the target, with nothing running. Opened, the store copies the volume into a local directory, which the file store serves; each write goes back to the volume.

The volume is local to the Docker nemo reaches, unless the target has a volume type records: on a swarm of several managers, a storage they all mount keeps the same records whichever one nemo reaches.

One nemo writes a stack at a time: it holds the stack with a Swarm config named after it on a swarm manager, whose name the whole swarm keeps unique, else with a container named after it, unique on its Docker.

Index

Constants

View Source
const (
	// Label names the stack whose records a volume or a container holds.
	// It is not the stack's own label, which uninstalling a stack selects.
	Label = "io.nemo.records"
	// Image is the empty image of the containers that reach the volumes.
	Image = "nemo-records:1"
	// Type is the volume type of the target that makes the records'
	// volume, whose {{.Name}} is nemo-records.
	Type = "records"
)

Variables

View Source
var ErrBusy = errors.New("busy")

ErrBusy is returned when another nemo holds the stack for writing.

Functions

func Name

func Name(stack string) string

Name is the name of the volume, and of the config or the container that holds the stack.

Types

type Store

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

Store is the store of one stack, from Open to Close.

func Open

func Open(ctx context.Context, api client.APIClient, stack string, volumes map[string]target.VolumeType, held bool) (_ *Store, err error)

Open copies the records of the stack from its volume, which it creates the first time, of the volumes' records type when they have one. Held, it is the stack's only writer until Close: another Open held fails with ErrBusy; and it moves to a volume of that type the records of a volume that is not of it.

func (*Store) Close

func (store *Store) Close(ctx context.Context) error

Close removes the container, frees the stack, and removes the local copy.

func (*Store) GetInstallation

func (store *Store) GetInstallation(ctx context.Context, stack, name string) (storage.Installation, error)

func (*Store) GetOutputs

func (store *Store) GetOutputs(ctx context.Context, stack, name, resultID string) (map[string]string, error)

func (*Store) GetRun

func (store *Store) GetRun(ctx context.Context, stack, name, id string) (cnab.Claim, error)

func (*Store) ListInstallations

func (store *Store) ListInstallations(ctx context.Context, stack string) ([]storage.Installation, error)

func (*Store) ListResults

func (store *Store) ListResults(ctx context.Context, stack, name string) ([]cnab.Result, error)

func (*Store) ListRuns

func (store *Store) ListRuns(ctx context.Context, stack, name string) ([]cnab.Claim, error)

func (*Store) Owner

func (store *Store) Owner() string

Owner is who manages the stack: empty for nemo, else the tool that set it.

func (*Store) SaveInstallation

func (store *Store) SaveInstallation(ctx context.Context, installation storage.Installation) error

func (*Store) SaveResult

func (store *Store) SaveResult(ctx context.Context, stack, name string, result cnab.Result, outputs map[string]string) error

func (*Store) SaveRun

func (store *Store) SaveRun(ctx context.Context, stack, name string, run cnab.Claim) error

func (*Store) SetOwner

func (store *Store) SetOwner(ctx context.Context, owner string) error

SetOwner records who manages the stack.

Jump to

Keyboard shortcuts

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