Documentation
¶
Index ¶
- func RemoveMachineBlockDevices(ctx context.Context, tx *sqlair.TX, machineUUID string) error
- type BlockDevice
- type BlockDeviceMachine
- type BlockDevices
- type DeviceLink
- type FilesystemType
- type State
- func (st *State) BlockDevices(ctx context.Context, machineId string) ([]blockdevice.BlockDevice, error)
- func (st *State) MachineBlockDevices(ctx context.Context) ([]blockdevice.MachineBlockDevice, error)
- func (st *State) SetMachineBlockDevices(ctx context.Context, machineId string, devices ...blockdevice.BlockDevice) error
- func (st *State) WatchBlockDevices(ctx context.Context, ...) (watcher.NotifyWatcher, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockDevice ¶
type BlockDevice struct { ID string `db:"uuid"` MachineUUID string `db:"machine_uuid"` DeviceName string `db:"name"` Label string `db:"label,omitempty"` DeviceUUID string `db:"device_uuid"` HardwareId string `db:"hardware_id"` WWN string `db:"wwn"` BusAddress string `db:"bus_address"` SizeMiB uint64 `db:"size_mib"` FilesystemType int `db:"filesystem_type_id"` InUse bool `db:"in_use"` MountPoint string `db:"mount_point"` SerialId string `db:"serial_id"` }
type BlockDeviceMachine ¶
type BlockDeviceMachine struct {
MachineId string `db:"name"`
}
type BlockDevices ¶
type BlockDevices []BlockDevice
type DeviceLink ¶
type FilesystemType ¶
type State ¶
State represents database interactions dealing with block devices.
func NewState ¶
func NewState(factory coredatabase.TxnRunnerFactory) *State
NewState returns a new block device state based on the input database factory method.
func (*State) BlockDevices ¶
func (st *State) BlockDevices(ctx context.Context, machineId string) ([]blockdevice.BlockDevice, error)
BlockDevices returns the BlockDevices for the specified machine. Returns an error satisfying machinerrors.NotFound if the machine does not exist.
func (*State) MachineBlockDevices ¶
func (st *State) MachineBlockDevices(ctx context.Context) ([]blockdevice.MachineBlockDevice, error)
MachineBlockDevices retrieves block devices for all machines.
func (*State) SetMachineBlockDevices ¶
func (st *State) SetMachineBlockDevices(ctx context.Context, machineId string, devices ...blockdevice.BlockDevice) error
SetMachineBlockDevices sets the block devices visible on the machine. Previously recorded block devices not in the list will be removed. Returns an error satisfying machinerrors.NotFound if the machine does not exist.
func (*State) WatchBlockDevices ¶
func (st *State) WatchBlockDevices( ctx context.Context, getWatcher func( namespace, changeValue string, changeMask changestream.ChangeType, mapper eventsource.Mapper, ) (watcher.NotifyWatcher, error), machineId string, ) (watcher.NotifyWatcher, error)
WatchBlockDevices returns a new NotifyWatcher watching for changes to block devices associated with the specified machine.