placement

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const GetAllocationsByProject = `` /* 425-byte string literal not displayed */
View Source
const GetConsumerCountByProject = `` /* 229-byte string literal not displayed */
View Source
const GetConsumers = `` /* 254-byte string literal not displayed */
View Source
const GetResourceClasses = `-- name: GetResourceClasses :many
SELECT 
    id,
    name
FROM resource_classes
ORDER BY name
`
View Source
const GetResourceProviderInventories = `` /* 548-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type Allocation

type Allocation struct {
	ID                 int32
	ResourceProviderID int32
	ConsumerID         string
	ResourceClassID    int32
	Used               int32
	CreatedAt          sql.NullTime
	UpdatedAt          sql.NullTime
}

type Consumer

type Consumer struct {
	ID             int32
	Uuid           string
	ProjectID      int32
	UserID         int32
	Generation     int32
	ConsumerTypeID sql.NullInt32
	CreatedAt      sql.NullTime
	UpdatedAt      sql.NullTime
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type GetAllocationsByProjectRow

type GetAllocationsByProjectRow struct {
	ProjectID    string
	ResourceType sql.NullString
	Used         int64
}

type GetConsumerCountByProjectRow

type GetConsumerCountByProjectRow struct {
	ProjectID     string
	InstanceCount int64
}

type GetConsumersRow

type GetConsumersRow struct {
	ID         int32
	Uuid       string
	Generation int32
	ProjectID  string
	UserID     string
}

type GetResourceClassesRow

type GetResourceClassesRow struct {
	ID   int32
	Name string
}

type GetResourceProviderInventoriesRow

type GetResourceProviderInventoriesRow struct {
	Hostname        sql.NullString
	ResourceType    string
	Total           int32
	AllocationRatio float64
	Reserved        int32
	Used            int64
}

type Inventory

type Inventory struct {
	ID                 int32
	ResourceProviderID int32
	ResourceClassID    int32
	Total              int32
	Reserved           int32
	MinUnit            int32
	MaxUnit            int32
	StepSize           int32
	AllocationRatio    float64
	CreatedAt          sql.NullTime
	UpdatedAt          sql.NullTime
}

type Project

type Project struct {
	ID         int32
	ExternalID string
	CreatedAt  sql.NullTime
	UpdatedAt  sql.NullTime
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) GetAllocationsByProject

func (q *Queries) GetAllocationsByProject(ctx context.Context) ([]GetAllocationsByProjectRow, error)

Get resource usage by project for Nova quota calculations

func (*Queries) GetConsumerCountByProject

func (q *Queries) GetConsumerCountByProject(ctx context.Context) ([]GetConsumerCountByProjectRow, error)

Count instances (consumers) per project for Nova instance quota usage

func (*Queries) GetConsumers

func (q *Queries) GetConsumers(ctx context.Context) ([]GetConsumersRow, error)

Get consumer information for allocation tracking

func (*Queries) GetResourceClasses

func (q *Queries) GetResourceClasses(ctx context.Context) ([]GetResourceClassesRow, error)

Get all resource classes for reference

func (*Queries) GetResourceProviderInventories

func (q *Queries) GetResourceProviderInventories(ctx context.Context) ([]GetResourceProviderInventoriesRow, error)

This is the main query that provides data for all four metrics: - resource_total: inventory total - resource_allocation_ratio: inventory allocation_ratio - resource_reserved: inventory reserved - resource_usage: sum of allocations per resource provider + class

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type ResourceClass

type ResourceClass struct {
	ID        int32
	Name      string
	CreatedAt sql.NullTime
	UpdatedAt sql.NullTime
}

type ResourceProvider

type ResourceProvider struct {
	ID               int32
	Uuid             string
	Name             sql.NullString
	Generation       sql.NullInt32
	CreatedAt        sql.NullTime
	UpdatedAt        sql.NullTime
	RootProviderID   sql.NullInt32
	ParentProviderID sql.NullInt32
}

type User

type User struct {
	ID         int32
	ExternalID string
	CreatedAt  sql.NullTime
	UpdatedAt  sql.NullTime
}

Jump to

Keyboard shortcuts

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