Open or create the ack registry database at `{data_dir}/array_sync/acks.redb`.
(data_dir: &Path)
| 79 | impl ArrayAckRegistry { |
| 80 | /// Open or create the ack registry database at `{data_dir}/array_sync/acks.redb`. |
| 81 | pub fn open(data_dir: &Path) -> crate::Result<Arc<Self>> { |
| 82 | let dir = data_dir.join("array_sync"); |
| 83 | std::fs::create_dir_all(&dir).map_err(|e| crate::Error::Storage { |
| 84 | engine: "array_sync".into(), |
| 85 | detail: format!("create dir {}: {e}", dir.display()), |
| 86 | })?; |
| 87 | let path = dir.join("acks.redb"); |
| 88 | let db = Database::create(&path).map_err(|e| crate::Error::Storage { |
| 89 | engine: "array_sync".into(), |
| 90 | detail: format!("open acks db {}: {e}", path.display()), |
| 91 | })?; |
| 92 | Self::init_db(db) |
| 93 | } |
| 94 | |
| 95 | /// In-memory-only registry for tests. |
| 96 | pub fn open_in_memory() -> crate::Result<Arc<Self>> { |