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

Method commit_seq

nodedb-crdt/src/signing.rs:107–117  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 3

seq_no_must_advanceFunction · 0.80
validate_or_rejectMethod · 0.80

Calls 2

lockMethod · 0.80
entryMethod · 0.80

Tested by 2

seq_no_must_advanceFunction · 0.64