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
96
97
98
use *;
/// Returns the current Unix timestamp in milliseconds.
///
/// # Returns
///
/// - `u64` - Milliseconds since Unix epoch (`0` if the system clock precedes the epoch).
pub
/// Computes a deterministic shard slot for `topic` using 64-bit FNV-1a hashing.
///
/// # Arguments
///
/// - `&str` - Topic name to hash.
///
/// # Returns
///
/// - `usize` - Shard index in `0..MQ_SHARD_COUNT`.
pub
/// Encodes `topic_id` and monotonic `seq` into one globally unique `receipt_id`.
///
/// # Arguments
///
/// - `u32` - Dense owning topic identifier.
/// - `u64` - Monotonic delivery sequence number.
///
/// # Returns
///
/// - `u64` - Packed receipt identifier carrying `topic_id` in its upper 24 bits.
pub
/// Decodes the owning `topic_id` embedded in `receipt_id`.
///
/// # Arguments
///
/// - `u64` - Packed delivery receipt identifier.
///
/// # Returns
///
/// - `usize` - Dense topic table index.
pub
/// Returns whether a message has passed its optional TTL deadline.
///
/// # Arguments
///
/// - `&MqMessage` - Message to inspect.
/// - `u64` - Current Unix timestamp in milliseconds.
///
/// # Returns
///
/// - `bool` - `true` when `expires_at_ms` is set and `<= now_ms`.
pub
/// Formats the dead-letter queue key for `topic` using `config`.
///
/// # Arguments
///
/// - `&str` - Base topic name.
/// - `&MqConfig` - Broker configuration holding `dlq_suffix`.
///
/// # Returns
///
/// - `String` - Dead-letter queue key.
pub