jobqueue

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 jobqueue 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 JobQueue

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

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

func New

func New() *JobQueue

New creates a new instance of a JobQueue.

func (*JobQueue) Close

func (ic *JobQueue) Close()

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

func (*JobQueue) In

func (ic *JobQueue) In() chan<- *jobpacket.JobPacket

In returns input channel for writing JobPackets.

func (*JobQueue) Len

func (ic *JobQueue) Len() int64

Len returns number of elements in the queue.

func (*JobQueue) Out

func (ic *JobQueue) Out() <-chan *jobpacket.JobPacket

Out returns output channel for reading JobPackets.

Jump to

Keyboard shortcuts

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