portallocator

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupRuntimePortAllocator

func SetupRuntimePortAllocator(client client.Client, pr *net.PortRange, getReservedPorts func(client client.Client) (ports []int, err error))

SetupRuntimePortAllocator instantiates the global singleton rpa

Types

type RuntimePortAllocator

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

RuntimePortAllocator is an allocator resonsible for maintaining port usage information given a user-defined port range. It allocates and releases ports when a port is requested or reclaimed by a runtime.

func GetRuntimePortAllocator

func GetRuntimePortAllocator() (*RuntimePortAllocator, error)

GetRuntimePortAllocator restore the port allocator and gets the global singleton. This should be the only way others access the RuntimePortAllocator and it must be called after SetupRuntimePortAllocator

func (*RuntimePortAllocator) GetAvailablePorts

func (alloc *RuntimePortAllocator) GetAvailablePorts(portNum int) (ports []int, err error)

GetAvailablePorts requests portNum ports from the port allocator. It returns an int array with allocated ports in it.

func (*RuntimePortAllocator) ReleaseReservedPorts

func (alloc *RuntimePortAllocator) ReleaseReservedPorts(ports []int)

ReleaseReservedPorts releases all the ports in the given int array.

Jump to

Keyboard shortcuts

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