requestqueue

package
v0.8.2 Latest Latest
Warning

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

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

Documentation

Overview

Package requestqueue is implemented based on eapache's infinite channel template: https://github.com/eapache/channels/blob/master/infinite_channel.go As explained by the author in documentation: https://godoc.org/github.com/eapache/channels due to Go's type system limitations direct import of his library is impractical. This reimplementation allows more type safety due to having more strict channel type than an empty interface. On top of better, even though slightly slower, queue as now it is thread-safe which is crucial as the queue can be read by multiple workers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RequestQueue

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

RequestQueue represents a seemingly 'infinite' (depending on available memory) FIFO queue working on CommandRequest items.

func New

func New() *RequestQueue

New creates a new instance of a RequestQueue.

func (*RequestQueue) Close

func (ic *RequestQueue) Close()

Close closes the input channel, however, output and hence the goroutine will be open until the queue is exhausted.

func (*RequestQueue) In

func (ic *RequestQueue) In() chan<- *commands.CommandRequest

In returns input channel for writing CommandRequests.

func (*RequestQueue) Len

func (ic *RequestQueue) Len() int64

Len returns number of elements in the queue.

func (*RequestQueue) Out

func (ic *RequestQueue) Out() <-chan *commands.CommandRequest

Out returns output channel for reading CommandRequests.

Jump to

Keyboard shortcuts

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