port_allocator

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2016 License: Apache-2.0 Imports: 6 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 OverwriteableFile

type OverwriteableFile interface {
	io.Reader
	io.Writer
	io.Seeker
	Truncate(size int64) error
}

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 serializer
	Locker     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 Serializer

type Serializer struct{}

func (*Serializer) DecodeAll

func (s *Serializer) DecodeAll(file io.ReadSeeker, outData interface{}) error

func (*Serializer) EncodeAndOverwrite

func (s *Serializer) EncodeAndOverwrite(file OverwriteableFile, outData interface{}) error

type Tracker

type Tracker struct {
	Logger    lager.Logger
	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