utils

package
v0.0.0-...-ba7b697 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type MatchQueue

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

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

func NewQueue

func NewQueue() *MatchQueue

Creates a new pointer to a new queue.

func (*MatchQueue) Len

func (q *MatchQueue) Len() int

Returns the number of elements in the queue (i.e. size/length) go-routine safe.

func (*MatchQueue) Peek

func (q *MatchQueue) Peek() *models.Player

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. go-routine safe.

func (*MatchQueue) Poll

func (q *MatchQueue) Poll() *models.Player

Returns the value at the front of the queue. i.e. the oldest value in the queue. Note: this function does mutate the queue. go-routine safe.

func (*MatchQueue) PollInsert

func (q *MatchQueue) PollInsert(player *models.Player) *models.Player

Adds to queue only if que is empty, otherwise returns leading value

func (*MatchQueue) Push

func (q *MatchQueue) Push(player *models.Player)

Pushes/inserts a value at the end/tail of the queue. Note: this function does mutate the queue. go-routine safe.

Jump to

Keyboard shortcuts

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