Caching docs: state exactly what a cacheless write owns and refuses
The CHANGELOG bullet, the persistence-contract paragraph and the registry param docs of WriteRecord and WriteDocument now list the two ways a record is owned and every refusal the code makes, including a stored entry that lists another registered type's id ahead of the written one's and a call that writes no entry. The registry-less Shared read is described as it is today. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f80634df97
commit
723b799668
3 changed files with 13 additions and 10 deletions
|
|
@ -206,13 +206,16 @@ The rule is checked again where the write lands, under the store's lock: a write
|
|||
whose durable record is not owned, because another writer rewrote it after this cache
|
||||
loaded, is refused typed, and the record is reloaded as the store holds it, read-only when a type can
|
||||
read it. This holds for every write through the store, the store's own `Push`, `Delete` and
|
||||
`CommitBatch` included. A CultMesh single-file write asks the same rule: it owns the ids its written entries declare (their own ids and the ids they
|
||||
list compatible) and an id whose publishing entry its claimant reads whole (no persisted slot unread). The claimant is picked by
|
||||
the one precedence over the written entries and the call's registry, a written entry being the only description of its schema id
|
||||
(the registry's type for that id is never asked), and the record is owned only when the claimant is a written entry. So a cacheless
|
||||
write is never more permissive than its declaration, nor than a cache registering the registry's other types beside the written
|
||||
ones: a record another registered type claims is refused, under that type's current id or an old one it lists, and a registry only
|
||||
adds refusals. With no registry the written entries are the only claimants. It is refused the same way otherwise.
|
||||
`CommitBatch` included. A CultMesh single-file write (`WriteDocument`, `WriteRecord`, or `PushAll` on an unattached store) asks the same rule: it owns the ids its
|
||||
written entries declare (their own ids and the ids they list compatible) and an id whose publishing entry its claimant reads whole (no persisted
|
||||
slot unread). The claimant is picked by the one precedence over the written entries and the call's registry, a written entry being the only
|
||||
description of its schema id (the registry's type for that id is never asked), and the record is owned only when the claimant is a written
|
||||
entry. A registry adds claimants and declares nothing, so it only adds refusals; with none the written entries are the only claimants. Refused:
|
||||
a record another registered type claims, under that type's current id or an old one it lists; a record whose stored entry lists another
|
||||
registered type's id ahead of the written one's, whatever name the stored entry carries; a record two registered types list compatible or two
|
||||
registered versions of the written schema could read; a record the picked written entry reads only by dropping persisted slots; and the
|
||||
removal of any stored record by a call that writes no entry. A registry-less `WriteDocument` reads `CultDocumentRegistry.Shared`. It is
|
||||
refused the same way otherwise.
|
||||
|
||||
A record that resolves to no local type is a foreign record, for example one of a type this build does not
|
||||
have, or one renamed under a new schema name without declaring its old id. A store never destroys or relabels it: the store carries it
|
||||
|
|
|
|||
|
|
@ -4484,7 +4484,7 @@ namespace GameCult.Caching
|
|||
/// <param name="record">The record to store.</param>
|
||||
/// <param name="catalogEntry">The schema catalog entry for the record's schema id.</param>
|
||||
/// <param name="holdsIds">Whether the record's payload holds element ids, or null when the caller cannot tell.</param>
|
||||
/// <param name="registry">The registry the payload was encoded with. Given, the write decides the header for copied records that registry can read, and its types also claim stored records as a cache registering them would, so it can only refuse more; <paramref name="catalogEntry"/> stays the only description of its own schema id and the registry's type for that id is never asked. Omitted, it decides nothing for copied records and the one entry is the only claimant. It serves this call only: the store keeps no registry.</param>
|
||||
/// <param name="registry">The registry the payload was encoded with. Given, the write decides the header for copied records that registry can read, and its other types also claim stored records as a cache registering them would; it declares nothing, so it can only refuse more. <paramref name="catalogEntry"/> stays the only description of its own schema id and the registry's type for that id is never asked. Owned are a record whose id <paramref name="catalogEntry"/> declares (its own or one it lists compatible) and a record the entry reads whole when it is the picked claimant; refused are a record another registered type claims, one whose stored entry lists another registered type's id ahead of the entry's, and one that two registered types list or two versions of the schema could read. Omitted, it decides nothing for copied records and the one entry is the only claimant. It serves this call only: the store keeps no registry.</param>
|
||||
/// <remarks>The call holds the store's gate while it runs. User code it runs must not enter a cache or another store; that throws <see cref="InvalidOperationException"/>.</remarks>
|
||||
/// <exception cref="InvalidOperationException">The store is attached to a cache; write through the cache.</exception>
|
||||
/// <exception cref="CultStoreUnreadableException">The file at the path is not a store this runtime can read.</exception>
|
||||
|
|
@ -4507,7 +4507,7 @@ namespace GameCult.Caching
|
|||
/// <param name="key">The record key the document is stored under.</param>
|
||||
/// <param name="document">The document to store.</param>
|
||||
/// <param name="storedAt">The stored-at stamp, or null for now.</param>
|
||||
/// <param name="registry">The registry that describes and encodes the document, or null for <see cref="CultDocumentRegistry.Shared"/>. Its types claim stored records as a cache registering it would: the document's type owns a record its entry does not declare only when it is the claimant and reads it whole; another registered type's record, or one whose stored entry lists another registered type's id that type claims first, is refused; a wider registry (Shared when none is passed) can only refuse more. It serves this call only: the store keeps no registry.</param>
|
||||
/// <param name="registry">The registry that describes and encodes the document, or null for <see cref="CultDocumentRegistry.Shared"/>. The document type's entry is taken from it and is the only description of that schema id. Its other types claim stored records as a cache registering them would, and it declares nothing, so it can only refuse more: the document's entry owns a record whose id it declares (its own or one it lists compatible), and a record it reads whole when it is the picked claimant; refused are a record another registered type claims, one whose stored entry lists another registered type's id ahead of the entry's, and one that two registered types list or two versions of the schema could read. A wider registry (Shared when none is passed) refuses at least as much. It serves this call only: the store keeps no registry.</param>
|
||||
/// <remarks>The call holds the store's gate while it runs. User code it runs (property getters while the document is encoded, constructors while a copied record is read) must not enter a cache or another store; that throws <see cref="InvalidOperationException"/>, carried by the encoder's wrapper when the code ran inside it.</remarks>
|
||||
/// <exception cref="InvalidOperationException">The store is attached to a cache; write through the cache.</exception>
|
||||
/// <exception cref="CultStoreUnreadableException">The file at the path is not a store this runtime can read.</exception>
|
||||
|
|
|
|||
Loading…
Reference in a new issue