Documentation
¶
Index ¶
- Variables
- type API
- type VolumeAPI
- func (VolumeAPI) FormatVolume(volumeID string) (err error)
- func (VolumeAPI) GetClosestVolumeIDFromTargetPath(targetPath string) (string, error)
- func (VolumeAPI) GetDiskNumberFromVolumeID(volumeID string) (uint32, error)
- func (VolumeAPI) GetVolumeIDFromTargetPath(mount string) (string, error)
- func (VolumeAPI) GetVolumeStats(volumeID string) (volumeSize, volumeUsedSize int64, err error)
- func (VolumeAPI) IsVolumeFormatted(volumeID string) (bool, error)
- func (VolumeAPI) ListVolumesOnDisk(diskNumber uint32, partitionNumber uint32) (volumeIDs []string, err error)
- func (VolumeAPI) MountVolume(volumeID, path string) error
- func (VolumeAPI) ResizeVolume(volumeID string, size int64) error
- func (VolumeAPI) UnmountVolume(volumeID, path string) error
- func (VolumeAPI) WriteVolumeCache(volumeID string) (err error)
Constants ¶
This section is empty.
Variables ¶
var ( // VolumeRegexp matches a Windows Volume // example: Volume{452e318a-5cde-421e-9831-b9853c521012} // // The field UniqueId has an additional prefix which is NOT included in the regex // however the regex can match UniqueId too // PS C:\disks> (Get-Disk -Number 1 | Get-Partition | Get-Volume).UniqueId // \\?\Volume{452e318a-5cde-421e-9831-b9853c521012}\ VolumeRegexp = regexp.MustCompile(`Volume\{[\w-]*\}`) )
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
// ListVolumesOnDisk lists volumes on a disk identified by a `diskNumber` and optionally a partition identified by `partitionNumber`.
ListVolumesOnDisk(diskNumber uint32, partitionNumber uint32) (volumeIDs []string, err error)
// MountVolume mounts the volume at the requested global staging target path.
MountVolume(volumeID, targetPath string) error
// UnmountVolume gracefully dismounts a volume.
UnmountVolume(volumeID, targetPath string) error
// IsVolumeFormatted checks if a volume is formatted with NTFS.
IsVolumeFormatted(volumeID string) (bool, error)
// FormatVolume formats a volume with the NTFS format.
FormatVolume(volumeID string) error
// ResizeVolume performs resizing of the partition and file system for a block based volume.
ResizeVolume(volumeID string, sizeBytes int64) error
// GetVolumeStats gets the volume information.
GetVolumeStats(volumeID string) (int64, int64, error)
// GetDiskNumberFromVolumeID returns the disk number for a given volumeID.
GetDiskNumberFromVolumeID(volumeID string) (uint32, error)
// GetVolumeIDFromTargetPath returns the volume id of a given target path.
GetVolumeIDFromTargetPath(targetPath string) (string, error)
// WriteVolumeCache writes the volume `volumeID`'s cache to disk.
WriteVolumeCache(volumeID string) error
// GetClosestVolumeIDFromTargetPath returns the volume id of a given target path.
GetClosestVolumeIDFromTargetPath(targetPath string) (string, error)
}
API exposes the internal volume operations available in the server
type VolumeAPI ¶
type VolumeAPI struct{}
VolumeAPI implements the internal Volume APIs
func (VolumeAPI) FormatVolume ¶
FormatVolume - Formats a volume with the NTFS format.
func (VolumeAPI) GetClosestVolumeIDFromTargetPath ¶ added in v1.1.0
GetClosestVolumeIDFromTargetPath returns the volume id of a given target path.
func (VolumeAPI) GetDiskNumberFromVolumeID ¶
GetDiskNumberFromVolumeID - gets the disk number where the volume is.
func (VolumeAPI) GetVolumeIDFromTargetPath ¶
GetVolumeIDFromTargetPath - gets the volume ID given a mount point, the function is recursive until it find a volume or errors out
func (VolumeAPI) GetVolumeStats ¶
GetVolumeStats - retrieves the volume stats for a given volume
func (VolumeAPI) IsVolumeFormatted ¶
IsVolumeFormatted - Check if the volume is formatted with the pre specified filesystem(typically ntfs).
func (VolumeAPI) ListVolumesOnDisk ¶
func (VolumeAPI) ListVolumesOnDisk(diskNumber uint32, partitionNumber uint32) (volumeIDs []string, err error)
ListVolumesOnDisk - returns back list of volumes(volumeIDs) in a disk and a partition.
func (VolumeAPI) MountVolume ¶
MountVolume - mounts a volume to a path. This is done using Win32 API SetVolumeMountPoint for presenting the volume via a path.
func (VolumeAPI) ResizeVolume ¶
ResizeVolume - resizes a volume with the given size, if size == 0 then max supported size is used
func (VolumeAPI) UnmountVolume ¶
UnmountVolume - unmounts the volume path by removing the partition access path
func (VolumeAPI) WriteVolumeCache ¶
WriteVolumeCache - Writes the file system cache to disk with the given volume id