queue

package
v0.0.0-...-2371667 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2014 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Originally from https://github.com/bitly/nsq/blob/master/nsqd/diskqueue.go (f5d970b91db18993cb986e3c5085e0048788f7fe)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiskQueue

type DiskQueue struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

DiskQueue implements the Queue interface providing a filesystem backed FIFO queue

func (*DiskQueue) Close

func (d *DiskQueue) Close() error

Close cleans up the queue and persists metadata

func (*DiskQueue) Depth

func (d *DiskQueue) Depth() int64

Depth returns the depth of the queue

func (*DiskQueue) Empty

func (d *DiskQueue) Empty() error

Empty destructively clears out any pending data in the queue by fast forwarding read positions and removing intermediate files

func (*DiskQueue) Put

func (d *DiskQueue) Put(data []byte) error

Put writes a []byte to the queue

func (*DiskQueue) ReadChan

func (d *DiskQueue) ReadChan() chan []byte

ReadChan returns the []byte channel for reading data

type Queue

type Queue interface {
	Put([]byte) error
	ReadChan() chan []byte // this is expected to be an *unbuffered* channel
	Close() error
	Depth() int64
	Empty() error
}

Queue represents the behavior for the secondary message storage system

func NewDiskQueue

func NewDiskQueue(name string, dataPath string, maxBytesPerFile int64, syncEvery int64) Queue

NewDiskQueue instantiates a new instance of DiskQueue, retrieving metadata from the filesystem and starting the read ahead goroutine

Jump to

Keyboard shortcuts

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