util

package
v0.0.0-...-9da2307 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug *log.Logger
	Info  *log.Logger
	Warn  *log.Logger
	Error *log.Logger
)

Functions

func NewUUID4

func NewUUID4() string

Types

type HandlePool

type HandlePool struct {
	bitset.BitSet
}

HandlePool is used to contain a sequential list of integer handles. Storage is a bit set.

func NewHandlePool

func NewHandlePool(size uint) *HandlePool

NewHandlePool returns a new handle pool with size entries available.

func (*HandlePool) Acquire

func (handles *HandlePool) Acquire() (int, error)

Acquire returns the lowest available id in the pool, or error if exhausted.

func (*HandlePool) Release

func (handles *HandlePool) Release(handle int)

Release returns the id back into the pool

type UUIDEncrypter

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

UUIDEncrypter allows binary data up to the block size (16 bytes) to be encoded and used as a key (uuid).

var Encrypter *UUIDEncrypter

func NewUUIDEncrypter

func NewUUIDEncrypter() (*UUIDEncrypter, error)

func (*UUIDEncrypter) DecodePair

func (u *UUIDEncrypter) DecodePair(uuid string) (int, int, error)

DecodePair takes a uuid string created by EncodePair and reverses that into the original pair of ints.

func (*UUIDEncrypter) EncodePair

func (u *UUIDEncrypter) EncodePair(a, b int) string

EncodePair takes a pair of ints and encodes them cryptographically as a uuid string

Jump to

Keyboard shortcuts

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