driver

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NilID = ID(ulid.Nil)

NilID is a special ID.

Functions

This section is empty.

Types

type ID

type ID ulid.ULID

ID represents a unique ID for a message.

func NewID

func NewID() (ID, error)

NewID returns a new id.

func NewIDFromString

func NewIDFromString(s string) (ID, error)

NewIDFromString returns a new id based on the string s, which should be a ULID.

func (ID) Hash

func (id ID) Hash() uint32

Hash returns a hash of id.

func (ID) String

func (id ID) String() string

String returns a string representation of id.

type Interface

type Interface interface {
	// DriverName returns the name associated with this driver.
	DriverName() string
	// Delete deletes the queue with the given name.
	Delete(context.Context, string) error
	// Len returns the number of messages in the queue with the given name
	// that are not awaiting acknowledgement.
	Len(context.Context, string) (int, error)
	// Get returns the ID and content of the next message from the queue
	// with the given name. The message will be automatically requeued if
	// it is not acknowledged or refreshed by the returned time.
	Get(context.Context, string) (ID, []byte, time.Time, error)
	// Put places a message with the given content on the queue with the
	// given name.
	Put(context.Context, string, []byte) error
	// Refresh gets a new expiry time for the message with the given ID.
	Refresh(context.Context, ID) (time.Time, error)
	// Acknowledge removes the message with the given ID from its queue.
	Acknowledge(context.Context, ID) error
	// Requeue requeues the message with the given ID.
	Requeue(context.Context, ID) error
}

Interface is the interface satisfied by a queuing system.

Jump to

Keyboard shortcuts

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