filesystem

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrToolNotFound = errors.New("tool not found")
)

Functions

This section is empty.

Types

type Filesystem

type Filesystem interface {
	Format(ctx context.Context, source, fsType string, mkfsArgs []string) error
	IsMounted(ctx context.Context, target string) (bool, error)
	Mount(ctx context.Context, source, target, fsType string, opts ...string) error
	Unmount(ctx context.Context, path string) error
	Statistics(volumePath string) (VolumeStatistics, error)
	GetDeviceByID(ctx context.Context, ID string) (string, error)
	GetDeviceLastPartition(ctx context.Context, source string) (string, error)
}

type LinuxFilesystem

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

func NewLinuxFilesystem

func NewLinuxFilesystem(filesystemTypes []string, log *logrus.Entry) (*LinuxFilesystem, error)

func (*LinuxFilesystem) Format

func (m *LinuxFilesystem) Format(ctx context.Context, source, fsType string, mkfsArgs []string) error

Format writes new partition table and creates new partition and filesystem. This function should be idempotent and should eventually lead to success in case off temporary system failure.

func (*LinuxFilesystem) GetDeviceByID

func (m *LinuxFilesystem) GetDeviceByID(ctx context.Context, id string) (string, error)

getBlockDeviceByVolumeID returns the absolute path of the attached block device for the given volumeID.

func (*LinuxFilesystem) GetDeviceLastPartition

func (m *LinuxFilesystem) GetDeviceLastPartition(ctx context.Context, device string) (string, error)

func (*LinuxFilesystem) IsMounted

func (m *LinuxFilesystem) IsMounted(ctx context.Context, target string) (bool, error)

IsMounted checks whether the target path is a correct mount (i.e: propagated). It returns true if it's mounted. An error is returned in case of system errors or if it's mounted incorrectly.

func (*LinuxFilesystem) Mount

func (m *LinuxFilesystem) Mount(ctx context.Context, source, target, fsType string, opts ...string) error

Mount mounts source to target with the given fstype and options.

func (*LinuxFilesystem) Statistics

func (m *LinuxFilesystem) Statistics(volumePath string) (VolumeStatistics, error)

filesystemStatistics returns capacity-related volume statistics for the given volume path.

func (*LinuxFilesystem) Unmount

func (m *LinuxFilesystem) Unmount(ctx context.Context, target string) error

Unmount unmounts the given target.

type VolumeStatistics

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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