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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! 后端模块
//! Backend module
//!
//! 定义了任务存储后端的实现,包括 Redis、PostgreSQL 和 WebSocket 后端。
//! Defines task storage backend implementations, including Redis, PostgreSQL, and WebSocket backends.
//!
//! 现在支持同时启用多个后端,默认使用 Redis 后端。
//! Now supports enabling multiple backends simultaneously, with Redis as the default.
//!
//! ## 默认 Broker 和 Inspector 类型别名
//! ## Default Broker and Inspector Type Aliases
//!
//! 默认的 `Broker` 和 `Inspector` 类型别名使用 Redis 后端。
//! The default `Broker` and `Inspector` type aliases use the Redis backend.
//!
//! 如需使用其他后端,请直接使用具体类型:
//! To use other backends, use the specific types directly:
//!
//! - PostgreSQL: `PostgresBroker`, `PostgresInspector` (需要 `postgres` feature)
//! - WebSocket: `WebSocketBroker`, `WebSocketInspector` (需要 `websocket` feature)
//!
//! ## 使用示例
//! ## Usage Example
//!
//! ```rust,ignore
//! use asynq::backend::{Broker, Inspector};
//!
//! // 默认使用 Redis 后端
//! // Default uses Redis backend
//! ```
// PostgreSQL 后端 - 需要 postgres feature
// PostgreSQL backend - requires postgres feature
// WebSocket 后端 - 需要 websocket feature
// WebSocket backend - requires websocket feature
// Redis 后端 - 始终编译(默认后端)
// Redis backend - always compiled (default backend)
// Re-export common types from rdb (Redis is always available as default backend)
// 重新导出 rdb 的公共类型(Redis 始终可用作为默认后端)
pub use ;
// Re-export types from pgdb when postgres feature is enabled
// 当启用 postgres 特性时重新导出 pgdb 的类型
pub use PostgresBroker;
pub use PostgresInspector;
// Re-export types from wsdb when websocket feature is enabled
// 当启用 websocket 特性时重新导出 wsdb 的类型
pub use WebSocketBroker;
pub use WebSocketInspector;
// =============================================================================
// 统一的 Broker 和 Inspector 类型别名
// Unified Broker and Inspector type aliases
// =============================================================================
/// 默认的 Broker 类型别名
/// Default Broker type alias
///
/// 始终使用 Redis 后端作为默认实现。
/// Always uses Redis backend as the default implementation.
///
/// 如需使用其他后端,请直接使用具体类型:
/// To use other backends, use the specific types directly:
///
/// - PostgreSQL: `PostgresBroker` (需要 `postgres` feature)
/// - WebSocket: `WebSocketBroker` (需要 `websocket` feature)
pub type Broker = RedisBroker;
/// 默认的 Inspector 类型别名
/// Default Inspector type alias
///
/// 始终使用 Redis 后端作为默认实现。
/// Always uses Redis backend as the default implementation.
///
/// 如需使用其他后端,请直接使用具体类型:
/// To use other backends, use the specific types directly:
///
/// - PostgreSQL: `PostgresInspector` (需要 `postgres` feature)
/// - WebSocket: `WebSocketInspector` (需要 `websocket` feature)
pub type Inspector = RedisInspector;