port_allocator

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorPortPoolExhausted = errors.New("port pool exhausted")

Functions

This section is empty.

Types

type Pool

type Pool struct {
	AcquiredPorts map[int]string
}

func (*Pool) MarshalJSON

func (p *Pool) MarshalJSON() ([]byte, error)

func (*Pool) UnmarshalJSON

func (p *Pool) UnmarshalJSON(bytes []byte) error

type PortAllocator

type PortAllocator struct {
	Tracker    tracker
	Serializer serial.Serializer
	Locker     filelock.FileLocker
}

func (*PortAllocator) AllocatePort

func (p *PortAllocator) AllocatePort(handle string, port int) (int, error)

func (*PortAllocator) ReleaseAllPorts

func (p *PortAllocator) ReleaseAllPorts(handle string) error

type Tracker

type Tracker struct {
	StartPort int
	Capacity  int
}

func (*Tracker) AcquireOne

func (t *Tracker) AcquireOne(pool *Pool, handler string) (int, error)

func (*Tracker) InRange

func (t *Tracker) InRange(port int) bool

func (*Tracker) ReleaseAll

func (t *Tracker) ReleaseAll(pool *Pool, handle string) error

Jump to

Keyboard shortcuts

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