rouge

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client Basic client class to group Redis functions

func NewRougeClient

func NewRougeClient() (*Client, error)

func (*Client) AddTask

func (red *Client) AddTask(queueID string, task TaskMessage) (int, error)

AddTask adds a new task to a queue.

func (*Client) AddTaskFromString

func (red *Client) AddTaskFromString(queueID string, message string) (int, error)

AddTaskFromString converts a plain string to a task and puts it on the queue

func (*Client) AddTasksFromFile

func (red *Client) AddTasksFromFile(queueID, filePath string) (queueLength int, count int, err error)

AddTasksFromFile is a function for loading from a file

func (*Client) ClearQueue

func (red *Client) ClearQueue(queueID string) (bool, error)

ClearQueue deletes everything belonging to a given queue.

func (*Client) Complete

func (red *Client) Complete(queueID string, taskID string) (bool, error)

Complete marks the item as completed.

func (*Client) Fail added in v0.4.2

func (red *Client) Fail(queueID string, taskID string) (bool, error)

Fail marks the item as completed.

func (*Client) Heartbeat

func (red *Client) Heartbeat(queueID string, taskID string, expirationSec int32) (int, error)

Heartbeat updates the status of a message

func (*Client) Info

func (red *Client) Info() (string, error)

Info just returns some information about the redis server. We also use it as a health check

func (*Client) ListQueues added in v0.5.0

func (red *Client) ListQueues() (map[string]QueueInfo, error)

ListQueues is implemented in GRPC

func (*Client) Load

func (red *Client) Load(ctx context.Context, queueID string, expirationSec int) (TaskMessage, error)

Load loads a message from the queue, and mark it as processing

func (*Client) Peek

func (red *Client) Peek(queueID, phase string, limit int) (int, []TaskMessage, error)

Peek gets a list of the most or least recent items from a given queue and queue phase

func (*Client) Progress

func (red *Client) Progress(queueID string) (QueueInfo, error)

Progress gets the status of the current lists in the queue

func (*Client) SlimLoad

func (red *Client) SlimLoad(ctx context.Context, queueID string, expirationSec int) (TaskMessage, error)

SlimLoad loads a message from the queue in a lean way. For debugging

type QueueInfo

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

QueueInfo is a type meant for representing progress

func (*QueueInfo) ToBuff

func (obj *QueueInfo) ToBuff() *pb.QueueProgress

ToBuff converts a QueueInfo object to it's protobuf representation

func (*QueueInfo) ToString

func (obj *QueueInfo) ToString() string

ToString converts a QueueInfo object to string

type TaskMessage

type TaskMessage struct {
	ID   string   `json:"id"`
	Body string   `json:"body"`
	Envs []string `json:"envs"`
}

TaskMessage is the 'message' format used on our queue

func (*TaskMessage) FromString

func (t *TaskMessage) FromString(ts string) (*TaskMessage, error)

FromString makes a TaskMessage from a string

func (*TaskMessage) ToString

func (t *TaskMessage) ToString() string

ToString converts a taskMessage to a string

Jump to

Keyboard shortcuts

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