Documentation ¶
Index ¶
- type Mapping
- func (rm *Mapping) FirstGUID(resources Resources) *guid.GUID
- func (rm *Mapping) HigherRandGUID(currentGUID guid.GUID, targetResources Resources) (*guid.GUID, error)
- func (rm *Mapping) LowerRandGUID(currentGUID guid.GUID, targetResources Resources) (*guid.GUID, error)
- func (rm *Mapping) LowestResources() *Resources
- func (rm *Mapping) RandGUID(targetResources Resources) (*guid.GUID, error)
- func (rm *Mapping) ResourcesByGUID(resGUID guid.GUID) (*Resources, error)
- func (rm *Mapping) String() (res string)
- type ResourcePartition
- type Resources
- func (r *Resources) Add(resources Resources)
- func (r *Resources) AddCPU(cpus int)
- func (r *Resources) AddRAM(ram int)
- func (r *Resources) CPUs() int
- func (r *Resources) Contains(contained Resources) bool
- func (r *Resources) Copy() *Resources
- func (r *Resources) Equals(resources Resources) bool
- func (r *Resources) IsValid() bool
- func (r *Resources) IsZero() bool
- func (r *Resources) RAM() int
- func (r *Resources) SetCPUs(cpu int)
- func (r *Resources) SetRAM(ram int)
- func (r *Resources) SetTo(resources Resources)
- func (r *Resources) SetZero()
- func (r *Resources) String() string
- func (r *Resources) Sub(resources Resources)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mapping ¶
type Mapping struct {
// contains filtered or unexported fields
}
Mapping representation between the GUIDs and resources combinations. THREAD SAFE, because it is not expected to dynamic mapping of resources.
func NewResourcesMap ¶
func NewResourcesMap(cpuPartitionsPerc []ResourcePartition, ramPartitionsPerc []ResourcePartition) *Mapping
Creates a new resource map given the CPUs and RAM partitions and the respective GUID distributions.
func (*Mapping) HigherRandGUID ¶
func (rm *Mapping) HigherRandGUID(currentGUID guid.GUID, targetResources Resources) (*guid.GUID, error)
Returns a random GUID in the next range of resources. First it tries the GUIDs that represent the SAME cpus and MORE ram. Second it tries the GUIDs that represent the MORE cpus and SAME ram. Lastly it will try the GUIDs that represent the MORE cpus and MORE ram.
func (*Mapping) LowerRandGUID ¶
func (rm *Mapping) LowerRandGUID(currentGUID guid.GUID, targetResources Resources) (*guid.GUID, error)
Returns a random GUID in the previous range of resources. First it tries the GUIDs that represent the SAME cpus and LESS ram. Second it tries the GUIDs that represent the LESS cpus and SAME ram. Lastly it will try the GUIDs that represent the LESS cpus and LESS ram.
func (*Mapping) LowestResources ¶
Obtain the lowest resource combination available.
func (*Mapping) RandGUID ¶
Returns a random GUID in the range of the respective "fittest" target resource combination.
func (*Mapping) ResourcesByGUID ¶
Returns the resources combination that maps to the given GUID.
type ResourcePartition ¶
Partition of a given resource through a percentage.
func GetCpuCoresPartitions ¶
func GetCpuCoresPartitions(cpuCoresPartitions []configuration.CPUCoresPartition) []ResourcePartition
func GetRamPartitions ¶
func GetRamPartitions(ramPartitions []configuration.RAMPartition) []ResourcePartition
type Resources ¶
type Resources struct {
// contains filtered or unexported fields
}
Representation of the resources that a user can ask for a container to have available.
func NewResources ¶
Create a new resource combination object.