| Filename | Latest commit message | Latest commit date |
|---|---|---|
The held index kept one key per value, last writer winning, and RemoveKey dropped a value outright. Two consequences: removing or changing one of two plain holders left the other unfindable, and the variant index rule judged a variant against that lossy view, so a variant could land on a value a plain record still held and the store then refused to reopen. - _indexes maps a value to the keys holding it, oldest first. Index, Unindex and the removal maintain the set. GetByIndex finds the most recently indexed holder of a value, so removing the winner finds the other (behaviour change for plain duplicates: it used to find nothing). - One rule, RefuseVariantIndexSharing, serves both write orders. It reads the truthful index minus what the commit replaces or removes, plus what it lands. ResolveOne no longer judges indexes; ClaimIncomingIndexValues, HeldByVariants and RefusePlainSharingWithVariant are gone. - A conditional commit merged onto the file is judged by the cache's own resolution (CacheBackingStore.Judging) on the merged set: records other writers added, records they removed, and the batch. Another writer's variant sharing a value with the batch, or a base removal that strands another writer's variant, is refused with the named refusal instead of writing an unopenable store. - Shedding is one decision at load. ToStoredDocument resolves the schema once and returns the report with it; a variant's override of a slot the type lacks is dropped from the delta there, so flush needs no predicate and every store reports through the same surface (ReportVariantSheds and OverridesTheTypeHas are gone). The directory store refuses variants and loads through the same call. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> |
||
| .. | ||
| CultCacheFormatterResolverAttribute.cs | ||
| CultCacheMessagePack.cs | ||
| CultDocumentMessagePackSerialization.cs | ||
| CultMessagePackSecurity.cs | ||
| CultRecordRefFormatter.cs | ||
| DirectoryMessagePackBackingStore.cs | ||
| GameCult.Caching.MessagePack.csproj | ||
| README.md | ||
GameCult.Caching.MessagePack
GameCult.Caching.MessagePack provides the canonical CultCache persistence
format for the attribute-first GameCult.Caching stack.
Included Types
SingleFileMessagePackBackingStoreCultDocumentMessagePackSerializationCultDocumentResolverCultRecordRefFormatter<T>
Cult document payloads serialize through MessagePackSerializer with the
options of the document's assembly (CultDocumentMessagePackSerialization.OptionsFor),
after the reflective CultDocumentRegistry has accepted the document shape. The
store snapshot format is written by hand against
MessagePackWriter/MessagePackReader.
What It Does
- stores whole CultCache snapshots in MessagePack
- serializes attributed document payloads as MessagePack
[Key(n)]arrays - keeps explicit
CultRecordRef<T>values compact on disk/wire - preserves the cache/store split where metadata lives outside the domain model
Example Model
using GameCult.Caching;
using MessagePack;
[CultDocument("gamecult.item_data", "gamecult.item_data.v1")]
public sealed class ItemData
{
[Key(0)] [CultName] public string Name = string.Empty;
[Key(1)] public int Value;
}
Typical Usage
using GameCult.Caching;
using GameCult.Caching.MessagePack;
var cache = new CultCache();
var store = new SingleFileMessagePackBackingStore("Data.msgpack");
cache.AddBackingStore(store);
await cache.PullAllBackingStoresAsync();
Notes
- Payload bytes are MessagePack. Store metadata and schema catalogs are also persisted through hand-written MessagePack array layouts in this package.
- The raw CultNet document lane should treat these payload bytes as already blessed, not decode and re-encode them for sport.