Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RegisterManages = make(chan interface{}, 1)
RegisterManages
Functions ¶
Types ¶
type Attribute ¶
type Attribute struct {
// DevicePath represents the disk hardware path.
// The general format is like /sys/devices/pci0000:ae/0000:ae:02.0/0000:b1:00.0/host2/target2:1:0/2:1:0:0/block/sdc/sdc
DevPath string `json:"devPath,omitempty"`
// DevName the general format is /dev/sda
DevName string `json:"devName,omitempty"`
// DevType such as disk, partition
DevType string `json:"devType,omitempty"`
// Major represents drive used by the device
Major string `json:"major,omitempty"`
// Minor is used to distinguish different devices
Minor string `json:"minor,omitempty"`
// SubSystem identifies the device's system type, such as block
SubSystem string `json:"subSystem,omitempty"`
// Bus
Bus string `json:"id_bus,omitempty"`
// FS_TYPE
FSType string `json:"id_fs_type,omitempty"`
// Model
Model string `json:"id_model,omitempty"`
// WWN
WWN string `json:"id_wwn,omitempty"`
// PartTableType
PartTableType string `json:"id_part_table_type,omitempty"`
// Serial
Serial string `json:"id_serial,omitempty"`
// Vendor
Vendor string `json:"id_vendor,omitempty"`
// ID_TYPE
IDType string `json:"id_type"`
// Capacity of the disk in bytes
Capacity int64 `json:"capacity,omitempty"`
// DriverType such as HDD, SSD
DriverType string `json:"driverType"`
}
Attribute for disk details
type DiskIdentify ¶
type DiskIdentify struct {
// DevPath such as /sys/devices/pci0000:00/0000:00:15.0/0000:03:00.0/host0/target0:0:1/0:0:1:0/block/sda
DevPath string `json:"devPath"`
// DevName such as /dev/sda
DevName string `json:"devName"`
// Name such as sda
Name string `json:"name"`
}
DiskIdentify
func NewDiskIdentifyWithName ¶
func NewDiskIdentifyWithName(devPath, devName string) *DiskIdentify
type DiskInfo ¶
type DiskInfo struct {
// DiskIdentify
DiskIdentify `json:"diskIdentify,omitempty"`
// Attribute
Attribute Attribute `json:"attribute,omitempty"`
// Partition
Partitions []PartitionInfo `json:"partition,omitempty"`
// Raid
Raid RaidInfo `json:"raid,omitempty"`
}
DiskInfo
type DiskParser ¶
type DiskParser struct {
// DiskIdentify
*DiskIdentify
PartitionParser
RaidParser
AttributeParser
}
DiskParser The information source of the disk may use a variety of methods. For LocalDisk, it only focuses on the basic information of the disk itself. Therefore, there is no direct binding between the disk attributes and the specific implementation. The parser will be responsible for docking with various tools to output fixed information
func NewDiskParser ¶
func NewDiskParser( disk *DiskIdentify, partitionParser PartitionParser, raidParser RaidParser, attrParser AttributeParser, ) *DiskParser
NewDiskParser
type IPartition ¶
type IPartition interface {
HasPartition() bool
ParsePartitionInfo() []PartitionInfo
}
IPartition
type Manager ¶
type Manager interface {
// ListExist list all disks exist on node
ListExist() []Event
// Monitor monitor all disk events(e.g. add/remove/offline)
Monitor(chan Event)
}
Manager for disk monitor
type PartitionInfo ¶
type PartitionInfo struct {
// Name
Name string
// Size
Size uint64
// Label
Label string
// Filesystem
Filesystem string
}
PartitionInfo
type RaidParser ¶
type RaidParser struct {
// DiskIdentify Uniquely identify a disk
DiskIdentify
IRaid
}
Raid
Click to show internal directories.
Click to hide internal directories.