allocator

package
Version: v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound     = errors.New("number not allocated")
	ErrConflict     = errors.New("number already allocated")
	ErrInvalidRange = errors.New("invalid range")
	ErrOutOfRange   = errors.New("out of range")
	ErrRangeFull    = errors.New("range full")
	ErrInternal     = errors.New("internal error")
)

Functions

This section is empty.

Types

type MinMaxAllocator

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

func NewMinMaxAllocator

func NewMinMaxAllocator(min, max int) (*MinMaxAllocator, error)

func (*MinMaxAllocator) Allocate

func (a *MinMaxAllocator) Allocate(i int) (bool, error)

func (*MinMaxAllocator) AllocateNext

func (a *MinMaxAllocator) AllocateNext() (int, bool, error)

func (*MinMaxAllocator) Free

func (a *MinMaxAllocator) Free() int

func (*MinMaxAllocator) Has

func (a *MinMaxAllocator) Has(i int) bool

func (*MinMaxAllocator) Release

func (a *MinMaxAllocator) Release(i int) error

func (*MinMaxAllocator) SetRange

func (a *MinMaxAllocator) SetRange(min, max int) error

type Rangeable

type Rangeable interface {
	Allocate(int) (bool, error)
	AllocateNext() (int, bool, error)
	Release(int) error
	Has(int) bool
	Free() int
	SetRange(min, max int) error
}

Rangeable is an Interface that can adjust its min/max range. Rangeable should be threadsafe

Source Files

Jump to

Keyboard shortcuts

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