queue

package
v0.0.0-...-d26b62e Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IQueue

type IQueue interface {
	Enqueue(interface{})
	Dequeue() interface{}
	Length() int
}

type PlayerQueue

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

A Player queue works like a queue structure in an thread safe way.

func NewPlayer

func NewPlayer() *PlayerQueue

func (*PlayerQueue) Dequeue

func (q *PlayerQueue) Dequeue() *models.Player

Dequeue dequeues one player from the waiting queue

func (*PlayerQueue) Enqueue

func (q *PlayerQueue) Enqueue(player *models.Player)

Enqueue enqueues a player that is added to the lobby when a position is free

func (*PlayerQueue) Length

func (q *PlayerQueue) Length() int

type Queue

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

A Player queue works like a queue structure in an thread safe way.

func New

func New() *Queue

func (*Queue) Dequeue

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

Dequeue dequeues one player from the waiting queue

func (*Queue) Enqueue

func (q *Queue) Enqueue(player interface{})

Enqueue enqueues a player that is added to the lobby when a position is free

func (*Queue) Length

func (q *Queue) Length() int

type RemovalQueue

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

A Player queue works like a queue structure in an thread safe way.

func NewRemoval

func NewRemoval() *RemovalQueue

func (*RemovalQueue) Dequeue

func (q *RemovalQueue) Dequeue() *RemovalRequest

Dequeue dequeues one player from the waiting queue

func (*RemovalQueue) Enqueue

func (q *RemovalQueue) Enqueue(player *RemovalRequest)

Enqueue enqueues a player that is added to the lobby when a position is free

func (*RemovalQueue) Length

func (q *RemovalQueue) Length() int

type RemovalRequest

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

Jump to

Keyboard shortcuts

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