Enum FilterState
pub enum FilterState {
Subscribing {
packet_id: PacketId,
index: u16,
options: SubscriptionOptions,
subscription_id: Option<u32>,
},
Subscribed {
options: SubscriptionOptions,
subscription_id: Option<u32>,
},
Unsubscribing {
packet_id: PacketId,
index: u16,
restore: Option<RestoredSubscription>,
},
}Expand description
Lifecycle state of a single topic filter.
Each filter the application has touched is one entry with one state, so a
filter can never be both a confirmed subscription and a separate in-flight
SUBSCRIBE at once (the overlap that allowed a filter to be sent twice on a
session reset). The subscription options and identifier live on the states
that have them (Subscribing/Subscribed), never on a bare entry, so an
unsubscribe never has to invent them. Subscribing/Unsubscribing carry
the packet identifier of the request that owns them and the filter’s index
within that request, so a positional SUBACK/UNSUBACK reason code resolves
the right filter.
Variants§
Subscribing
A SUBSCRIBE for this filter is in flight (or queued for the next connection); awaiting its SUBACK.
Fields
options: SubscriptionOptionsSubscription options requested for this filter.
Subscribed
The broker granted the subscription.
Fields
options: SubscriptionOptionsGranted subscription options.
Unsubscribing
An UNSUBSCRIBE for this filter is in flight (or queued); awaiting its UNSUBACK.
Fields
restore: Option<RestoredSubscription>The subscription to revert to if the UNSUBACK rejects the removal
(rc >= 0x80). Some when the filter was Subscribed beforehand;
None to drop the entry on any outcome.
Implementations§
§impl FilterState
impl FilterState
pub const TAG_SUBSCRIBING: u8 = 0u8
pub const TAG_SUBSCRIBING: u8 = 0u8
Persistence tag for the Subscribing variant.
pub const TAG_SUBSCRIBED: u8 = 1u8
pub const TAG_SUBSCRIBED: u8 = 1u8
Persistence tag for the Subscribed variant.
pub const TAG_UNSUBSCRIBING: u8 = 2u8
pub const TAG_UNSUBSCRIBING: u8 = 2u8
Persistence tag for the Unsubscribing variant.
pub const fn tag(self) -> u8
pub const fn tag(self) -> u8
The persistence tag byte identifying this state’s variant.
Persistence backends encode the variant with this byte and decode it
back through the TAG_* constants, so the journal and any external
store share one tag numbering instead of each redeclaring it.
pub(crate) const fn pending_slot(self) -> Option<(PacketId, u16)>
pub(crate) const fn pending_slot(self) -> Option<(PacketId, u16)>
The (packet_id, index) slot this state occupies while its request is
in flight, or None once Subscribed. The index orders the filter
within its SUBSCRIBE/UNSUBSCRIBE so a positional ack resolves the right
one.
Trait Implementations§
§impl Clone for FilterState
impl Clone for FilterState
§fn clone(&self) -> FilterState
fn clone(&self) -> FilterState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more