indexallocator

package
v1.49.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexRangeStart = 1
	IndexRangeEnd   = 512
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IndexAllocator

type IndexAllocator struct {
	IsLeader bool

	Client client.Client
	// contains filtered or unexported fields
}

IndexAllocator manages allocation of 1-512 temporary indices for Pod-to-DevicePlugin communication Uses a simple atomic counter that increments from 1 to 512, then wraps around to 1 No bitmap tracking needed - index reuse is acceptable after 512 cycles

func NewIndexAllocator

func NewIndexAllocator(ctx context.Context, client client.Client) (*IndexAllocator, error)

func (*IndexAllocator) AssignIndex

func (s *IndexAllocator) AssignIndex(podName string) (int, error)

AssignIndex assigns a temporary index (1-512) for Pod-to-DevicePlugin communication Uses atomic increment to ensure thread-safe assignment Index wraps around from 512 to 1 (simple modulo operation)

func (*IndexAllocator) SetupWithManager

func (s *IndexAllocator) SetupWithManager(ctx context.Context, mgr manager.Manager) <-chan struct{}

Jump to

Keyboard shortcuts

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