nsqd

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2017 License: BSD-2-Clause-Views Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const MsgIDLength = 16

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendQueue

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

BackendQueue represents the behavior for the secondary message storage system

func NewDiskQueue

func NewDiskQueue(name string, dataPath string, maxBytesPerFile int64, syncEvery int64, syncTimeout time.Duration) BackendQueue

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

type DiskQueue

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

DiskQueue implements the BackendQueue 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) Delete

func (d *DiskQueue) Delete() error

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 Message

type Message struct {
	ID        MessageID
	Body      []byte
	Timestamp int64
	Attempts  uint16
	// contains filtered or unexported fields
}

func NewMessage

func NewMessage(id MessageID, body []byte) *Message

func (*Message) WriteTo

func (m *Message) WriteTo(w io.Writer) (int64, error)

type MessageID

type MessageID [MsgIDLength]byte

Jump to

Keyboard shortcuts

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