resources

package
v0.0.0-...-10b4495 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUClassPartition

type CPUClassPartition struct {
	ResourcePartition
	// contains filtered or unexported fields
}

func (*CPUClassPartition) CPUCoresPartitions

func (c *CPUClassPartition) CPUCoresPartitions() []ResourcePartition

func (*CPUClassPartition) CPUCoresPercentages

func (c *CPUClassPartition) CPUCoresPercentages() []int

type CPUCoresPartition

type CPUCoresPartition struct {
	ResourcePartition
	// contains filtered or unexported fields
}

func (*CPUCoresPartition) MemoryPartitions

func (c *CPUCoresPartition) MemoryPartitions() []ResourcePartition

func (*CPUCoresPartition) MemoryPercentages

func (c *CPUCoresPartition) MemoryPercentages() []int

type Mapping

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

Mapping ...

func NewResourcesMap

func NewResourcesMap(partitions *ResourcePartitions, pseudoSuperPeer bool) *Mapping

NewResourcesMap creates a new resource map given the CPUs and Memory partitions and the respective GUID distributions.

func (*Mapping) FirstGUIDOffer

func (m *Mapping) FirstGUIDOffer(resources Resources) (*guid.GUID, error)

FirstGUIDOffer returns the first GUID that represents the given resources.

func (*Mapping) HigherRandGUIDSearch

func (m *Mapping) HigherRandGUIDSearch(currentGUID guid.GUID, targetResources Resources) (*guid.GUID, error)

HigherRandGUIDSearch returns a random GUID in the next range of resources. First it tries the GUIDs that represent the SAME cpus and MORE memory. Second it tries the GUIDs that represent the MORE cpus and SAME memory. Lastly it will try the GUIDs that represent the MORE cpus and MORE memory.

func (*Mapping) LowerPartitionsOffer

func (m *Mapping) LowerPartitionsOffer(availableResources Resources) ([]Resources, error)

LowerPartitionsOffer

func (*Mapping) LowerRandGUIDOffer

func (m *Mapping) LowerRandGUIDOffer(currentGUID guid.GUID, targetResources Resources) (*guid.GUID, error)

LowerRandGUIDOffer returns a random GUID in the previous range of resources. First it tries the GUIDs that represent the SAME cpus and LESS memory. Second it tries the GUIDs that represent the LESS cpus and SAME memory. Lastly it will try the GUIDs that represent the LESS cpus and LESS memory.

func (*Mapping) LowerRandGUIDSearch

func (m *Mapping) LowerRandGUIDSearch(currentGUID guid.GUID, targetResources Resources) (*guid.GUID, error)

func (*Mapping) LowestResources

func (m *Mapping) LowestResources() *Resources

LowestResources returns the lowest resource combination available.

func (*Mapping) RandGUIDFittestSearch

func (m *Mapping) RandGUIDFittestSearch(targetResources Resources) (*guid.GUID, error)

RandGUIDFittestSearch returns a random GUID in the range of the respective "fittest" target resource combination.

func (*Mapping) RandGUIDHighestSearch

func (m *Mapping) RandGUIDHighestSearch(targetResources Resources) (*guid.GUID, error)

func (*Mapping) RandGUIDOffer

func (m *Mapping) RandGUIDOffer(targetResources Resources) (*guid.GUID, error)

RandGUIDOffer returns a random GUID in the range of the respective "fittest" target resource combination.

func (*Mapping) ResourcesByGUID

func (m *Mapping) ResourcesByGUID(resGUID guid.GUID) *Resources

ResourcesByGUID returns the resources combination that maps to the given GUID.

func (*Mapping) SamePartitionResourcesSearch

func (m *Mapping) SamePartitionResourcesSearch(arg1 Resources, arg2 Resources) (bool, error)

type MemoryPartition

type MemoryPartition struct {
	ResourcePartition
}

type ResourcePartition

type ResourcePartition struct {
	Value      float64
	Percentage int
}

Partition of a given resource through a percentage.

type ResourcePartitions

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

func ObtainConfiguredPartitions

func ObtainConfiguredPartitions(configPartitions configuration.ResourcesPartitions) *ResourcePartitions

func (*ResourcePartitions) CPUClassPartitions

func (r *ResourcePartitions) CPUClassPartitions() []ResourcePartition

func (*ResourcePartitions) CPUClassPercentages

func (r *ResourcePartitions) CPUClassPercentages() []int

type Resources

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

FreeResources represent of the resources that a user can ask for a container to have available.

func NewResources

func NewResources(cpus int, memory int) *Resources

func NewResourcesCPUClass

func NewResourcesCPUClass(cpuClass int, cpus int, memory int) *Resources

NewResourcesCPUClass creates a new resource combination object.

func (*Resources) Add

func (r *Resources) Add(resources Resources)

Add adds a given combination of resources to the receiver.

func (*Resources) AddCPUs

func (r *Resources) AddCPUs(cpus int)

AddCPUs adds a given number of cpus to the resources.

func (*Resources) AddMemory

func (r *Resources) AddMemory(memory int)

AddMemory adds a given amount of memory to the resources.

func (*Resources) CPUClass

func (r *Resources) CPUClass() int

CPUClass getter.

func (*Resources) CPUs

func (r *Resources) CPUs() int

CPUs getter.

func (*Resources) Contains

func (r *Resources) Contains(contained Resources) bool

Contains returns true if the given resources are contained inside the receiver.

func (*Resources) Copy

func (r *Resources) Copy() *Resources

Copy returns a object that is a exact copy of the receiver.

func (*Resources) Equals

func (r *Resources) Equals(resources Resources) bool

Equals returns true if the given resource combination is equal to the receiver.

func (*Resources) IsNegative

func (r *Resources) IsNegative() bool

IsNegative return true if one of the resources has a negative amount.

func (*Resources) IsValid

func (r *Resources) IsValid() bool

IsValid return true if all resources are greater than 0.

func (*Resources) IsZero

func (r *Resources) IsZero() bool

IsZero returns true if the resources are zero, false otherwise.

func (*Resources) Memory

func (r *Resources) Memory() int

Memory getter.

func (*Resources) SetCPUClass

func (r *Resources) SetCPUClass(cpuClass int)

SetCPUClass CPU Class setter.

func (*Resources) SetCPUs

func (r *Resources) SetCPUs(cpu int)

SetCPUs CPUs setter.

func (*Resources) SetMemory

func (r *Resources) SetMemory(memory int)

SetMemory Memory setter.

func (*Resources) SetTo

func (r *Resources) SetTo(resources Resources)

SetTo sets the resources into a specific combination of resources.

func (*Resources) SetZero

func (r *Resources) SetZero()

SetZero sets the resources to zero.

func (*Resources) String

func (r *Resources) String() string

String stringify the receiver resources object.

func (*Resources) Sub

func (r *Resources) Sub(resources Resources)

Sub subtracts a given combination of resources to the receiver.

Jump to

Keyboard shortcuts

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