Documentation
¶
Index ¶
- Constants
- type ArchiveMode
- type ComputeNode
- type ComputeNodeGetAllRow
- type DBTX
- type Instance
- type InstanceExtra
- type InstanceExtraOptions
- type InstanceExtraRecord
- type InstanceFilters
- type InstanceGetAllRow
- type InstanceRecord
- type InstanceType
- type InstanceTypeOptions
- type InstanceTypeRecord
- type InstancesLockedBy
- type NullInstancesLockedBy
- type NullShadowInstancesLockedBy
- type Queries
- func (q *Queries) ComputeNodeGetAll(ctx context.Context) ([]ComputeNodeGetAllRow, error)
- func (q *Queries) InstanceExtraGetByInstanceUUID(ctx context.Context, uuid string, options ...InstanceExtraOptions) (InstanceExtraRecord, error)
- func (q *Queries) InstanceGetAll(ctx context.Context) ([]InstanceGetAllRow, error)
- func (q *Queries) InstanceGetAllByFilters(ctx context.Context, f InstanceFilters) ([]InstanceRecord, error)
- func (q *Queries) InstanceGetByUUID(ctx context.Context, id string) (InstanceRecord, error)
- func (q *Queries) InstanceTypeGetAll(ctx context.Context, opts InstanceTypeOptions) ([]InstanceTypeRecord, error)
- func (q *Queries) ServiceGetAll(ctx context.Context) ([]ServiceGetAllRow, error)
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
- type Service
- type ServiceGetAllRow
- type ShadowInstance
- type ShadowInstanceExtra
- type ShadowInstanceType
- type ShadowInstancesLockedBy
Constants ¶
const ComputeNodeGetAll = `` /* 462-byte string literal not displayed */
const InstanceGetAll = `` /* 343-byte string literal not displayed */
const ServiceGetAll = `-- name: ServiceGetAll :many
SELECT
id,
uuid,
host,
` + "`" + `binary` + "`" + `,
topic,
disabled,
disabled_reason,
last_seen_up,
forced_down,
version,
report_count,
deleted
FROM services
WHERE deleted = 0
AND last_seen_up IS NOT NULL
AND topic IS NOT NULL
`
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArchiveMode ¶ added in v0.2.0
type ArchiveMode uint8
InstanceFilters combines exact-match filters with AND. Values within a slice use OR. Nil slices are unrestricted; non-nil empty slices match no records. CreatedBefore and DeletedAfter form an optional half-open lifetime window. The zero deletion policy excludes soft-deleted records. ArchiveMode selects primary and/or shadow tables. This is a library extension.
const ( ExcludeArchived ArchiveMode = iota IncludeArchived OnlyArchived )
type ComputeNode ¶
type ComputeNode struct {
CreatedAt sql.NullTime
UpdatedAt sql.NullTime
DeletedAt sql.NullTime
ID int32
ServiceID sql.NullInt32
Vcpus int32
MemoryMb int32
LocalGb int32
VcpusUsed int32
MemoryMbUsed int32
LocalGbUsed int32
HypervisorType string
HypervisorVersion int32
CpuInfo string
DiskAvailableLeast sql.NullInt32
FreeRamMb sql.NullInt32
FreeDiskGb sql.NullInt32
CurrentWorkload sql.NullInt32
RunningVms sql.NullInt32
HypervisorHostname sql.NullString
Deleted sql.NullInt32
HostIp sql.NullString
SupportedInstances sql.NullString
PciStats sql.NullString
Metrics sql.NullString
ExtraResources sql.NullString
Stats sql.NullString
NumaTopology sql.NullString
Host sql.NullString
RamAllocationRatio sql.NullFloat64
CpuAllocationRatio sql.NullFloat64
Uuid sql.NullString
DiskAllocationRatio sql.NullFloat64
Mapped sql.NullInt32
}
type ComputeNodeGetAllRow ¶
type ComputeNodeGetAllRow struct {
ID int32
Uuid sql.NullString
Host sql.NullString
HypervisorHostname sql.NullString
HypervisorType string
HypervisorVersion int32
Vcpus int32
VcpusUsed int32
MemoryMb int32
MemoryMbUsed int32
LocalGb int32
LocalGbUsed int32
DiskAvailableLeast sql.NullInt32
FreeRamMb sql.NullInt32
FreeDiskGb sql.NullInt32
CurrentWorkload sql.NullInt32
RunningVms sql.NullInt32
CpuAllocationRatio sql.NullFloat64
RamAllocationRatio sql.NullFloat64
DiskAllocationRatio sql.NullFloat64
Deleted sql.NullInt32
}
type Instance ¶
type Instance struct {
CreatedAt sql.NullTime
UpdatedAt sql.NullTime
DeletedAt sql.NullTime
ID int32
InternalID sql.NullInt32
UserID sql.NullString
ProjectID sql.NullString
ImageRef sql.NullString
KernelID sql.NullString
RamdiskID sql.NullString
LaunchIndex sql.NullInt32
KeyName sql.NullString
KeyData sql.NullString
PowerState sql.NullInt32
VmState sql.NullString
MemoryMb sql.NullInt32
Vcpus sql.NullInt32
Hostname sql.NullString
Host sql.NullString
UserData sql.NullString
ReservationID sql.NullString
LaunchedAt sql.NullTime
TerminatedAt sql.NullTime
DisplayName sql.NullString
DisplayDescription sql.NullString
AvailabilityZone sql.NullString
Locked sql.NullBool
OsType sql.NullString
LaunchedOn sql.NullString
InstanceTypeID sql.NullInt32
VmMode sql.NullString
Uuid string
Architecture sql.NullString
RootDeviceName sql.NullString
AccessIpV4 sql.NullString
AccessIpV6 sql.NullString
ConfigDrive sql.NullString
TaskState sql.NullString
DefaultEphemeralDevice sql.NullString
DefaultSwapDevice sql.NullString
Progress sql.NullInt32
AutoDiskConfig sql.NullBool
ShutdownTerminate sql.NullBool
DisableTerminate sql.NullBool
RootGb sql.NullInt32
EphemeralGb sql.NullInt32
CellName sql.NullString
Node sql.NullString
Deleted sql.NullInt32
LockedBy NullInstancesLockedBy
Cleaned sql.NullInt32
EphemeralKeyUuid sql.NullString
Hidden sql.NullBool
ComputeID sql.NullInt64
}
type InstanceExtra ¶ added in v0.2.0
type InstanceExtra struct {
ID int32
InstanceUuid string
Flavor sql.NullString
}
type InstanceExtraOptions ¶ added in v0.2.0
type InstanceExtraOptions struct{ Archived bool }
InstanceExtraOptions selects the optional archived instance-extra table.
type InstanceExtraRecord ¶ added in v0.2.0
type InstanceExtraRecord struct {
InstanceUUID string
Flavor sql.NullString
}
InstanceExtraRecord exposes raw flavor JSON without interpreting its version.
type InstanceFilters ¶
type InstanceFilters struct {
Archive ArchiveMode
// WithExtra joins instance_extra (or shadow_instance_extra) for raw flavor JSON.
WithExtra bool
UUIDs []string
ProjectIDs []string
Hosts []string
VMStates []string
Deleted db.Deleted
CreatedBefore time.Time
DeletedAfter time.Time
// IncludeStartBoundary includes records deleted exactly at DeletedAfter.
IncludeStartBoundary bool
// DeletedAtIsNull adds a deleted_at IS NULL predicate independently of Deleted.
DeletedAtIsNull bool
}
type InstanceGetAllRow ¶
type InstanceGetAllRow struct {
ID int32
Uuid string
DisplayName sql.NullString
UserID sql.NullString
ProjectID sql.NullString
Host sql.NullString
AvailabilityZone sql.NullString
VmState sql.NullString
PowerState sql.NullInt32
TaskState sql.NullString
MemoryMb sql.NullInt32
Vcpus sql.NullInt32
RootGb sql.NullInt32
EphemeralGb sql.NullInt32
LaunchedAt sql.NullTime
TerminatedAt sql.NullTime
InstanceTypeID sql.NullInt32
Deleted sql.NullInt32
}
type InstanceRecord ¶ added in v0.2.0
type InstanceRecord struct {
InstanceGetAllRow
CreatedAt sql.NullTime
DeletedAt sql.NullTime
Hostname sql.NullString
Flavor sql.NullString
Archived bool
}
InstanceRecord extends the current-resource projection with lifecycle metadata.
type InstanceType ¶ added in v0.2.0
type InstanceType struct {
ID int32
Name sql.NullString
Deleted int32
}
type InstanceTypeOptions ¶ added in v0.2.0
InstanceTypeOptions controls legacy instance_types reads. Archived selects shadow_instance_types; this explicit archive option extends the old Nova API.
type InstanceTypeRecord ¶ added in v0.2.0
type InstanceTypeRecord struct {
ID int32
Name sql.NullString
}
InstanceTypeRecord is the identity projection of a legacy instance type.
type InstancesLockedBy ¶
type InstancesLockedBy string
const ( InstancesLockedByOwner InstancesLockedBy = "owner" InstancesLockedByAdmin InstancesLockedBy = "admin" )
func (*InstancesLockedBy) Scan ¶
func (e *InstancesLockedBy) Scan(src interface{}) error
type NullInstancesLockedBy ¶
type NullInstancesLockedBy struct {
InstancesLockedBy InstancesLockedBy
Valid bool // Valid is true if InstancesLockedBy is not NULL
}
func (*NullInstancesLockedBy) Scan ¶
func (ns *NullInstancesLockedBy) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullShadowInstancesLockedBy ¶ added in v0.2.0
type NullShadowInstancesLockedBy struct {
ShadowInstancesLockedBy ShadowInstancesLockedBy
Valid bool // Valid is true if ShadowInstancesLockedBy is not NULL
}
func (*NullShadowInstancesLockedBy) Scan ¶ added in v0.2.0
func (ns *NullShadowInstancesLockedBy) Scan(value interface{}) error
Scan implements the Scanner interface.
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) ComputeNodeGetAll ¶
func (q *Queries) ComputeNodeGetAll(ctx context.Context) ([]ComputeNodeGetAllRow, error)
func (*Queries) InstanceExtraGetByInstanceUUID ¶ added in v0.2.0
func (q *Queries) InstanceExtraGetByInstanceUUID(ctx context.Context, uuid string, options ...InstanceExtraOptions) (InstanceExtraRecord, error)
InstanceExtraGetByInstanceUUID follows Nova instance_extra_get_by_instance_uuid. Only flavor metadata is projected. Absent rows return sql.ErrNoRows.
func (*Queries) InstanceGetAll ¶
func (q *Queries) InstanceGetAll(ctx context.Context) ([]InstanceGetAllRow, error)
func (*Queries) InstanceGetAllByFilters ¶
func (q *Queries) InstanceGetAllByFilters(ctx context.Context, f InstanceFilters) ([]InstanceRecord, error)
InstanceGetAllByFilters returns the resource projection for matching database records. Archive access and extra metadata are explicit options. It does not authorize requests or discover cells. Use WithTx for a consistent primary/shadow snapshot.
func (*Queries) InstanceGetByUUID ¶
InstanceGetByUUID returns one undeleted resource, or sql.ErrNoRows when absent.
func (*Queries) InstanceTypeGetAll ¶ added in v0.2.0
func (q *Queries) InstanceTypeGetAll(ctx context.Context, opts InstanceTypeOptions) ([]InstanceTypeRecord, error)
InstanceTypeGetAll follows legacy Nova instance_type_get_all naming. Inactive includes soft-deleted types. Modern flavors live in nova/db/api.
func (*Queries) ServiceGetAll ¶
func (q *Queries) ServiceGetAll(ctx context.Context) ([]ServiceGetAllRow, error)
type Service ¶
type Service struct {
CreatedAt sql.NullTime
UpdatedAt sql.NullTime
DeletedAt sql.NullTime
ID int32
Host sql.NullString
Binary sql.NullString
Topic sql.NullString
ReportCount int32
Disabled sql.NullBool
Deleted sql.NullInt32
DisabledReason sql.NullString
LastSeenUp sql.NullTime
ForcedDown sql.NullBool
Version sql.NullInt32
Uuid sql.NullString
}
type ServiceGetAllRow ¶
type ServiceGetAllRow struct {
ID int32
Uuid sql.NullString
Host sql.NullString
Binary sql.NullString
Topic sql.NullString
Disabled sql.NullBool
DisabledReason sql.NullString
LastSeenUp sql.NullTime
ForcedDown sql.NullBool
Version sql.NullInt32
ReportCount int32
Deleted sql.NullInt32
}
type ShadowInstance ¶ added in v0.2.0
type ShadowInstance struct {
CreatedAt sql.NullTime
UpdatedAt sql.NullTime
DeletedAt sql.NullTime
ID int32
InternalID sql.NullInt32
UserID sql.NullString
ProjectID sql.NullString
ImageRef sql.NullString
KernelID sql.NullString
RamdiskID sql.NullString
LaunchIndex sql.NullInt32
KeyName sql.NullString
KeyData sql.NullString
PowerState sql.NullInt32
VmState sql.NullString
MemoryMb sql.NullInt32
Vcpus sql.NullInt32
Hostname sql.NullString
Host sql.NullString
UserData sql.NullString
ReservationID sql.NullString
LaunchedAt sql.NullTime
TerminatedAt sql.NullTime
DisplayName sql.NullString
DisplayDescription sql.NullString
AvailabilityZone sql.NullString
Locked sql.NullBool
OsType sql.NullString
LaunchedOn sql.NullString
InstanceTypeID sql.NullInt32
VmMode sql.NullString
Uuid string
Architecture sql.NullString
RootDeviceName sql.NullString
AccessIpV4 sql.NullString
AccessIpV6 sql.NullString
ConfigDrive sql.NullString
TaskState sql.NullString
DefaultEphemeralDevice sql.NullString
DefaultSwapDevice sql.NullString
Progress sql.NullInt32
AutoDiskConfig sql.NullBool
ShutdownTerminate sql.NullBool
DisableTerminate sql.NullBool
RootGb sql.NullInt32
EphemeralGb sql.NullInt32
CellName sql.NullString
Node sql.NullString
Deleted sql.NullInt32
LockedBy NullShadowInstancesLockedBy
Cleaned sql.NullInt32
EphemeralKeyUuid sql.NullString
Hidden sql.NullBool
ComputeID sql.NullInt64
}
type ShadowInstanceExtra ¶ added in v0.2.0
type ShadowInstanceExtra struct {
ID int32
InstanceUuid string
Flavor sql.NullString
}
type ShadowInstanceType ¶ added in v0.2.0
type ShadowInstanceType struct {
ID int32
Name sql.NullString
Deleted int32
}
type ShadowInstancesLockedBy ¶ added in v0.2.0
type ShadowInstancesLockedBy string
const ( ShadowInstancesLockedByOwner ShadowInstancesLockedBy = "owner" ShadowInstancesLockedByAdmin ShadowInstancesLockedBy = "admin" )
func (*ShadowInstancesLockedBy) Scan ¶ added in v0.2.0
func (e *ShadowInstancesLockedBy) Scan(src interface{}) error