redis

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingMessageID = errors.New("missing message ID")
	ErrStatusNotFound   = errors.New("status not found")
	ErrMultipleStatuses = errors.New("multiple status keys found")
	ErrLockHeld         = errors.New("lock already held")
	ErrUnlockFailed     = errors.New("failed to release lock")
)

Functions

This section is empty.

Types

type Client

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

func New

func New(cfg Config) (*Client, error)

func (*Client) DeleteMessage added in v1.3.0

func (c *Client) DeleteMessage(ctx context.Context, id uuid.UUID) (err error)

DeleteMessage deletes the message and its status from Redis. It ensures the operation is atomic by acquiring a lock on the key.

func (*Client) GetMessage added in v1.5.1

func (c *Client) GetMessage(ctx context.Context, id uuid.UUID) (message.Message, error)

func (*Client) GetStatus

func (c *Client) GetStatus(ctx context.Context, id uuid.UUID) (message.Status, error)

func (*Client) ListMessageIDs added in v1.5.1

func (c *Client) ListMessageIDs(ctx context.Context, status message.Status) ([]uuid.UUID, error)

func (*Client) SetMessage

func (c *Client) SetMessage(ctx context.Context, msg message.Message) (err error)

SetMessage stores the message in Redis and updates its status. It ensures the operation is atomic by acquiring a lock on the key.

func (*Client) UpdateMessage

func (c *Client) UpdateMessage(ctx context.Context, msg message.Message) (err error)

UpdateMessage updates the status, retry count, and updated at of the message. It ensures the operation is atomic by acquiring a lock on the key.

type Config

type Config struct {
	URL     string
	LockTTL time.Duration
}

Jump to

Keyboard shortcuts

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