Open the repository database READ-ONLY for this query, with the read-concurrency wait: redb refuses any open while a writable handle exists (this or another process), so a short-lived writer — a recording agent turn in another process, a gated mutation in this one — is given [`database_open_wait`] to finish before the read fails. Readers share the database across processes the same way the CLI's q
(&self)
| 217 | /// Readers share the database across processes the same way the CLI's |
| 218 | /// query commands always have. The caller must hold no other handle. |
| 219 | pub fn repository_readonly(&self) -> Result<Repository, Status> { |
| 220 | Repository::open_readonly_wait(&self.root, database_open_wait()).map_err(|error| { |
| 221 | domain_status( |
| 222 | ErrorCode::Repository, |
| 223 | format!( |
| 224 | "failed to open repository at {}: {error}", |
| 225 | self.root.display() |
| 226 | ), |
| 227 | ) |
| 228 | }) |
| 229 | } |
| 230 | |
| 231 | /// Native-index diagnostics must tolerate incomplete derived schemas and |
| 232 | /// must not trigger automatic migration or recovery. Repair callers first |