volume

package
v0.2509.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LabelAutoGenerated is the name of the label used to tag autogenerated volumes with.
	LabelAutoGenerated = "net.oasis.volume.auto_generated"

	// LabelRuntimeID is the name of the label used to store the runtime ID.
	LabelRuntimeID = "net.oasis.volume.runtime_id"

	// LabelComponentID is the name of the label used to store the component ID.
	LabelComponentID = "net.oasis.volume.component_id"

	// LabelName is the name of the label used to store the volume name.
	LabelName = "net.oasis.volume.name"
)
View Source
const VolumesDir = "volumes"

VolumesDir is the name of the directory located inside the node's runtimes directory which contains the persistent volumes.

Variables

This section is empty.

Functions

func GetVolumesDir

func GetVolumesDir(dataDir string) string

GetVolumesDir derives the path to the volumes directory.

Types

type Descriptor

type Descriptor struct {
	// ID is the unique volume identifier.
	ID string `json:"id"`
	// Labels are the labels assigned to the volume.
	Labels map[string]string `json:"labels"`
}

Descriptor is a serializable volume descriptor.

type Manager

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

Manager is a volume manager.

func NewManager

func NewManager(dataDir string) (*Manager, error)

NewManager creates a new volume manager.

func (*Manager) Create

func (m *Manager) Create(labels map[string]string) (*Volume, error)

Create creates and registers a new volume.

func (*Manager) Get

func (m *Manager) Get(id string) (*Volume, bool)

Get retrieves the volume with the specified identifier.

If the volume cannot be found, it returns nil

func (*Manager) GetOrCreate

func (m *Manager) GetOrCreate(labels map[string]string) (*Volume, error)

GetOrCreate retrieves the first volume matching given labels or creates a new one.

func (*Manager) Remove

func (m *Manager) Remove(labels map[string]string) error

Remove removes all volumes with all of the given labels set.

func (*Manager) Start

func (m *Manager) Start()

Start starts the volume manager.

func (*Manager) Stop

func (m *Manager) Stop()

Stop halts the volume manager.

func (*Manager) Volumes

func (m *Manager) Volumes(labels map[string]string) []*Volume

Volumes returns all volumes with all of the given labels set.

type Volume

type Volume struct {
	// ID is the unique volume identifier.
	ID string
	// Path is the absolute path to the volume file.
	Path string
	// Labels are the labels assigned to the volume.
	Labels map[string]string
}

Volume is a persistent volume.

func (*Volume) HasLabels

func (v *Volume) HasLabels(labels map[string]string) bool

HasLabels returns true iff the volume has all of the given labels set.

Jump to

Keyboard shortcuts

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