Documentation ¶
Index ¶
- Variables
- func New(db database.Database, tagRepo repository.Tag) (repository.Machine, error)
- type CoreModelSql
- type CpuModelSql
- type DiskModelSql
- type HostModelSql
- type IpAddressModelSql
- type MachineSql
- type MemoryModelSql
- type NetworkInterfaceModelSql
- type PartitionModelSql
- type PowerCapabilityModelSql
- type ProcessorModelSql
- type Repository
- func (r *Repository) Add(ctx context.Context, m *machine.Machine) error
- func (r *Repository) AddTags(ctx context.Context, id machine.Identifier, tags []*tag.Tag) error
- func (r *Repository) Close() error
- func (r *Repository) Delete(ctx context.Context, id machine.Identifier) error
- func (r *Repository) Get(ctx context.Context, id machine.Identifier) (*machine.Machine, error)
- func (r *Repository) List(ctx context.Context, filters *repository.ListMachinesFilters) ([]*machine.Machine, error)
- func (r *Repository) RemoveTag(ctx context.Context, id machine.Identifier, tag tag.TagKey) error
- func (r *Repository) Update(ctx context.Context, m *machine.Machine) error
- func (r *Repository) UpdateHeartbeat(ctx context.Context, id machine.Identifier) error
- func (r Repository) UpdateStatus(ctx context.Context, id machine.Identifier, status power.StatusCode) error
- type StatusModelSql
- type VolumeModelSql
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrPowerRelationNotFound = "pq: relation \"power_capabilities\" does not exist"
)
Functions ¶
func New ¶
func New(db database.Database, tagRepo repository.Tag) (repository.Machine, error)
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"` }
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 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 }
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 }
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"` }
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 ¶
func (p *PowerCapabilityModelSql) ToModel() mach.PowerCapabilities
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) 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 (r *Repository) Get(ctx context.Context, id machine.Identifier) (*machine.Machine, error)
func (*Repository) List ¶
func (r *Repository) List(ctx context.Context, filters *repository.ListMachinesFilters) ([]*machine.Machine, error)
func (*Repository) RemoveTag ¶
func (r *Repository) RemoveTag(ctx context.Context, id machine.Identifier, tag tag.TagKey) 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
Click to show internal directories.
Click to hide internal directories.