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
- Variables
- func Name(stack string) string
- type Store
- func (store *Store) Close(ctx context.Context) error
- func (store *Store) GetInstallation(ctx context.Context, stack, name string) (storage.Installation, error)
- func (store *Store) GetOutputs(ctx context.Context, stack, name, resultID string) (map[string]string, error)
- func (store *Store) GetRun(ctx context.Context, stack, name, id string) (cnab.Claim, error)
- func (store *Store) ListInstallations(ctx context.Context, stack string) ([]storage.Installation, error)
- func (store *Store) ListResults(ctx context.Context, stack, name string) ([]cnab.Result, error)
- func (store *Store) ListRuns(ctx context.Context, stack, name string) ([]cnab.Claim, error)
- func (store *Store) Owner() string
- func (store *Store) SaveInstallation(ctx context.Context, installation storage.Installation) error
- func (store *Store) SaveResult(ctx context.Context, stack, name string, result cnab.Result, ...) error
- func (store *Store) SaveRun(ctx context.Context, stack, name string, run cnab.Claim) error
- func (store *Store) SetOwner(ctx context.Context, owner string) error
Constants ¶
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 ¶
var ErrBusy = errors.New("busy")
ErrBusy is returned when another nemo holds the stack for writing.
Functions ¶
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.