volume

package
v2.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FormatVolumeRequest

type FormatVolumeRequest struct {
	// Volume device ID of the volume to format
	VolumeID string
}

type FormatVolumeResponse

type FormatVolumeResponse struct {
}

type GetClosestVolumeIDFromTargetPathRequest

type GetClosestVolumeIDFromTargetPathRequest struct {
	// The target path
	TargetPath string
}

type GetClosestVolumeIDFromTargetPathResponse

type GetClosestVolumeIDFromTargetPathResponse struct {
	// The volume device ID
	VolumeID string
}

type GetDiskNumberFromVolumeIDRequest

type GetDiskNumberFromVolumeIDRequest struct {
	// Volume device ID of the volume to get the disk number for
	VolumeID string
}

type GetDiskNumberFromVolumeIDResponse

type GetDiskNumberFromVolumeIDResponse struct {
	// Corresponding disk number
	DiskNumber uint32
}

type GetVolumeIDFromTargetPathRequest

type GetVolumeIDFromTargetPathRequest struct {
	// The target path
	TargetPath string
}

type GetVolumeIDFromTargetPathResponse

type GetVolumeIDFromTargetPathResponse struct {
	// The volume device ID
	VolumeID string
}

type GetVolumeStatsRequest

type GetVolumeStatsRequest struct {
	// Volume device Id of the volume to get the stats for
	VolumeID string
}

type GetVolumeStatsResponse

type GetVolumeStatsResponse struct {
	// Total bytes
	TotalBytes int64

	// Used bytes
	UsedBytes int64
}

type Interface

type Interface interface {
	// FormatVolume formats a volume with NTFS.
	FormatVolume(context.Context, *FormatVolumeRequest) (*FormatVolumeResponse, error)

	// GetClosestVolumeIDFromTargetPath gets the closest volume id for a given target path
	// by following symlinks and moving up in the filesystem, if after moving up in the filesystem
	// we get to a DriveLetter then the volume corresponding to this drive letter is returned instead.
	GetClosestVolumeIDFromTargetPath(context.Context, *GetClosestVolumeIDFromTargetPathRequest) (*GetClosestVolumeIDFromTargetPathResponse, error)

	// GetDiskNumberFromVolumeID gets the disk number of the disk where the volume is located.
	GetDiskNumberFromVolumeID(context.Context, *GetDiskNumberFromVolumeIDRequest) (*GetDiskNumberFromVolumeIDResponse, error)

	// GetVolumeIDFromTargetPath gets the volume id for a given target path.
	GetVolumeIDFromTargetPath(context.Context, *GetVolumeIDFromTargetPathRequest) (*GetVolumeIDFromTargetPathResponse, error)

	// GetVolumeStats gathers total bytes and used bytes for a volume.
	GetVolumeStats(context.Context, *GetVolumeStatsRequest) (*GetVolumeStatsResponse, error)

	// IsVolumeFormatted checks if a volume is formatted.
	IsVolumeFormatted(context.Context, *IsVolumeFormattedRequest) (*IsVolumeFormattedResponse, error)

	// ListVolumesOnDisk returns the volume IDs (in \\.\Volume{GUID} format) for all volumes from a
	// given disk number and partition number (optional)
	ListVolumesOnDisk(context.Context, *ListVolumesOnDiskRequest) (*ListVolumesOnDiskResponse, error)

	// MountVolume mounts the volume at the requested global staging path.
	MountVolume(context.Context, *MountVolumeRequest) (*MountVolumeResponse, error)

	// ResizeVolume performs resizing of the partition and file system for a block based volume.
	ResizeVolume(context.Context, *ResizeVolumeRequest) (*ResizeVolumeResponse, error)

	// UnmountVolume flushes data cache to disk and removes the global staging path.
	UnmountVolume(context.Context, *UnmountVolumeRequest) (*UnmountVolumeResponse, error)

	// WriteVolumeCache write volume cache to disk.
	WriteVolumeCache(context.Context, *WriteVolumeCacheRequest) (*WriteVolumeCacheResponse, error)
}

type IsVolumeFormattedRequest

type IsVolumeFormattedRequest struct {
	// Volume device ID of the volume to check
	VolumeID string
}

type IsVolumeFormattedResponse

type IsVolumeFormattedResponse struct {
	// Whether the volume is formatted with NTFS
	Formatted bool
}

type ListVolumesOnDiskRequest

type ListVolumesOnDiskRequest struct {
	// Disk device number of the disk to query for volumes
	DiskNumber uint32

	// The partition number (optional), by default it uses the first partition of the disk
	PartitionNumber uint32
}

type ListVolumesOnDiskResponse

type ListVolumesOnDiskResponse struct {
	// Volume device IDs of volumes on the specified disk
	VolumeIDs []string
}

type MountVolumeRequest

type MountVolumeRequest struct {
	// Volume device ID of the volume to mount
	VolumeID string

	// Path in the host's file system where the volume needs to be mounted
	TargetPath string
}

type MountVolumeResponse

type MountVolumeResponse struct {
}

type ResizeVolumeRequest

type ResizeVolumeRequest struct {
	// Volume device ID of the volume to resize
	VolumeID string

	// New size in bytes of the volume
	SizeBytes int64
}

type ResizeVolumeResponse

type ResizeVolumeResponse struct {
}

type UnmountVolumeRequest

type UnmountVolumeRequest struct {
	// Volume device ID of the volume to dismount
	VolumeID string

	// Path where the volume has been mounted
	TargetPath string
}

type UnmountVolumeResponse

type UnmountVolumeResponse struct {
}

type Volume

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

Volume wraps the host API and implements the interface

func New

func New(hostAPI volumeapi.HostAPI) (*Volume, error)

func (*Volume) FormatVolume

func (v *Volume) FormatVolume(context context.Context, request *FormatVolumeRequest) (*FormatVolumeResponse, error)

func (*Volume) GetDiskNumberFromVolumeID

func (v *Volume) GetDiskNumberFromVolumeID(context context.Context, request *GetDiskNumberFromVolumeIDRequest) (*GetDiskNumberFromVolumeIDResponse, error)

func (*Volume) GetVolumeIDFromTargetPath

func (v *Volume) GetVolumeIDFromTargetPath(context context.Context, request *GetVolumeIDFromTargetPathRequest) (*GetVolumeIDFromTargetPathResponse, error)

func (*Volume) GetVolumeStats

func (v *Volume) GetVolumeStats(context context.Context, request *GetVolumeStatsRequest) (*GetVolumeStatsResponse, error)

func (*Volume) IsVolumeFormatted

func (v *Volume) IsVolumeFormatted(context context.Context, request *IsVolumeFormattedRequest) (*IsVolumeFormattedResponse, error)

func (*Volume) ListVolumesOnDisk

func (v *Volume) ListVolumesOnDisk(context context.Context, request *ListVolumesOnDiskRequest) (*ListVolumesOnDiskResponse, error)

func (*Volume) MountVolume

func (v *Volume) MountVolume(context context.Context, request *MountVolumeRequest) (*MountVolumeResponse, error)

func (*Volume) ResizeVolume

func (v *Volume) ResizeVolume(context context.Context, request *ResizeVolumeRequest) (*ResizeVolumeResponse, error)

func (*Volume) UnmountVolume

func (v *Volume) UnmountVolume(context context.Context, request *UnmountVolumeRequest) (*UnmountVolumeResponse, error)

func (*Volume) WriteVolumeCache

func (v *Volume) WriteVolumeCache(context context.Context, request *WriteVolumeCacheRequest) (*WriteVolumeCacheResponse, error)

type WriteVolumeCacheRequest

type WriteVolumeCacheRequest struct {
	// Volume device ID of the volume to flush the cache
	VolumeID string
}

type WriteVolumeCacheResponse

type WriteVolumeCacheResponse struct {
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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