machine_repository

package
v0.0.0-...-7a62f64 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPowerRelationNotFound = "pq: relation \"power_capabilities\" does not exist"
)

Functions

func New

Types

type CoreModelSql

type CoreModelSql struct {
	Identifier  int    `db:"identifier"`
	Threads     uint32 `db:"threads"`
	Id          int64  `db:"id"`
	ProcessorId int64  `db:"processor_id"`
}

func (*CoreModelSql) ToModel

func (c *CoreModelSql) ToModel() *cpu.Core

type CpuModelSql

type CpuModelSql struct {
	TotalCores   uint32  `db:"total_cores"`
	TotalThreads uint32  `db:"total_threads"`
	Architecture string  `db:"architecture"`
	Model        *string `db:"model,omitempty"`
	Vendor       *string `db:"vendor,omitempty"`
	Processors   []*ProcessorModelSql
	Id           int64  `db:"id"`
	MachineId    string `db:"machine_id"`
}

func (*CpuModelSql) ToModel

func (c *CpuModelSql) ToModel() *cpu.CPU

type DiskModelSql

type DiskModelSql struct {
	Name              string  `db:"name"`
	Size              uint64  `db:"size"`
	DriveType         string  `db:"drive_type"`
	StorageController string  `db:"storage_controller"`
	Removable         bool    `db:"removable"`
	Model             *string `db:"model,omitempty"`
	Vendor            *string `db:"vendor,omitempty"`
	Serial            *string `db:"serial,omitempty"`
	WWN               *string `db:"wwn,omitempty"`
	Partitions        []*PartitionModelSql
	Id                int64  `db:"id"`
	MachineId         string `db:"machine_id"`
}

func (*DiskModelSql) ToModel

func (d *DiskModelSql) ToModel() (*storage.Disk, error)

type HostModelSql

type HostModelSql struct {
	OsPlatform *string `db:"platform,omitempty"`
	OsName     *string `db:"os_name,omitempty"`
	OsVersion  *string `db:"os_version,omitempty"`
	OsFamily   *string `db:"os_family,omitempty"`
	Kernel     *string `db:"kernel,omitempty"`
	Hostname   *string `db:"hostname,omitempty"`
	HostId     *string `db:"host_id,omitempty"`
	Id         int64   `db:"id"`
	MachineId  string  `db:"machine_id"`
}

func (*HostModelSql) ToModel

func (s *HostModelSql) ToModel() *host.Host

type IpAddressModelSql

type IpAddressModelSql struct {
	Version string `db:"version"`
	Address string `db:"address"`
	Id      int64  `db:"id"`
	NicId   string `db:"nic_id"`
}

func (*IpAddressModelSql) ToModel

func (a *IpAddressModelSql) ToModel() (*network.IpAddress, error)

type MachineSql

type MachineSql struct {
	Identifier        string    `db:"identifier"`
	Class             string    `db:"class"`
	Endpoint          string    `db:"endpoint"`
	Key               string    `db:"key"`
	LastHeartbeat     time.Time `db:"last_heartbeat"`
	RegisteredAt      time.Time `db:"registered_at"`
	UpdatedAt         time.Time `db:"updated_at"`
	Status            *StatusModelSql
	PowerCapabilities *PowerCapabilityModelSql
	Host              *HostModelSql
	Cpu               *CpuModelSql
	Memory            *MemoryModelSql
	Disks             []*DiskModelSql
	NetworkInterfaces []*NetworkInterfaceModelSql
	Volumes           []*VolumeModelSql
	Addresses         []*IpAddressModelSql
}

func (*MachineSql) ToModel

func (m *MachineSql) ToModel() (*mach.Machine, error)

type MemoryModelSql

type MemoryModelSql struct {
	Total     uint64 `db:"total"`
	Id        int64  `db:"id"`
	MachineId string `db:"machine_id"`
}

func (*MemoryModelSql) ToModel

func (m *MemoryModelSql) ToModel() *memory.Memory

type NetworkInterfaceModelSql

type NetworkInterfaceModelSql struct {
	Name       string  `db:"name"`
	Virtual    bool    `db:"virtual"`
	MacAddress *string `db:"mac_address,omitempty"`
	Vendor     *string `db:"vendor,omitempty"`
	Speed      *string `db:"speed,omitempty"`
	Duplex     *string `db:"duplex,omitempty"`
	Id         int64   `db:"id"`
	MachineId  string  `db:"machine_id"`
	Addresses  []*IpAddressModelSql
}

func (*NetworkInterfaceModelSql) ToModel

func (n *NetworkInterfaceModelSql) ToModel() (*network.Nic, error)

type PartitionModelSql

type PartitionModelSql struct {
	Name       string  `db:"name"`
	Size       uint64  `db:"size"`
	Readonly   bool    `db:"readonly"`
	Label      *string `db:"label,omitempty"`
	Type       *string `db:"type,omitempty"`
	FileSystem *string `db:"file_system,omitempty"`
	UUID       *string `db:"uuid,omitempty"`
	MountPoint *string `db:"mount_point,omitempty"`
	Id         int64   `db:"id"`
	DiskId     string  `db:"disk_id"`
}

func (*PartitionModelSql) ToModel

func (p *PartitionModelSql) ToModel() (*storage.Partition, error)

type PowerCapabilityModelSql

type PowerCapabilityModelSql struct {
	Reboot       bool    `db:"reboot_enabled"`
	PowerOff     bool    `db:"power_off_enabled"`
	WakeOnLan    bool    `db:"wake_on_lan_enabled"`
	WakeOnLanMac *string `db:"wake_on_lan_mac,omitempty"`
	Id           int64   `db:"id"`
	MachineId    string  `db:"machine_id"`
}

func (*PowerCapabilityModelSql) ToModel

type ProcessorModelSql

type ProcessorModelSql struct {
	Identifier  int     `db:"identifier"`
	CoreCount   uint32  `db:"core_count"`
	ThreadCount uint32  `db:"thread_count"`
	Model       *string `db:"model,omitempty"`
	Vendor      *string `db:"vendor,omitempty"`
	Id          int64   `db:"id"`
	CpuId       string  `db:"cpu_id"`
	Cores       []*CoreModelSql
}

func (*ProcessorModelSql) ToModel

func (p *ProcessorModelSql) ToModel() *cpu.Processor

type Repository

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

func (*Repository) Add

func (r *Repository) Add(ctx context.Context, m *machine.Machine) error

func (*Repository) AddTags

func (r *Repository) AddTags(ctx context.Context, id machine.Identifier, tags []*tag.Tag) error

func (*Repository) Close

func (r *Repository) Close() error

func (*Repository) Delete

func (r *Repository) Delete(ctx context.Context, id machine.Identifier) error

func (*Repository) Get

func (*Repository) List

func (*Repository) RemoveTag

func (r *Repository) RemoveTag(ctx context.Context, id machine.Identifier, tag tag.TagKey) error

func (*Repository) Update

func (r *Repository) Update(ctx context.Context, m *machine.Machine) error

func (*Repository) UpdateHeartbeat

func (r *Repository) UpdateHeartbeat(ctx context.Context, id machine.Identifier) error

func (Repository) UpdateStatus

func (r Repository) UpdateStatus(ctx context.Context, id machine.Identifier, status power.StatusCode) error

type StatusModelSql

type StatusModelSql struct {
	State     string    `db:"state"`
	UpdatedAt time.Time `db:"updated_at"`
	Id        int64     `db:"id"`
	MachineId string    `db:"machine_id"`
}

func (*StatusModelSql) ToModel

func (p *StatusModelSql) ToModel() *power.Status

type VolumeModelSql

type VolumeModelSql struct {
	Name       string  `db:"name"`
	MountPoint string  `db:"mount_point"`
	Total      uint64  `db:"total"`
	FileSystem *string `db:"file_system,omitempty"`
	Id         int64   `db:"id"`
	MachineId  string  `db:"machine_id"`
}

func (*VolumeModelSql) ToModel

func (v *VolumeModelSql) ToModel() (*storage.Volume, error)

Jump to

Keyboard shortcuts

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