port_allocator

package
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 30, 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 FileLocker added in v1.13.0

type FileLocker interface {
	filelock.FileLocker
}

type LockedFile added in v1.13.0

type LockedFile interface {
	filelock.LockedFile
}

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 added in v0.3.0

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