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
//! Message ordering policy (Rift spec section 9.4).
//!
//! This module defines the [`OrderingPolicy`] enum that describes how messages
//! within a topic are ordered. The ordering policy is part of a topic's
//! [`TopicProfile`](crate::topic::profile::TopicProfile) and determines which
//! guarantees the broker must uphold when delivering messages to subscribers.
//!
//! # Ordering levels
//!
//! From weakest to strongest:
//!
//! 1. **None** — no ordering guarantee at all.
//! 2. **Connection** — messages from a single connection arrive in the order
//! they were sent on that connection.
//! 3. **Publisher** — messages from a single publisher (which may span multiple
//! connections) arrive in the order they were published.
//! 4. **Topic** — all messages on the topic arrive in a single global order
//! (the default).
//! 5. **Key** — messages sharing the same `ordering_key` arrive in order;
//! messages with different keys may be interleaved.
//! 6. **Causal** — messages arrive in causal order, requiring vector-clock
//! metadata attached to each frame.
use fmt;
/// How messages within a topic are ordered.
///
/// The ordering policy is chosen by the topic creator and stored in the
/// topic's [`TopicProfile`](crate::topic::profile::TopicProfile). Brokers
/// and routers use it to decide how to sequence deliveries.