Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Local = local{}
Local is a standard implementation of the Disk interface that uses gosigar and unix.Stat to obtain statistics for the local machine.
Functions ¶
func FormatBytes ¶
Types ¶
type CheckUsageType ¶
type CheckUsageType func(streams step.OutStreams, d Disk, diskFreeRatio float64, paths ...string) (FileSystemDiskUsage, error)
type FileSystemDiskUsage ¶
type FileSystemDiskUsage []*idl.CheckDiskSpaceReply_DiskUsage
func CheckUsage ¶
func CheckUsage(streams step.OutStreams, d Disk, diskFreeRatio float64, paths ...string) (FileSystemDiskUsage, error)
CheckUsage uses the given Disk to look up filesystem usage for each path, and compares the available space to the required disk ratio. Any filesystems that don't have enough space will be given an entry in the returned SpaceFailures map. Note that this is one entry per filesystem, not one entry per path.
This function ignores space that has been reserved for the superuser (i.e. the difference between "free" and "avail" in statfs(2)). It does not consider that space to be free for use, nor does it count that space against the total disk size. For example, a disk with 25% avail space and 75% free space -- as defined by statfs(2) -- would be considered 50% available by CheckUsage.
func (FileSystemDiskUsage) Len ¶
func (f FileSystemDiskUsage) Len() int
func (FileSystemDiskUsage) Less ¶
func (f FileSystemDiskUsage) Less(i, j int) bool
func (FileSystemDiskUsage) Swap ¶
func (f FileSystemDiskUsage) Swap(i, j int)
type FilesystemHost ¶
type SpaceUsageErr ¶
type SpaceUsageErr struct {
// contains filtered or unexported fields
}
func NewSpaceUsageError ¶
func NewSpaceUsageError(usageMap map[FilesystemHost]*idl.CheckDiskSpaceReply_DiskUsage) *SpaceUsageErr
func NewSpaceUsageErrorFromUsage ¶
func NewSpaceUsageErrorFromUsage(usage *idl.CheckDiskSpaceReply_DiskUsage) *SpaceUsageErr
func (SpaceUsageErr) Error ¶
func (d SpaceUsageErr) Error() string
func (SpaceUsageErr) Table ¶
func (d SpaceUsageErr) Table() [][]string