disk

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package disk contains disk and plot related operations

Index

Constants

View Source
const (
	Byte = 1
	KiB  = 1024 * Byte
	MiB  = 1024 * KiB
	GiB  = 1024 * MiB
	TiB  = 1024 * GiB
)

Variables

View Source
var Statfs = syscall.Statfs

Statfs represents the syscall to get the Statfs information

Functions

This section is empty.

Types

type Disk

type Disk struct {
	// Path represents a directory path
	Path string
	// Total represents the total disk space
	Total Space
	// Free represents the free/available disk space
	Free Space
	// Used represents the used disk space
	Used Space
}

Disk represents abstraction of a disk

func NewDisk

func NewDisk(path string) (*Disk, error)

NewDisk creates a new Disk from the given path. Details about the disk space will be fetched via statfs.

type PlotInfo

type PlotInfo struct {
	*Disk
	// reserved represents the amount of plots to be reserved when evaluating how many plots are left
	Reserved uint64
}

PlotInfo gives further plot related information of a Disk

func (PlotInfo) PlotsLeft

func (p PlotInfo) PlotsLeft() uint64

PlotsLeft calculates the amount of plots which can still be stored on the Disk. The amount of reserved plots is included in the assessment

func (PlotInfo) PlotsStored

func (p PlotInfo) PlotsStored() uint64

PlotsStored calculates the amount of plots which are stored on the Disk. The amount of reserved plots is not included in the assessment

func (PlotInfo) PlotsTotal

func (p PlotInfo) PlotsTotal() uint64

PlotsTotal calculates the total amount of plots which can be stored on the Disk. The amount of reserved plots is not included in the assessment

type Space

type Space uint64

Space represents disk space in bytes

const SizeOfPlot Space = 108770046772

SizeOfPlot in Bytes A k32 will take up 101.3 GiB of space once completed 101.3 * 1024 * 1024 * 1024 = 108770046771,2

func (Space) Byte

func (s Space) Byte() uint64

Byte returns the disk Space in Bytes

func (Space) Gibibyte

func (s Space) Gibibyte() float64

Gibibyte returns the disk Space in Gibibyte

func (Space) Kibibyte

func (s Space) Kibibyte() float64

Kibibyte returns the disk Space in Kibibyte

func (Space) Mebibyte

func (s Space) Mebibyte() float64

Mebibyte returns the disk Space in Megibyte

func (Space) Tebibyte

func (s Space) Tebibyte() float64

Tebibyte returns the disk Space in Gibibyte

Jump to

Keyboard shortcuts

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