namestore

package
v2.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package namestore provides a simple store for containers to exclusively acquire and release names. All methods are safe to use concurrently. Note that locking of the store is done at the namespace level. The namestore is currently used by container create, remove, rename, and as part of the ocihook events cycle.

Index

Constants

This section is empty.

Variables

View Source
var ErrNameStore = errors.New("name-store error")

ErrNameStore will wrap all errors here

Functions

This section is empty.

Types

type NameStore

type NameStore interface {
	// Acquire exclusively grants `name` to container with `id`.
	Acquire(name, id string) error
	// Acquire allows the container owning a specific name to release it
	Release(name, id string) error
	// Rename allows the container owning a specific name to change it to newName (if available)
	Rename(oldName, id, newName string) error
}

NameStore allows acquiring, releasing and renaming. "names" must abide by identifiers.ValidateDockerCompat A container cannot release or rename a name it does not own. A container cannot acquire a name that is already owned by another container. Re-acquiring a name does not error and is a no-op. Double releasing a name will error. Note that technically a given container may acquire multiple different names, although this is not something we do in the codebase.

func New

func New(stateDir, namespace string) (NameStore, error)

New will return a NameStore for a given namespace.

Jump to

Keyboard shortcuts

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