computequota

package
v0.0.7-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: AGPL-3.0 Imports: 6 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComputeLimits

type ComputeLimits struct {
	MaxStacksPerOrganization         int64  `yaml:"maxStacksPerOrganization" json:"max_stacks_per_organization"`
	MaxStackResourcesPerOrganization int64  `yaml:"maxStackResourcesPerOrganization" json:"max_stack_resources_per_organization"`
	ReplicasPerStackResource         int32  `yaml:"replicasPerStackResource" json:"replicas_per_stack_resource"`
	MaxVolumesPerOrganization        int64  `yaml:"maxVolumesPerOrganization" json:"max_volumes_per_organization"`
	MaxVolumeSize                    string `yaml:"maxVolumeSize" json:"max_volume_size"`
	VolumeStorageClass               string `yaml:"volumeStorageClass" json:"volume_storage_class"`
	MaxPostgresAddonsPerOrganization int64  `yaml:"maxPostgresAddonsPerOrganization" json:"max_postgres_addons_per_organization"`
	PostgresInstances                int    `yaml:"postgresInstances" json:"postgres_instances"`
	MaxPostgresStorageSize           string `yaml:"maxPostgresStorageSize" json:"max_postgres_storage_size"`
	PostgresCPURequest               string `yaml:"postgresCPURequest" json:"postgres_cpu_request"`
	PostgresCPULimit                 string `yaml:"postgresCPULimit" json:"postgres_cpu_limit"`
	PostgresMemoryRequest            string `yaml:"postgresMemoryRequest" json:"postgres_memory_request"`
	PostgresMemoryLimit              string `yaml:"postgresMemoryLimit" json:"postgres_memory_limit"`
	// ConcurrentBuilds is informational here; request quota policy does not
	// enforce build scheduling.
	ConcurrentBuilds int `yaml:"concurrentBuilds" json:"concurrent_builds"`
}

ComputeLimits is runtime configuration for an organisation's use of managed compute. It is a value object and is not persisted.

type ComputeUsage

type ComputeUsage struct {
	StackCount         int64
	StackResourceCount int64
	VolumeCount        int64
	PostgresAddonCount int64
}

type Policy

type Policy interface {
	EnsureAccess(ctx context.Context, organisationID string) *errors.ServiceError
	ValidateStackLimits(ctx context.Context, change StackLimitChange) *errors.ServiceError
	ValidateVolumeLimits(ctx context.Context, change VolumeLimitChange) *errors.ServiceError
	ValidatePostgresAddonLimits(ctx context.Context, change PostgresAddonLimitChange) *errors.ServiceError
	ApplyStackResourceDefaults(resource *models.StackResource)
	ApplyVolumeDefaults(volume *models.Volume)
	ApplyPostgresAddonDefaults(addon *models.PostgresAddon)
}

Policy keeps request-layer access checks, limits, and runtime-owned defaults out of request services.

func NewSelfHostedPolicy

func NewSelfHostedPolicy() Policy

func NewStackdomeCloudPolicy

func NewStackdomeCloudPolicy(spec StackdomeCloudPolicySpec) Policy

type PostgresAddonLimitChange

type PostgresAddonLimitChange struct {
	OrganisationID string
	CreatesAddon   bool
	Addon          *models.PostgresAddon
}

PostgresAddonLimitChange describes a proposed PostgreSQL addon create or update.

type StackLimitChange

type StackLimitChange struct {
	Operation      StackLimitOperation
	OrganisationID string
	// ReplacedStackID identifies the stack whose complete persisted resource
	// set will be replaced by DesiredResourceCount.
	ReplacedStackID string
	// DesiredResourceCount is the complete desired count for a whole-stack
	// create or replacement. Single-resource operations do not use it.
	DesiredResourceCount int64
}

StackLimitChange describes how a proposed draft edit changes counted stack usage. It does not decide compute access or runtime reconciliation.

type StackLimitOperation

type StackLimitOperation string
const (
	StackLimitCreateStack    StackLimitOperation = "create_stack"
	StackLimitReplaceStack   StackLimitOperation = "replace_stack"
	StackLimitAddResource    StackLimitOperation = "add_resource"
	StackLimitUpdateResource StackLimitOperation = "update_resource"
)

type StackdomeCloudPolicySpec

type StackdomeCloudPolicySpec struct {
	ComputeAccess computeaccess.Service
	ComputeUsage  UsageStore
	Limits        ComputeLimits
}

type UsageStore

type UsageStore interface {
	LockOrganisationAndGetUsage(ctx context.Context, organisationID, replacedStackID string) (ComputeUsage, *errors.ServiceError)
}

UsageStore serializes capacity-changing mutations for one organisation and returns its persisted usage. Implementations require a transaction in ctx. When replacedStackID is set, the replaced stack remains in StackCount while its old resources are omitted from StackResourceCount.

type VolumeLimitChange

type VolumeLimitChange struct {
	OrganisationID string
	Size           string
}

VolumeLimitChange describes a proposed volume creation.

Jump to

Keyboard shortcuts

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