Caching docs: MarkWritten refuses an entry the store does not hold (contract, CHANGELOG)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-21 21:59:38 +02:00
commit 22eaaabeb2
2 changed files with 11 additions and 8 deletions

View file

@ -232,9 +232,11 @@ not the one this cache decodes it as. A value change mints a `storedAt`
strictly later than the record it replaces; writers bump a minted timestamp by
one tick when it is not later. An entry loaded under compatible schema drift
keeps its persisted id until its store rewrites it; a store records each
record its completed write rewrote with the protected
`CacheBackingStore.MarkWritten`, and one that does not leaves the entry's
`Expect` failing closed until the next pull. A whole-file flush or
record its completed write rewrote with the protected instance method
`CacheBackingStore.MarkWritten`, which refuses an entry that is not the one
the store holds in its own `Entries` at that key, so a store cannot mark
another store's or another cache's copy. A store that does not mark leaves
the entry's `Expect` failing closed until the next pull. A whole-file flush or
unconditional commit rewrites every record under the writer's current schema
and keeps its `storedAt`, so another cache's `Expect` on a drifted record it
read before that rewrite fails until it re-reads the store.

View file

@ -31,11 +31,12 @@ All notable changes to this package are documented in this file.
stored under, as its backing store last read or wrote it. It differs from
`Descriptor.SchemaId` only for a record loaded under compatible schema drift
that its store has not rewritten since.
- `CacheBackingStore.MarkWritten(CultStoredDocument)` (protected): a backing
store records that its completed durable write stored a record under its
descriptor, so `PersistedSchemaId` follows the rewrite. The single-file and
directory stores mark every record they rewrite; a custom store calls it for
each record its own write rewrote.
- `CacheBackingStore.MarkWritten(CultStoredDocument)` (protected instance
method): a backing store records that its completed durable write stored a
record under its descriptor, so `PersistedSchemaId` follows the rewrite. It
throws `ArgumentException` for an entry that is not the one the store holds
in its own `Entries`. The single-file and directory stores mark every record
they rewrite; a custom store calls it for each record its own write rewrote.
### Changed