redis

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package redis provides the ability for Vela to integrate with a Redis server as a queue backend.

Usage:

import "github.com/go-vela/server/queue/redis"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v0.27.0

type Client struct {
	Redis   *redis.Client
	Options *redis.Options

	settings.Queue

	// https://pkg.go.dev/github.com/sirupsen/logrus#Entry
	Logger *logrus.Entry
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, opts ...ClientOpt) (*Client, error)

New returns a Queue implementation that integrates with a Redis queue instance.

func NewTest

func NewTest(signingPrivateKey, signingPublicKey string, routes ...string) (*Client, error)

NewTest returns a Queue implementation that integrates with a local Redis instance.

It's possible to override this with env variables, which gets used as a part of integration testing with the different supported backends.

This function is intended for running tests only.

func (*Client) Driver added in v0.27.0

func (c *Client) Driver() string

Driver outputs the configured queue driver.

func (*Client) GetSettings added in v0.27.0

func (c *Client) GetSettings() settings.Queue

GetSettings retrieves the api settings type in the Engine.

func (*Client) Length added in v0.27.0

func (c *Client) Length(ctx context.Context) (int64, error)

Length tallies all items present in the configured routes in the queue.

func (*Client) Ping added in v0.27.0

func (c *Client) Ping(ctx context.Context) error

Ping contacts the queue to test its connection.

func (*Client) Pop added in v0.27.0

func (c *Client) Pop(ctx context.Context, inRoutes []string) (*models.Item, error)

Pop grabs an item from the specified route off the queue.

func (*Client) Push added in v0.27.0

func (c *Client) Push(ctx context.Context, route string, item []byte) error

Push inserts an item to the specified route in the queue.

func (*Client) Route added in v0.27.0

func (c *Client) Route(w *pipeline.Worker) (string, error)

Route decides which route a build gets placed within the queue.

func (*Client) RouteLength added in v0.27.0

func (c *Client) RouteLength(ctx context.Context, route string) (int64, error)

RouteLength returns count of all items present in the given route.

func (*Client) SetSettings added in v0.27.0

func (c *Client) SetSettings(s *settings.Platform)

SetSettings sets the api settings type in the Engine.

type ClientOpt added in v0.11.0

type ClientOpt func(*Client) error

ClientOpt represents a configuration option to initialize the queue client for Redis.

func WithAddress added in v0.11.0

func WithAddress(address string) ClientOpt

WithAddress sets the address in the queue client for Redis.

func WithCluster added in v0.11.0

func WithCluster(cluster bool) ClientOpt

WithCluster sets the clustering mode in the queue client for Redis.

func WithPrivateKey added in v0.21.0

func WithPrivateKey(key string) ClientOpt

WithPrivateKey sets the private key in the queue client for Redis.

func WithPublicKey added in v0.21.0

func WithPublicKey(key string) ClientOpt

WithPublicKey sets the public key in the queue client for Redis.

func WithRoutes added in v0.24.0

func WithRoutes(routes ...string) ClientOpt

WithRoutes sets the routes in the queue client for Redis.

func WithTimeout added in v0.11.0

func WithTimeout(timeout time.Duration) ClientOpt

WithTimeout sets the timeout in the queue client for Redis.

Jump to

Keyboard shortcuts

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