MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / mark_sent

Method mark_sent

nodedb/src/control/array_sync/outbound/subscriber_state.rs:118–134  ·  view source on GitHub ↗

Update the cursor for `(session_id, array_name)` to `new_hlc`. Persists the updated state immediately so restarts pick up where delivery left off.

(&self, session_id: &str, array_name: &str, new_hlc: Hlc)

Source from the content-addressed store, hash-verified

116 /// Persists the updated state immediately so restarts pick up where
117 /// delivery left off.
118 pub fn mark_sent(&self, session_id: &str, array_name: &str, new_hlc: Hlc) {
119 let key = (session_id.to_string(), array_name.to_string());
120 let mut map = self.inner.write().unwrap_or_else(|p| p.into_inner());
121 if let Some(state) = map.get_mut(&key)
122 && new_hlc > state.last_pushed_hlc
123 {
124 state.last_pushed_hlc = new_hlc;
125 if let Err(e) = self.store.save(state) {
126 warn!(
127 session = %session_id,
128 array = %array_name,
129 error = %e,
130 "subscriber_state: failed to persist cursor — cursor will reset on restart"
131 );
132 }
133 }
134 }
135
136 /// Remove all cursor entries for a session (disconnect cleanup).
137 pub fn remove_session(&self, session_id: &str) {

Callers 6

serveMethod · 0.80
stream_opsMethod · 0.80
mark_sentFunction · 0.80

Calls 4

to_stringMethod · 0.80
writeMethod · 0.45
get_mutMethod · 0.45
saveMethod · 0.45