Update last_seen for `(user_id, device_id)` after a successful accept. Only updates if `seq_no > current`, to guard against races.
(&self, user_id: u64, device_id: u64, seq_no: u64)
| 105 | /// |
| 106 | /// Only updates if `seq_no > current`, to guard against races. |
| 107 | pub fn commit_seq(&self, user_id: u64, device_id: u64, seq_no: u64) -> Result<()> { |
| 108 | let mut guard = self |
| 109 | .inner |
| 110 | .lock() |
| 111 | .map_err(|_| CrdtError::DeltaApplyFailed("device registry lock poisoned".into()))?; |
| 112 | let entry = guard.entry((user_id, device_id)).or_default(); |
| 113 | if seq_no > entry.last_seq_no { |
| 114 | entry.last_seq_no = seq_no; |
| 115 | } |
| 116 | Ok(()) |
| 117 | } |
| 118 | |
| 119 | /// Pre-load a known (user_id, device_id, last_seq_no) tuple from the |
| 120 | /// persistent catalog on startup. |