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: 0

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