Retrieve a snapshot by exact `(array, hlc)`.
(&self, array: &str, hlc: Hlc)
| 152 | |
| 153 | /// Retrieve a snapshot by exact `(array, hlc)`. |
| 154 | pub fn get(&self, array: &str, hlc: Hlc) -> Option<TileSnapshot> { |
| 155 | let key = snapshot_key(array, hlc)?; |
| 156 | let txn = self.db.begin_read().ok()?; |
| 157 | let table = txn.open_table(SNAPSHOT_TABLE).ok()?; |
| 158 | let entry = table.get(key.as_slice()).ok()??; |
| 159 | decode_snapshot(entry.value()) |
| 160 | .map_err(|e| { |
| 161 | warn!(array = %array, error = %e, "snapshot_store: decode error on get"); |
| 162 | }) |
| 163 | .ok() |
| 164 | } |
| 165 | |
| 166 | /// Return the snapshot with the highest HLC for `array`, or `None` if none exist. |
| 167 | pub fn latest_for_array(&self, array: &str) -> Option<TileSnapshot> { |