state

package
v1.23.17 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	// NUMAAffinity contains the string that represents NUMA affinity bitmask
	NUMAAffinity []int           `json:"numaAffinity"`
	Type         v1.ResourceName `json:"type"`
	Size         uint64          `json:"size"`
}

Block is a data structure used to represent a certain amount of memory

type ContainerMemoryAssignments

type ContainerMemoryAssignments map[string]map[string][]Block

ContainerMemoryAssignments stores memory assignments of containers

func (ContainerMemoryAssignments) Clone

Clone returns a copy of ContainerMemoryAssignments

type MemoryManagerCheckpoint

type MemoryManagerCheckpoint struct {
	PolicyName   string                     `json:"policyName"`
	MachineState NUMANodeMap                `json:"machineState"`
	Entries      ContainerMemoryAssignments `json:"entries,omitempty"`
	Checksum     checksum.Checksum          `json:"checksum"`
}

MemoryManagerCheckpoint struct is used to store memory/pod assignments in a checkpoint

func NewMemoryManagerCheckpoint

func NewMemoryManagerCheckpoint() *MemoryManagerCheckpoint

NewMemoryManagerCheckpoint returns an instance of Checkpoint

func (*MemoryManagerCheckpoint) MarshalCheckpoint

func (mp *MemoryManagerCheckpoint) MarshalCheckpoint() ([]byte, error)

MarshalCheckpoint returns marshalled checkpoint

func (*MemoryManagerCheckpoint) UnmarshalCheckpoint

func (mp *MemoryManagerCheckpoint) UnmarshalCheckpoint(blob []byte) error

UnmarshalCheckpoint tries to unmarshal passed bytes to checkpoint

func (*MemoryManagerCheckpoint) VerifyChecksum

func (mp *MemoryManagerCheckpoint) VerifyChecksum() error

VerifyChecksum verifies that current checksum of checkpoint is valid

type MemoryTable

type MemoryTable struct {
	TotalMemSize   uint64 `json:"total"`
	SystemReserved uint64 `json:"systemReserved"`
	Allocatable    uint64 `json:"allocatable"`
	Reserved       uint64 `json:"reserved"`
	Free           uint64 `json:"free"`
}

MemoryTable contains memory information

type NUMANodeMap

type NUMANodeMap map[int]*NUMANodeState

NUMANodeMap contains memory information for each NUMA node.

func (NUMANodeMap) Clone

func (nm NUMANodeMap) Clone() NUMANodeMap

Clone returns a copy of NUMANodeMap

type NUMANodeState

type NUMANodeState struct {
	// NumberOfAssignments contains a number memory assignments from this node
	// When the container requires memory and hugepages it will increase number of assignments by two
	NumberOfAssignments int `json:"numberOfAssignments"`
	// MemoryTable contains NUMA node memory related information
	MemoryMap map[v1.ResourceName]*MemoryTable `json:"memoryMap"`
	// Cells contains the current NUMA node and all other nodes that are in a group with current NUMA node
	// This parameter indicates if the current node is used for the multiple NUMA node memory allocation
	// For example if some container has pinning 0,1,2, NUMA nodes 0,1,2 under the state will have
	// this parameter equals to [0, 1, 2]
	Cells []int `json:"cells"`
}

NUMANodeState contains NUMA node related information

type Reader

type Reader interface {
	// GetMachineState returns Memory Map stored in the State
	GetMachineState() NUMANodeMap
	// GetMemoryBlocks returns memory assignments of a container
	GetMemoryBlocks(podUID string, containerName string) []Block
	// GetMemoryAssignments returns ContainerMemoryAssignments
	GetMemoryAssignments() ContainerMemoryAssignments
}

Reader interface used to read current memory/pod assignment state

type State

type State interface {
	Reader
	// contains filtered or unexported methods
}

State interface provides methods for tracking and setting memory/pod assignment

func NewCheckpointState

func NewCheckpointState(stateDir, checkpointName, policyName string) (State, error)

NewCheckpointState creates new State for keeping track of memory/pod assignment with checkpoint backend

func NewMemoryState

func NewMemoryState() State

NewMemoryState creates new State for keeping track of cpu/pod assignment

Jump to

Keyboard shortcuts

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