MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / open_readonly

Method open_readonly

atomic-core/src/pristine/txn/pristine.rs:220–226  ·  view source on GitHub ↗

Open an existing pristine database in read-only mode This method opens the database without acquiring a write lock, allowing concurrent read access from multiple processes. It's suitable for read-only operations like `status`, `diff`, `log`, and `change`. # Errors Returns an error if: - The database file doesn't exist - The database is corrupted - Read access cannot be obtained # Example ```i

(path: P)

Source from the content-addressed store, hash-verified

218 /// // Read operations...
219 /// ```
220 pub fn open_readonly<P: AsRef<Path>>(path: P) -> PristineResult<Self> {
221 // Open database without creating (read-only mode)
222 // Use the same 8 GiB cache as open() for consistent performance.
223 let cache_bytes = 8 * 1024 * 1024 * 1024; // 8 GiB
224 let db = Builder::new().set_cache_size(cache_bytes).open(path)?;
225 Self::scan_ids(db)
226 }
227
228 /// Scan existing tables for the next available IDs.
229 ///

Callers

nothing calls this directly

Calls 1

openMethod · 0.45

Tested by

no test coverage detected