resourcecalculator

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 4 Imported by: 2 modules, 1 package

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

View Source
var Workspaces = []Workspace{Prod, Staging, Test, Dev}

Functions

func Accuracy

func Accuracy(v float64, accuracy int32) float64

func ByteToGibibyte

func ByteToGibibyte(v uint64, accuracy int32) float64

func CoreToMillcore

func CoreToMillcore(v float64) uint64

func GibibyteToByte

func GibibyteToByte(v float64) uint64

func MillcoreToCore

func MillcoreToCore(v uint64, accuracy int32) float64

func ResourceToString

func ResourceToString(res float64, typ string) string

func WorkspaceString

func WorkspaceString(workspace Workspace) string

func WorkspacesString

func WorkspacesString(workspaces []Workspace) []string

Types

type Calculator

type Calculator struct {
	ClusterName string
	// contains filtered or unexported fields
}

func New

func New(clusterName string) *Calculator

func (*Calculator) AddValue

func (c *Calculator) AddValue(cpu, mem uint64, workspace ...Workspace)

func (*Calculator) AllocatableCPU

func (c *Calculator) AllocatableCPU(workspace Workspace) uint64

func (*Calculator) AllocatableMem

func (c *Calculator) AllocatableMem(workspace Workspace) uint64

func (*Calculator) AlreadyTookUpCPU

func (c *Calculator) AlreadyTookUpCPU(workspace Workspace) uint64

func (*Calculator) AlreadyTookUpMem

func (c *Calculator) AlreadyTookUpMem(workspace Workspace) uint64

func (*Calculator) DeductionQuota

func (c *Calculator) DeductionQuota(workspace Workspace, cpu, mem uint64)

func (*Calculator) QuotableCPUForWorkspace

func (c *Calculator) QuotableCPUForWorkspace(workspace Workspace) uint64

func (*Calculator) QuotableMemForWorkspace

func (c *Calculator) QuotableMemForWorkspace(workspace Workspace) uint64

func (*Calculator) TotalQuotableCPU

func (c *Calculator) TotalQuotableCPU() uint64

func (*Calculator) TotalQuotableMem

func (c *Calculator) TotalQuotableMem() uint64

type ResourceCalculator

type ResourceCalculator struct {
	Type             string
	WorkspacesValues map[string]uint64
	// contains filtered or unexported fields
}

type Workspace

type Workspace int
const (
	Dev Workspace = iota
	Test
	Staging
	Prod
)

Jump to

Keyboard shortcuts

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