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)
| 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) { |