queue

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package queue implements a simple linked list based queue

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Operation

type Operation struct {
	UserID  int64
	ImgPath string
	Config  primitive.Config
}

Operation object contains information needed to create primitive image.

type Queue

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

Queue represents a linked list based queue. It contains Operation objects.

func New

func New() *Queue

New returns an initialized queue.

func (*Queue) Dequeue

func (q *Queue) Dequeue() (Operation, bool)

Dequeue removes first element of the queue and returns it. If the queue is empty then second return parameter will be equal to false.

func (*Queue) Enqueue

func (q *Queue) Enqueue(v Operation) int

Enqueue adds element v to the end of the queue and returns its position.

func (*Queue) GetNumOperations

func (q *Queue) GetNumOperations(userID int64) int

GetNumOperations returns the number of operations with specified userID that are currently in the queue.

func (*Queue) GetOperations

func (q *Queue) GetOperations(userID int64) ([]Operation, []int)

GetOperations returns operation with the given chatID and also the slice which contains positions of these operations.

func (*Queue) Peek

func (q *Queue) Peek() (Operation, bool)

Peek returns first element of the queue. If the queue is empty then second return parameter will be equal to false.

Jump to

Keyboard shortcuts

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