mem

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	MaxQueuedMsg    int
	InflightExpiry  time.Duration
	ClientID        string
	DefaultNotifier queue.Notifier
}

Options is the options for the memory queue

type Queue

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

Queue is a memory backed queue store

func New

func New(opts Options) (*Queue, error)

New creates a new memory-backed queue store

func (*Queue) Add

func (q *Queue) Add(elem *queue.Elem) (err error)

Add adds a new element to the queue

func (*Queue) Clean

func (*Queue) Clean() error

Clean is a no-op in this implementation

func (*Queue) Close

func (q *Queue) Close() error

Close close the queue store

func (*Queue) Init

func (q *Queue) Init(opts *queue.InitOptions) error

Init initializes the queue store

func (*Queue) Read

func (q *Queue) Read(pids []packets.PacketID) (rs []*queue.Elem, err error)

Read reads elements with the specified packed ID

func (*Queue) ReadInflight

func (q *Queue) ReadInflight(maxSize uint) (rs []*queue.Elem, err error)

ReadInflight reads inflight elements from the queue

func (*Queue) Remove

func (q *Queue) Remove(pid packets.PacketID) error

Remove removes an element from the queue

func (*Queue) Replace

func (q *Queue) Replace(elem *queue.Elem) (replaced bool, err error)

Replace replaces an element in the queue

Jump to

Keyboard shortcuts

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