dirq

package
v0.0.0-...-57fcf6d Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Packge dirq provides a directory+files based multiple provider, single consumer persistent queue.

Index

Constants

This section is empty.

Variables

View Source
var ErrEmpty = errors.New("queue is empty")

Functions

This section is empty.

Types

type Queue

type Queue struct {
	Dir string
}

func New

func New(dir string) (Queue, error)

func (Queue) Dequeue

func (Q Queue) Dequeue(ctx context.Context, f func(context.Context, []byte) error) error

DequeueOne will call f on the first dequeueable message. The message will be deleted iff f returns nil, otherwise it remains in the queue.

func (Queue) Enqueue

func (Q Queue) Enqueue(p []byte) error

func (Queue) Watch

func (Q Queue) Watch(ctx context.Context, f func(context.Context, []byte) error) error

Dequeue all the incoming messages, continuously.

Calls DequeueOne when a new message arrives (based on notification).

Jump to

Keyboard shortcuts

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