Export the current Loro snapshot bytes for `array`, or `None` if unknown.
(&self, array: &str)
| 184 | |
| 185 | /// Export the current Loro snapshot bytes for `array`, or `None` if unknown. |
| 186 | pub fn export_snapshot(&self, array: &str) -> crate::Result<Option<Vec<u8>>> { |
| 187 | let docs = self.docs.lock().map_err(|_| Error::Storage { |
| 188 | engine: "array_sync".into(), |
| 189 | detail: "schema_registry lock poisoned".into(), |
| 190 | })?; |
| 191 | if let Some(doc) = docs.get(array) { |
| 192 | let bytes = doc.export_snapshot().map_err(|e| Error::Storage { |
| 193 | engine: "array_sync".into(), |
| 194 | detail: format!("schema_registry export '{array}': {e}"), |
| 195 | })?; |
| 196 | Ok(Some(bytes)) |
| 197 | } else { |
| 198 | Ok(None) |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | // ─── Internal helpers ───────────────────────────────────────────────────── |
| 203 |
no test coverage detected