idpool

package
v0.0.0-...-810cf82 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2019 License: MIT Imports: 0 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

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

Pool keeps track of uint64 identifiers.

Caller is reponsible for locking.

func (*Pool) Get

func (p *Pool) Get() uint64

Get returns an available id from the pool.

Get panics if the pool is exhausted; 2**64 should be enough for everyone.

func (*Pool) Put

func (p *Pool) Put(id uint64)

Put returns an id to the pool.

func (*Pool) SetMinimum

func (p *Pool) SetMinimum(min uint64)

SetMinimum sets the minimum value that will be returned. This is useful for reserving some ids for special use.

Jump to

Keyboard shortcuts

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