volume

package
v0.50.0 Latest Latest
Warning

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

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

Documentation

Overview

Package volume manages persistent virtio-blk disk volumes for unikernel VMs. A volume is a raw disk image file in the volume root directory, identified by a human-readable name. Volumes survive VM restarts; they are only deleted when the user explicitly runs "jerboa volume rm".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSize

func ParseSize(s string) (int64, error)

ParseSize parses a human size string ("512M", "1G", "2048K") into bytes. Supported suffixes: K (kibibytes), M (mebibytes), G (gibibytes). A bare integer is interpreted as bytes. Unknown suffixes are an error.

Types

type Store

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

Store manages volumes on disk.

func NewStore

func NewStore(dir string) (*Store, error)

NewStore returns a Store rooted at dir, creating it if needed.

func (*Store) Create

func (s *Store) Create(name string, sizeBytes int64) (*Volume, error)

Create allocates a new volume named name with the given size in bytes. If sizeBytes is 0 the default (1 GiB) is used.

func (*Store) Get

func (s *Store) Get(name string) (*Volume, error)

Get returns the volume with the given name.

func (*Store) List

func (s *Store) List() ([]*Volume, error)

List returns all volumes in the store.

func (*Store) Remove

func (s *Store) Remove(name string) error

Remove deletes the volume and its disk image.

type Volume

type Volume struct {
	// ID is the volume name (unique within the store).
	ID string `json:"id"`
	// DiskPath is the absolute path to the raw disk image file.
	DiskPath string `json:"disk_path"`
	// SizeBytes is the allocated size of the disk image.
	SizeBytes int64 `json:"size_bytes"`
	// CreatedAt is when the volume was created.
	CreatedAt time.Time `json:"created_at"`
}

Volume is a named persistent disk image.

Jump to

Keyboard shortcuts

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