utils

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

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

Go to latest
Published: Apr 17, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Buffer

func Buffer(name string, inbox <-chan interface{}, closing <-chan struct{}) <-chan interface{}

Buffer creates a memory based buffer of messages that grows exponentially as necessary.

func GetIPAddrDebugString

func GetIPAddrDebugString() string

GetIPAddrDebugString gives a machine itentifiying string

func RandString

func RandString(n int) string

RandString returns a random string of size n

func RandUint64

func RandUint64() uint64

RandUint64 returns a random Uint64

Types

type Queue

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

A Queue is a go-routine safe FIFO (first in first out) data stucture.

func NewQueue

func NewQueue() *Queue

NewQueue creates a new pointer to a new queue.

func (*Queue) Len

func (q *Queue) Len() int

Len returns the number of elements in the queue (i.e. size/length)

func (*Queue) Peek

func (q *Queue) Peek() interface{}

Peek returns a read value at the front of the queue.

i.e. the oldest value in the queue.
Note: this function does NOT mutate the queue.

func (*Queue) Poll

func (q *Queue) Poll() interface{}

Poll returns the value at the front of the queue.

i.e. the oldest value in the queue.
Note: this function does mutate the queue.

func (*Queue) Push

func (q *Queue) Push(item interface{})

Push inserts a value at the end/tail of the queue.

Note: this function does mutate the queue.

Jump to

Keyboard shortcuts

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