fix: clear() treats a concurrent delete as success; explicit utf-8; durability prose
clear() handles FileNotFoundError as success (the goal state — no file — is reached) instead of returning False. read/write open with explicit encoding='utf-8'. atomic-write prose scoped to process-crash safety (NOT power-loss durability — no fsync), in module, README, and CLAUDE. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
@@ -62,8 +62,11 @@ Prefer `AioKV` in new code.
|
||||
## Durability
|
||||
|
||||
Writes are **atomic**: data is written to a temp file in the same directory and
|
||||
`os.replace()`d over the target (atomic on POSIX). A crash mid-write leaves the
|
||||
previous good file intact, and a reader never observes a partial file. A single
|
||||
`os.replace()`d over the target (atomic on POSIX). A **process** crash mid-write leaves
|
||||
the previous good file intact, and a reader never observes a partial file. (This is
|
||||
process-crash safety, not power-loss durability — there's no `fsync`, so an OS/power
|
||||
failure could still lose the last write; fine for reconstructible single-process state.)
|
||||
A single
|
||||
`asyncio.Lock` guards every read and write, so concurrent operations on one instance
|
||||
are consistent and no update is lost. All blocking filesystem calls run via
|
||||
`asyncio.to_thread`, so nothing stalls the event loop.
|
||||
|
||||
Reference in New Issue
Block a user