redis

package
v0.0.0-...-0001d10 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrScriptNotFound = errors.New("script not found")
	ErrQueueNotFound  = errors.New("queue not found")
	ErrOpNotOk        = errors.New("operation did not return OK")
)

Functions

func IsErrDeserialize

func IsErrDeserialize(err error) bool

func IsErrRedisExec

func IsErrRedisExec(err error) bool

func IsErrScriptLoad

func IsErrScriptLoad(err error) bool

func IsErrSerialize

func IsErrSerialize(err error) bool

Types

type Client

type Client interface {
	Eval(script string, keys []string, args ...interface{}) *redis.Cmd
	Exists(key ...string) *redis.IntCmd
}

Client is the interface to the redis client used implementing the methods used by the MQueue implementation

type ClusterProps

type ClusterProps struct {
	Props

	// Addrs is a seed list of host:post for the redis
	// cluster instances
	Addrs []string
}

type ErrDeserialize

type ErrDeserialize struct {
	Cause error
}

func (ErrDeserialize) Error

func (e ErrDeserialize) Error() string

type ErrRedisExec

type ErrRedisExec struct {
	Cause error
}

func (ErrRedisExec) Error

func (e ErrRedisExec) Error() string

type ErrScriptLoad

type ErrScriptLoad struct {
	Cause error
}

func (ErrScriptLoad) Error

func (e ErrScriptLoad) Error() string

type ErrSerialize

type ErrSerialize struct {
	Cause error
}

func (ErrSerialize) Error

func (e ErrSerialize) Error() string

type MQueue

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

MQueue implements the messaging queue functionality required from the mqueue package using Redis as a backend

func NewClusterMQueue

func NewClusterMQueue(props ClusterProps) (*MQueue, error)

NewClusterMQueue creates a new instance of a redis client ready to be used against a redis cluster

func NewSingleMQueue

func NewSingleMQueue(props SingleInstanceProps) (*MQueue, error)

NewSingleMQueue creates a new instance of a redis client ready to be used against a single instance of redis

func (*MQueue) Discard

func (m *MQueue) Discard(ctx context.Context, req core.DiscardRequest) error

func (*MQueue) Exists

func (m *MQueue) Exists(ctx context.Context, req core.ExistsRequest) (bool, error)

func (*MQueue) Insert

func (m *MQueue) Insert(ctx context.Context, req core.InsertRequest) error

func (*MQueue) Name

func (m *MQueue) Name() string

func (*MQueue) Next

func (m *MQueue) Next(ctx context.Context, req core.NextRequest) (uint64, error)

func (*MQueue) Remove

func (m *MQueue) Remove(ctx context.Context, req core.RemoveRequest) error

func (*MQueue) Retrieve

func (m *MQueue) Retrieve(ctx context.Context, req core.RetrieveRequest) (core.Elements, error)

func (*MQueue) Stats

func (m *MQueue) Stats() stats.Metrics

type Props

type Props struct {
	Context context.Context
	Logger  log.Logger
}

type SingleInstanceProps

type SingleInstanceProps struct {
	Props

	// Addr is the address of the redis instance used to connect
	Addr string
}

Jump to

Keyboard shortcuts

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