pub struct BroadcastChangeTracker { /* private fields */ }
Expand description
BroadcastChangeTracker tracks the broadcasts, their change_count, and the broadcast lookup registry
Implementations§
source§impl BroadcastChangeTracker
impl BroadcastChangeTracker
sourcepub fn new(broadcasts: Vec<Broadcast>) -> BroadcastChangeTracker
pub fn new(broadcasts: Vec<Broadcast>) -> BroadcastChangeTracker
Creates a new BroadcastChangeTracker
initialized with the provided broadcasts
.
sourcepub fn add_broadcasts(&mut self, broadcasts: Vec<Broadcast>) -> Option<u32>
pub fn add_broadcasts(&mut self, broadcasts: Vec<Broadcast>) -> Option<u32>
Add a Vec
of Broadcast
s via self.add_broadcast
Returning the latest change_count (or None
for an empty Vec
)
sourcepub fn add_broadcast(&mut self, broadcast: Broadcast) -> u32
pub fn add_broadcast(&mut self, broadcast: Broadcast) -> u32
Add a new broadcast to the BroadcastChangeTracker, triggering a change_count increase. Note: If the broadcast already exists, it will be updated instead.
sourcepub fn update_broadcast(&mut self, broadcast: Broadcast) -> Result<u32>
pub fn update_broadcast(&mut self, broadcast: Broadcast) -> Result<u32>
Update a broadcast
to a new revision, triggering a change_count increase.
Returns an error if the broadcast
was never initialized/added.
sourcepub fn change_count_delta(
&self,
client_set: &mut BroadcastSubs,
) -> Option<Vec<Broadcast>>
pub fn change_count_delta( &self, client_set: &mut BroadcastSubs, ) -> Option<Vec<Broadcast>>
Returns the new broadcast versions since the provided client_set
.
sourcepub fn broadcast_delta(&self, broadcasts: &[Broadcast]) -> BroadcastSubsInit
pub fn broadcast_delta(&self, broadcasts: &[Broadcast]) -> BroadcastSubsInit
Returns a delta for broadcasts
that are out of date with the latest version and a
the collection of broadcast subscriptions.
sourcepub fn subscribe_to_broadcasts(
&self,
broadcast_subs: &mut BroadcastSubs,
broadcasts: &[Broadcast],
) -> Option<Vec<Broadcast>>
pub fn subscribe_to_broadcasts( &self, broadcast_subs: &mut BroadcastSubs, broadcasts: &[Broadcast], ) -> Option<Vec<Broadcast>>
Update a BroadcastSubs
to account for new broadcasts.
Returns broadcasts that have changed.
sourcepub fn missing_broadcasts(&self, broadcasts: &[Broadcast]) -> Vec<Broadcast>
pub fn missing_broadcasts(&self, broadcasts: &[Broadcast]) -> Vec<Broadcast>
Check a broadcast list and return unknown broadcast id’s with their appropriate error