utils

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyWithProgress

func CopyWithProgress(ctx context.Context, ui packer.Ui, dst io.Writer, src io.Reader) (int64, error)

Types

type Device

type Device struct {
	Device      string
	Removable   bool
	ReadOnly    bool
	Name        string
	Mountpoints []string
}

func GetDetachableDevices

func GetDetachableDevices() ([]Device, error)

func GetDevice

func GetDevice(dev *LSBLKDevice, mntTable *MountTable) (*Device, error)

func GetDevices

func GetDevices() ([]Device, error)

type LSBLKDevice

type LSBLKDevice struct {
	Name       string        `json:"name"`
	Model      string        `json:"model"`
	Size       StringOrInt   `json:"size"`
	Ro         StringOrBool  `json:"ro"`
	Rm         StringOrBool  `json:"rm"`
	DeviceUUID string        `json:"uuid"`
	Children   []LSBLKDevice `json:"children"`
	// contains filtered or unexported fields
}

func (*LSBLKDevice) DevicePath

func (l *LSBLKDevice) DevicePath() string

func (*LSBLKDevice) Readonly

func (l *LSBLKDevice) Readonly() bool

func (*LSBLKDevice) Removable

func (l *LSBLKDevice) Removable() bool

func (*LSBLKDevice) UDevInfo

func (l *LSBLKDevice) UDevInfo() (*UdevAdm, error)

func (*LSBLKDevice) UUID

func (l *LSBLKDevice) UUID() string

type LSBLKDevices

type LSBLKDevices struct {
	Devices []LSBLKDevice `json:"blockdevices"`
}

func GetLSBLKDevices

func GetLSBLKDevices() (*LSBLKDevices, error)

func ParseLSBLKDevices

func ParseLSBLKDevices(data []byte) (*LSBLKDevices, error)

type MountEntry

type MountEntry struct {
	Device, Mountpoint, Type, Options string
}

type MountTable

type MountTable struct {
	Entries []MountEntry
}

func NewMountTable

func NewMountTable() (*MountTable, error)

func ParseMountTable

func ParseMountTable(data []byte) (*MountTable, error)

func (*MountTable) Find

func (mt *MountTable) Find(m Mountable) *MountEntry

type Mountable

type Mountable interface {
	DevicePath() string
	UUID() string
}

type Progress

type Progress struct {
	MBytesPerSecond float64
	PercentDone     float64
}

type ProgressWriter

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

func NewProgressWriter

func NewProgressWriter() *ProgressWriter

func NewProgressWriterWithSize

func NewProgressWriterWithSize(fileSize uint64) *ProgressWriter

func (*ProgressWriter) Progress

func (pw *ProgressWriter) Progress() Progress

func (*ProgressWriter) Stop

func (pw *ProgressWriter) Stop()

func (*ProgressWriter) TotalData

func (pw *ProgressWriter) TotalData() uint64

func (*ProgressWriter) Write

func (pw *ProgressWriter) Write(data []byte) (int, error)

type StringOrBool

type StringOrBool struct {
	Value bool
}

func (*StringOrBool) UnmarshalJSON

func (sb *StringOrBool) UnmarshalJSON(b []byte) error

type StringOrInt

type StringOrInt struct {
	Value int64
}

func (*StringOrInt) UnmarshalJSON

func (sb *StringOrInt) UnmarshalJSON(b []byte) error

type UdevAdm

type UdevAdm struct {
	Values map[string]string
}

func NewUdevAdm

func NewUdevAdm(name string) (*UdevAdm, error)

func ParseUdevAdm

func ParseUdevAdm(data []byte) (*UdevAdm, error)

Jump to

Keyboard shortcuts

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