redis

package
v0.0.0-...-634f8b5 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cnf *config.Config, host, password, socketPath string, db int) iface.Backend

New creates Backend instance

func NewGR

func NewGR(cnf *config.Config, addrs []string, db int) iface.Backend

NewGR creates Backend instance

Types

type Backend

type Backend struct {
	common.Backend

	common.RedisConnector
	// contains filtered or unexported fields
}

Backend represents a Redis result backend

func (*Backend) GetState

func (b *Backend) GetState(taskUUID string) (*tasks.TaskState, error)

GetState returns the latest task state

func (*Backend) GroupCompleted

func (b *Backend) GroupCompleted(groupUUID string, groupTaskCount int) (bool, error)

GroupCompleted returns true if all tasks in a group finished

func (*Backend) GroupTaskStates

func (b *Backend) GroupTaskStates(groupUUID string, groupTaskCount int) ([]*tasks.TaskState, error)

GroupTaskStates returns states of all tasks in the group

func (*Backend) InitGroup

func (b *Backend) InitGroup(groupUUID string, taskUUIDs []string) error

InitGroup creates and saves a group meta data object

func (*Backend) PurgeGroupMeta

func (b *Backend) PurgeGroupMeta(groupUUID string) error

PurgeGroupMeta deletes stored group meta data

func (*Backend) PurgeState

func (b *Backend) PurgeState(taskUUID string) error

PurgeState deletes stored task state

func (*Backend) SetStateFailure

func (b *Backend) SetStateFailure(signature *tasks.Signature, err string) error

SetStateFailure updates task state to FAILURE

func (*Backend) SetStatePending

func (b *Backend) SetStatePending(signature *tasks.Signature) error

SetStatePending updates task state to PENDING

func (*Backend) SetStateReceived

func (b *Backend) SetStateReceived(signature *tasks.Signature) error

SetStateReceived updates task state to RECEIVED

func (*Backend) SetStateRetry

func (b *Backend) SetStateRetry(signature *tasks.Signature) error

SetStateRetry updates task state to RETRY

func (*Backend) SetStateStarted

func (b *Backend) SetStateStarted(signature *tasks.Signature) error

SetStateStarted updates task state to STARTED

func (*Backend) SetStateSuccess

func (b *Backend) SetStateSuccess(signature *tasks.Signature, results []*tasks.TaskResult) error

SetStateSuccess updates task state to SUCCESS

func (*Backend) TriggerChord

func (b *Backend) TriggerChord(groupUUID string) (bool, error)

TriggerChord flags chord as triggered in the backend storage to make sure chord is never trigerred multiple times. Returns a boolean flag to indicate whether the worker should trigger chord (true) or no if it has been triggered already (false)

type BackendGR

type BackendGR struct {
	common.Backend
	// contains filtered or unexported fields
}

BackendGR represents a Redis result backend

func (*BackendGR) GetState

func (b *BackendGR) GetState(taskUUID string) (*tasks.TaskState, error)

GetState returns the latest task state

func (*BackendGR) GroupCompleted

func (b *BackendGR) GroupCompleted(groupUUID string, groupTaskCount int) (bool, error)

GroupCompleted returns true if all tasks in a group finished

func (*BackendGR) GroupTaskStates

func (b *BackendGR) GroupTaskStates(groupUUID string, groupTaskCount int) ([]*tasks.TaskState, error)

GroupTaskStates returns states of all tasks in the group

func (*BackendGR) InitGroup

func (b *BackendGR) InitGroup(groupUUID string, taskUUIDs []string) error

InitGroup creates and saves a group meta data object

func (*BackendGR) PurgeGroupMeta

func (b *BackendGR) PurgeGroupMeta(groupUUID string) error

PurgeGroupMeta deletes stored group meta data

func (*BackendGR) PurgeState

func (b *BackendGR) PurgeState(taskUUID string) error

PurgeState deletes stored task state

func (*BackendGR) SetStateFailure

func (b *BackendGR) SetStateFailure(signature *tasks.Signature, err string) error

SetStateFailure updates task state to FAILURE

func (*BackendGR) SetStatePending

func (b *BackendGR) SetStatePending(signature *tasks.Signature) error

SetStatePending updates task state to PENDING

func (*BackendGR) SetStateReceived

func (b *BackendGR) SetStateReceived(signature *tasks.Signature) error

SetStateReceived updates task state to RECEIVED

func (*BackendGR) SetStateRetry

func (b *BackendGR) SetStateRetry(signature *tasks.Signature) error

SetStateRetry updates task state to RETRY

func (*BackendGR) SetStateStarted

func (b *BackendGR) SetStateStarted(signature *tasks.Signature) error

SetStateStarted updates task state to STARTED

func (*BackendGR) SetStateSuccess

func (b *BackendGR) SetStateSuccess(signature *tasks.Signature, results []*tasks.TaskResult) error

SetStateSuccess updates task state to SUCCESS

func (*BackendGR) TriggerChord

func (b *BackendGR) TriggerChord(groupUUID string) (bool, error)

TriggerChord flags chord as triggered in the backend storage to make sure chord is never trigerred multiple times. Returns a boolean flag to indicate whether the worker should trigger chord (true) or no if it has been triggered already (false)

Jump to

Keyboard shortcuts

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