Skip to content

Add comments to AllocateBatch in pkg/ddc/base/portallocator/random_allocator.go. #5916

Description

@sleepyhead55

Which function do you want to add comments to?

AllocateBatch in pkg/ddc/base/portallocator/random_allocator.go.

What comments do you want to add?

// AllocateBatch attempts to allocate a batch of unique random ports from the allocator's port range.
// The number of ports to allocate is specified by portNum.
// It returns a slice of allocated port numbers and an error if allocation fails.
// An error is returned when portNum exceeds the total size of the port range.
// This method is concurrency-safe as it acquires a lock before modifying the port allocation state.
// Note: The allocated ports are not persisted; they are only stored in the local map to avoid duplicates within the same batch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions