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

volume

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: BSD-3-Clause Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupEntry

type BackupEntry struct {
	ID         string `json:"id" doc:"Unique identifier of the backup"`
	VolumeName string `json:"volumeName" doc:"Name of the volume"`
	Size       int64  `json:"size" doc:"Size of the backup archive in bytes"`
	CreatedAt  string `json:"createdAt" doc:"When the backup was created"`
}

type Create

type Create struct {
	// Name of the volume.
	//
	// Required: true
	Name string `json:"name" minLength:"1" doc:"Name of the volume"`

	// Driver is the volume driver to use.
	//
	// Required: false
	Driver string `json:"driver,omitempty" doc:"Volume driver (e.g., local, nfs)"`

	// DriverOpts contains driver-specific options.
	//
	// Required: false
	DriverOpts map[string]string `json:"driverOpts,omitempty" doc:"Driver-specific options"`

	// Labels contains user-defined metadata for the volume.
	//
	// Required: false
	Labels map[string]string `json:"labels,omitempty" doc:"User-defined labels"`
}

Create is used to create a new volume.

type FileEntry

type FileEntry struct {
	Name        string    `json:"name" doc:"Name of the file or directory"`
	Path        string    `json:"path" doc:"Full path to the file"`
	IsDirectory bool      `json:"isDirectory" doc:"Whether this entry is a directory"`
	Size        int64     `json:"size" doc:"Size of the file in bytes"`
	ModTime     time.Time `json:"modTime" doc:"Last modification time"`
	Mode        string    `json:"mode" doc:"File mode/permissions"`
	IsSymlink   bool      `json:"isSymlink" doc:"Whether this entry is a symbolic link"`
	LinkTarget  string    `json:"linkTarget,omitempty" doc:"Target of the symbolic link"`
}

type FileMetadata

type FileMetadata struct {
	FileEntry
	MimeType string `json:"mimeType" doc:"MIME type of the file"`
	IsText   bool   `json:"isText" doc:"Whether the file is a text file"`
	IsBinary bool   `json:"isBinary" doc:"Whether the file is a binary file"`
}

type PruneReport

type PruneReport struct {
	// VolumesDeleted is a list of volume names that were deleted.
	//
	// Required: true
	VolumesDeleted []string `json:"volumesDeleted"`

	// SpaceReclaimed is the amount of space reclaimed in bytes.
	//
	// Required: true
	SpaceReclaimed uint64 `json:"spaceReclaimed"`
}

PruneReport is the result of a volume prune operation.

type UsageCounts

type UsageCounts struct {
	// Inuse is the number of volumes currently in use.
	//
	// Required: true
	Inuse int `json:"inuse"`

	// Unused is the number of volumes not in use.
	//
	// Required: true
	Unused int `json:"unused"`

	// Total is the total number of volumes.
	//
	// Required: true
	Total int `json:"total"`
}

UsageCounts contains counts of volumes by usage status.

type Volume

type Volume struct {
	// ID is the unique identifier of the volume.
	//
	// Required: true
	ID string `json:"id"`

	// Name of the volume.
	//
	// Required: true
	Name string `json:"name"`

	// Driver is the volume driver used.
	//
	// Required: true
	Driver string `json:"driver"`

	// Mountpoint is the path where the volume is mounted.
	//
	// Required: true
	Mountpoint string `json:"mountpoint"`

	// Scope of the volume (local, global, etc).
	//
	// Required: true
	Scope string `json:"scope"`

	// Options contains driver-specific options.
	//
	// Required: true
	Options map[string]string `json:"options"`

	// Labels contains user-defined metadata for the volume.
	//
	// Required: true
	Labels map[string]string `json:"labels"`

	// CreatedAt is the time when the volume was created.
	//
	// Required: true
	CreatedAt string `json:"createdAt"`

	// InUse indicates if the volume is currently in use by a container.
	//
	// Required: true
	InUse bool `json:"inUse"`

	// UsageData contains size and reference count information.
	//
	// Required: false
	UsageData *volume.UsageData `json:"usageData,omitempty"`

	// Size is the size of the volume in bytes.
	//
	// Required: false
	Size int64 `json:"size"`

	// Containers is a list of container IDs using this volume.
	//
	// Required: true
	Containers []string `json:"containers"`
}

Volume represents a Docker volume.

func NewSummary

func NewSummary(v volume.Volume) Volume

NewSummary creates a Volume from a docker volume.Volume, calculating InUse based on whether the volume has a reference count of 1 or more.

InUse is set to true if the volume's UsageData.RefCount is >= 1, false otherwise.

Jump to

Keyboard shortcuts

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