mount

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package mount provides utilities to detect, format and mount storage devices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mounter added in v0.8.1

type Mounter interface {
	mount.Interface

	FormatAndMount(source string, target string, fstype string, options []string) error
	GetBlockSizeBytes(devicePath string) (int64, error)
	GetDevicePath(ctx context.Context, volumeID string) (string, error)
	GetDeviceNameFromMount(mountPath string) (string, int, error)
	GetStatistics(volumePath string) (VolumeStatistics, error)
	IsBlockDevice(devicePath string) (bool, error)
	IsCorruptedMnt(err error) bool
	MakeDir(path string) error
	MakeFile(path string) error
	NeedResize(devicePath string, deviceMountPath string) (bool, error)
	PathExists(path string) (bool, error)
	Resize(devicePath, deviceMountPath string) (bool, error)
	Unpublish(path string) error
	Unstage(path string) error
}

Mounter defines the set of methods to allow for mount operations on a system.

func New

func New() Mounter

New creates an implementation of the mount.Mounter.

func NewFake

func NewFake() Mounter

NewFake creates a fake implementation of the mount.Mounter, to be used in tests.

type NodeMounter added in v0.8.1

type NodeMounter struct {
	*mount.SafeFormatAndMount
}

NodeMounter implements Mounter. A superstruct of SafeFormatAndMount.

func (*NodeMounter) GetBlockSizeBytes added in v0.8.1

func (m *NodeMounter) GetBlockSizeBytes(devicePath string) (int64, error)

GetBlockSizeBytes gets the size of the disk in bytes.

func (*NodeMounter) GetDeviceNameFromMount added in v0.8.1

func (m *NodeMounter) GetDeviceNameFromMount(mountPath string) (string, int, error)

func (*NodeMounter) GetDevicePath added in v0.8.1

func (m *NodeMounter) GetDevicePath(ctx context.Context, volumeID string) (string, error)

func (*NodeMounter) GetStatistics added in v0.8.1

func (m *NodeMounter) GetStatistics(volumePath string) (VolumeStatistics, error)

GetStatistics gathers statistics on the volume.

func (*NodeMounter) IsBlockDevice added in v0.8.1

func (m *NodeMounter) IsBlockDevice(devicePath string) (bool, error)

IsBlockDevice checks if the given path is a block device.

func (*NodeMounter) IsCorruptedMnt added in v0.8.1

func (m *NodeMounter) IsCorruptedMnt(err error) bool

IsCorruptedMnt return true if err is about corrupted mount point.

func (*NodeMounter) MakeDir added in v0.8.1

func (*NodeMounter) MakeDir(path string) error

func (*NodeMounter) MakeFile added in v0.8.1

func (*NodeMounter) MakeFile(path string) error

func (*NodeMounter) NeedResize added in v0.8.1

func (m *NodeMounter) NeedResize(devicePath string, deviceMountPath string) (bool, error)

NeedResize checks if the filesystem of the given devicePath needs to be resized.

func (*NodeMounter) PathExists added in v0.8.1

func (*NodeMounter) PathExists(path string) (bool, error)

func (*NodeMounter) Resize added in v0.8.1

func (m *NodeMounter) Resize(devicePath, deviceMountPath string) (bool, error)

Resize resizes the filesystem of the given devicePath.

func (*NodeMounter) Unpublish added in v0.8.1

func (m *NodeMounter) Unpublish(path string) error

Unpublish unmounts the given path.

func (*NodeMounter) Unstage added in v0.8.1

func (m *NodeMounter) Unstage(path string) error

Unstage unmounts the given path.

type VolumeStatistics added in v0.8.1

type VolumeStatistics struct {
	AvailableBytes, TotalBytes, UsedBytes    int64
	AvailableInodes, TotalInodes, UsedInodes int64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳