Add read only mode that doesn't use locking. Useful for inspection while the database is in use or when no changes are intended (except in RAM).

This commit is contained in:
2026-06-14 19:35:06 +00:00
parent b501fcca86
commit c04a245366
10 changed files with 330 additions and 63 deletions
+12
View File
@@ -94,6 +94,18 @@ await kanta.open(create=False)
With `create=False`, open fails if the database file does not exist or is
empty.
Read-only mode opens an existing database without locking it or starting the
background flush task. This is useful for readers that must not block the
writer or modify the file:
```python
await kanta.open(readonly=True)
```
In read-only mode, records are replayed and migrations are applied in memory,
but transactions and explicit flushes are rejected and the file is never
created if missing.
## Fatal Error Handlers
Fatal background write errors can be observed with a decorator: