Module backend

Module backend 

Source
Expand description

Core traits for interacting with backends

The core traits and types for backends, responsible for providing sources of tasks, handling their lifecycle, and exposing middleware for internal processing. The traits here abstract over different backend implementations, allowing for extensibility and interoperability.

§Overview

§Default Implementations

The module includes several default backend implementations, such as:

  • MemoryStorage: An in-memory backend for testing and lightweight use cases
  • Pipe: A simple pipe-based backend for inter-thread communication
  • CustomBackend: A flexible backend allowing custom functions for task management

Modules§

codec
Utilities for encoding and decoding task arguments and results
custom
Custom Backend
guide
A guide to using the implementing a backend Guide for implementing backends
jsonjson
File based Backend using JSON
memory
In-memory backend based on channels
pipe
Pipe streams to backends
poll_strategy
Polling strategies for backends.
queue
Represents a queue in the backend
shared
Shared connection support for backends

Structs§

Filter
Filter criteria for listing tasks
QueueInfo
Represents information about a specific queue in the backend
RunningWorker
Represents a worker currently registered with the backend
Statistic
Represents an overview of the backend including queues, workers, and statistics
TaskResult
Represents the result of a task execution

Enums§

StatType
Statistics type
TaskSinkError
Error type for TaskSink operations

Traits§

Backend
The Backend trait defines how workers get and manage tasks from a backend.
ConfigExt
Extension trait for accessing queue configuration
Expose
Allows exposing additional functionality from the backend
FetchById
Allows fetching a task by its ID
ListAllTasks
Allows listing tasks across all queues with optional filtering
ListQueues
Allows listing all queues available in the backend
ListTasks
Allows listing tasks with optional filtering
ListWorkers
Allows listing all workers registered with the backend
Metrics
Allows collecting metrics from the backend
RegisterWorker
Allows registering a worker with the backend
Reschedule
Allows rescheduling a task for later execution
ResumeAbandoned
Allows fetching multiple tasks by their IDs
ResumeById
Allows resuming a task by its ID
TaskSink
Extends Backend to allow pushing tasks into the backend
Update
Allows updating an existing task
Vacuum
Allows cleaning up resources in the backend
WaitForCompletion
Allows waiting for tasks to complete and checking their status
WeakTaskSink
Extends Backend to allow pushing tasks into the backend without requiring compile time constraints. By default the TaskSink trait requires TaskSink<Args>: Backend<Args> which can be restrictive in certain scenarios. This means you cannot push tasks of different argument types using the same backend instance. The WeakTaskSink trait relaxes this constraint, allowing pushing tasks of any argument type as long as they match the backend’s context and ID type. This is useful for dynamic task management scenarios where tasks of varying types need to be pushed into the same backend instance.

Type Aliases§

TaskStream
Represents a stream for T.