Record an ack from `replica_id` for `array` at `ack_hlc`. Monotonically advances the stored value — older acks are ignored. Persists the updated HLC immediately.
(&self, array: &str, replica_id: ReplicaId, ack_hlc: Hlc)
| 182 | /// Monotonically advances the stored value — older acks are ignored. |
| 183 | /// Persists the updated HLC immediately. |
| 184 | pub fn record(&self, array: &str, replica_id: ReplicaId, ack_hlc: Hlc) { |
| 185 | { |
| 186 | let mut cache = self.cache.write().unwrap_or_else(|p| p.into_inner()); |
| 187 | cache |
| 188 | .entry(array.to_owned()) |
| 189 | .or_default() |
| 190 | .record(replica_id, ack_hlc); |
| 191 | } |
| 192 | // Persist outside the write-lock to avoid holding it across I/O. |
| 193 | if let Some(key) = ack_key(array, replica_id.as_u64()) |
| 194 | && let Err(e) = self.persist_row(&key, ack_hlc) |
| 195 | { |
| 196 | warn!( |
| 197 | array = %array, |
| 198 | error = %e, |
| 199 | "ack_registry: persist failed — in-memory ack advanced but disk not updated" |
| 200 | ); |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | fn persist_row(&self, key: &[u8], hlc: Hlc) -> crate::Result<()> { |
| 205 | let txn = self.db.begin_write().map_err(|e| crate::Error::Storage { |