diskq

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEBUG = LogLevel(1)
	INFO  = LogLevel(2)
	WARN  = LogLevel(3)
	ERROR = LogLevel(4)
	FATAL = LogLevel(5)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppLogFunc

type AppLogFunc func(lvl LogLevel, f string, args ...interface{})

type DiskQueue

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

DiskQueue implements 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) PeekChan

func (d *DiskQueue) PeekChan() <-chan []byte

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 receive-only []byte channel for reading data

type Interface

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

func New

func New(opts ...Option) Interface

New instantiates an instance of DiskQueue, retrieving metadata from the filesystem and starting the read ahead goroutine

type LogLevel

type LogLevel int

func (LogLevel) String

func (l LogLevel) String() string

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithDataDIR

func WithDataDIR(dataDIR string) Option

func WithLogf

func WithLogf(logf AppLogFunc) Option

func WithMaxBytesPerFile

func WithMaxBytesPerFile(maxBytesPerFile int64) Option

func WithMaxMsgSize

func WithMaxMsgSize(maxMsgSize int32) Option

func WithMinMsgSize

func WithMinMsgSize(minMsgSize int32) Option

func WithName

func WithName(name string) Option

func WithSyncEvery

func WithSyncEvery(syncEvery int64) Option

func WithSyncTimeout

func WithSyncTimeout(syncTimeout time.Duration) Option

Jump to

Keyboard shortcuts

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