datamodel

package
v0.0.0-...-d8fb4c5 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyComputedProjectQuota

func ApplyComputedProjectQuota(serviceType limes.ServiceType, resourceName limesresources.ResourceName, dbm *gorp.DbMap, cluster *core.Cluster, now time.Time) error

ApplyComputedProjectQuota reevaluates auto-computed project quotas for the given resource, if supported by its quota distribution model.

func CanConfirmNewCommitment

func CanConfirmNewCommitment(req limesresources.CommitmentRequest, resourceID db.ProjectResourceID, cluster *core.Cluster, dbi db.Interface) (bool, error)

CanConfirmNewCommitment returns whether the given commitment request can be confirmed immediately upon creation in the given project.

func CanMoveExistingCommitment

func CanMoveExistingCommitment(amount uint64, loc AZResourceLocation, sourceResourceID, targetResourceID db.ProjectResourceID, cluster *core.Cluster, dbi db.Interface) (bool, error)

CanMoveExistingCommitment returns whether a commitment of the given amount at the given AZ resource location can be moved from one project to another. The projects are identified by their resource IDs.

func ConfirmPendingCommitments

func ConfirmPendingCommitments(serviceType limes.ServiceType, resourceName limesresources.ResourceName, az limes.AvailabilityZone, cluster *core.Cluster, dbi db.Interface, now time.Time) error

ConfirmPendingCommitments goes through all unconfirmed commitments that could be confirmed, in chronological creation order, and confirms as many of them as possible given the currently available capacity.

func NewCapacityPluginBackchannel

func NewCapacityPluginBackchannel(cluster *core.Cluster, dbi db.Interface) core.CapacityPluginBackchannel

NewCapacityPluginBackchannel builds a CapacityPluginBackchannel.

func ValidateProjectServices

func ValidateProjectServices(dbi db.Interface, cluster *core.Cluster, domain db.Domain, project db.Project, now time.Time) error

ValidateProjectServices ensures that all required ProjectService records for this project exist (and none other).

Types

type AZResourceLocation

type AZResourceLocation struct {
	ServiceType      limes.ServiceType
	ResourceName     limesresources.ResourceName
	AvailabilityZone limes.AvailabilityZone
}

AZResourceLocation is a tuple identifying an AZ resource within a project.

type ProjectResourceUpdate

type ProjectResourceUpdate struct {
	// A custom callback that will be called once for each resource in the given service.
	UpdateResource func(*db.ProjectResource) error
	// If nil, logg.Error is used. Unit tests should give t.Errorf here.
	LogError func(msg string, args ...any)
}

ProjectResourceUpdate describes an operation that updates resource data within a single project service.

func (ProjectResourceUpdate) Run

func (u ProjectResourceUpdate) Run(dbi db.Interface, cluster *core.Cluster, now time.Time, domain db.Domain, project db.Project, srv db.ServiceRef[db.ProjectServiceID]) ([]db.ProjectResource, error)

Run executes the given ProjectResourceUpdate operation:

  • Missing ProjectResource entries are created.
  • The `UpdateResource` callback is called for each resource to allow the caller to update resource data as necessary.

Jump to

Keyboard shortcuts

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