resourcecalculator

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

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