1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use serde::{Deserialize, Serialize};
/// Options for listing jobs in a queue.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QueueListOpts {
/// Maximum number of jobs to return.
pub count: usize,
/// Number of jobs to skip from the start.
pub offset: usize,
}
/// Catalog of all registered workers and queues.
#[derive(Debug, Clone)]
pub struct Catalog {
/// Regular (non-cron) workers.
pub workers: Vec<WorkerInfo>,
/// Cron workers with schedule information.
pub cron_workers: Vec<CronWorkerInfo>,
/// Registered queues.
pub queues: Vec<QueueInfo>,
}
/// Information about a registered queue.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QueueInfo {
/// The queue key or prefix.
pub key: String,
/// Whether this is a dynamic queue.
pub dynamic: bool,
/// The concurrency limit for this queue.
pub concurrency: usize,
/// Throttle configuration, if any.
pub throttle: Option<QueueThrottleInfo>,
}
/// Throttle configuration for a queue.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QueueThrottleInfo {
/// Throttle window in milliseconds.
pub window_ms: i64,
/// Maximum number of jobs allowed within the window.
pub limit: u64,
}
/// Information about a registered worker.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WorkerInfo {
/// The worker name (Rust type path).
pub name: String,
}
/// Information about a registered cron worker.
#[derive(Debug, Clone)]
pub struct CronWorkerInfo {
/// The worker name (Rust type path).
pub name: String,
/// The cron schedule expression.
pub schedule: cron::Schedule,
/// The queue key this worker runs on.
pub queue_key: String,
}