queue

package
v0.0.0-...-b1a8e8c Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 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 Embedded

type Embedded struct {
	Config EmbeddedConfig
	// contains filtered or unexported fields
}

Embedded is the Queue implementation using an in-memory circular buffer.

func NewEmbedded

func NewEmbedded(cfg EmbeddedConfig) *Embedded

func (*Embedded) Pop

func (e *Embedded) Pop(_ context.Context) ([]boltzmann.Task, error)

func (*Embedded) Push

func (e *Embedded) Push(_ context.Context, tasks ...boltzmann.Task) error

type EmbeddedConfig

type EmbeddedConfig struct {
	BufferSize int
	BatchSize  int
}

func NewEmbeddedConfig

func NewEmbeddedConfig() EmbeddedConfig

type Queue

type Queue interface {
	// Push appends a set of tasks into the queue. If FIFO, task will be appended at the tail. If LIFO, task will be appended
	// at the head.
	Push(ctx context.Context, task ...boltzmann.Task) error
	// Pop retrieves several tasks from the queue.
	Pop(ctx context.Context) ([]boltzmann.Task, error)
}

type RedisList

type RedisList struct {
	Client *redis.Client
	Codec  codec.Codec
	Config RedisListConfig
}

RedisList is the Redis implementation of queue.Service using redis lists (First-In First-Out or Last-In First-Out).

func NewRedisList

func NewRedisList(cfg RedisListConfig, cod codec.Codec, c *redis.Client) RedisList

func (RedisList) Pop

func (r RedisList) Pop(ctx context.Context) ([]boltzmann.Task, error)

func (RedisList) Push

func (r RedisList) Push(ctx context.Context, tasks ...boltzmann.Task) error

type RedisListConfig

type RedisListConfig struct {
	QueueName string
	BatchSize int64
	IsLIFO    bool
}

func NewRedisListConfig

func NewRedisListConfig() RedisListConfig

type Service

type Service struct {
	Config        ServiceConfig
	Queue         Queue
	AgentRegistry agent.Registry
	// contains filtered or unexported fields
}

func NewService

func NewService(cfg ServiceConfig, agentReg agent.Registry, queue Queue) *Service

func (*Service) Shutdown

func (d *Service) Shutdown(_ context.Context) error

func (*Service) Start

func (d *Service) Start(ctx context.Context) error

type ServiceConfig

type ServiceConfig struct {
	FetchInterval time.Duration
	RetryInterval time.Duration
	JobTimeout    time.Duration
	MaxRetries    int8
	MaxProc       int64
}

func NewServiceConfig

func NewServiceConfig() ServiceConfig

type StateUpdaterMiddleware

type StateUpdaterMiddleware struct {
	Repository state.Repository
	Next       Queue
}

func (StateUpdaterMiddleware) Pop

func (StateUpdaterMiddleware) Push

func (s StateUpdaterMiddleware) Push(ctx context.Context, tasks ...boltzmann.Task) error

Jump to

Keyboard shortcuts

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