Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Disk ¶
type Disk struct {
Name string `json:"name"`
SizeBytes uint64 `json:"size_bytes"`
PhysicalBlockSizeBytes uint64 `json:"physical_block_size_bytes"`
DriveType DriveType `json:"drive_type"`
IsRemovable bool `json:"removable"`
StorageController StorageController `json:"storage_controller"`
BusPath string `json:"bus_path"`
// TODO(jaypipes): Convert this to a TopologyNode struct pointer and then
// add to serialized output as "numa_node,omitempty"
NUMANodeID int `json:"-"`
Vendor string `json:"vendor"`
Model string `json:"model"`
SerialNumber string `json:"serial_number"`
WWN string `json:"wwn"`
Partitions []*Partition `json:"partitions"`
}
Disk describes a single disk drive on the host system. Disk drives provide raw block storage resources.
type DriveType ¶
type DriveType int
DriveType describes the general category of drive device
func (DriveType) MarshalJSON ¶
NOTE(jaypipes): since serialized output is as "official" as we're going to get, let's lowercase the string output when serializing, in order to "normalize" the expected serialized output
type Info ¶
type Info struct {
// TODO(jaypipes): Deprecate this field and replace with TotalSizeBytes
TotalPhysicalBytes uint64 `json:"total_size_bytes"`
Disks []*Disk `json:"disks"`
Partitions []*Partition `json:"-"`
// contains filtered or unexported fields
}
Info describes all disk drives and partitions in the host system.
func New ¶
New returns a pointer to an Info struct that describes the block storage resources of the host system.
func (*Info) JSONString ¶
JSONString returns a string with the block information formatted as JSON under a top-level "block:" key
func (*Info) YAMLString ¶
YAMLString returns a string with the block information formatted as YAML under a top-level "block:" key
type Partition ¶
type Partition struct {
Disk *Disk `json:"-"`
Name string `json:"name"`
Label string `json:"label"`
MountPoint string `json:"mount_point"`
SizeBytes uint64 `json:"size_bytes"`
Type string `json:"type"`
IsReadOnly bool `json:"read_only"`
UUID string `json:"uuid"` // This would be volume UUID on macOS, PartUUID on linux, empty on Windows
}
Partition describes a logical division of a Disk.
type StorageController ¶
type StorageController int
StorageController is a category of block storage controller/driver. It represents more of the physical hardware interface than the storage protocol, which represents more of the software interface.
See discussion on https://github.com/jaypipes/ghw/issues/117
const ( STORAGE_CONTROLLER_UNKNOWN StorageController = iota STORAGE_CONTROLLER_IDE // Integrated Drive Electronics STORAGE_CONTROLLER_SCSI // Small computer system interface STORAGE_CONTROLLER_NVME // Non-volatile Memory Express STORAGE_CONTROLLER_VIRTIO // Virtualized storage controller/driver STORAGE_CONTROLLER_MMC // Multi-media controller (used for mobile phone storage devices) )
func (StorageController) MarshalJSON ¶
func (sc StorageController) MarshalJSON() ([]byte, error)
NOTE(jaypipes): since serialized output is as "official" as we're going to get, let's lowercase the string output when serializing, in order to "normalize" the expected serialized output
func (StorageController) String ¶
func (sc StorageController) String() string