storage

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RetryKey         = "goretry"
	ScheduledJobsKey = "schedule"
)

TODO(wtlangford): Check if the value of these keys are Sidekiq-compatible

View Source
const (
	NoMessage = StorageError("no message")
)

list of known errors

Variables

This section is empty.

Functions

This section is empty.

Types

type Retries

type Retries struct {
	TotalRetryCount int64
	RetryJobs       []string
}

Retries has the list of messages in the retry queue

type Stats

type Stats struct {
	Processed  int64
	Failed     int64
	RetryCount int64
	Enqueued   map[string]int64
}

Stats has all the stats related to a manager

type StorageError

type StorageError string

StorageError is used to return errors from the storage layer

func (StorageError) Error

func (e StorageError) Error() string

type Store

type Store interface {

	// General queue operations
	CreateQueue(ctx context.Context, queue string) error
	ListMessages(ctx context.Context, queue string) ([]string, error)
	AcknowledgeMessage(ctx context.Context, queue string, message string) error
	EnqueueMessage(ctx context.Context, queue string, priority float64, message string) error
	EnqueueMessageNow(ctx context.Context, queue string, message string) error
	DequeueMessage(ctx context.Context, queue string, inprogressQueue string, timeout time.Duration) (string, error)

	// Special purpose queue operations
	EnqueueScheduledMessage(ctx context.Context, priority float64, message string) error
	DequeueScheduledMessage(ctx context.Context, priority float64) (string, error)

	EnqueueRetriedMessage(ctx context.Context, priority float64, message string) error
	DequeueRetriedMessage(ctx context.Context, priority float64) (string, error)

	// Stats
	IncrementStats(ctx context.Context, metric string) error
	GetAllStats(ctx context.Context, queues []string) (*Stats, error)

	// Retries
	GetAllRetries(ctx context.Context) (*Retries, error)
}

Store is the interface for storing and retrieving data

func NewRedisStore

func NewRedisStore(namespace string, client *redis.Client, logger *log.Logger) Store

NewRedisStore returns a new Redis store with the given namespace and preconfigured client

Jump to

Keyboard shortcuts

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