Remove alternate CultCache backing stores

This commit is contained in:
Meta Vens 2026-05-08 02:42:11 +01:00
commit 08208b9722
11 changed files with 32 additions and 467 deletions

View file

@ -308,42 +308,3 @@ public class SingleFileMessagePackBackingStore : SingleFileBackingStore
return CultDocumentMessagePackSerialization.DeserializeUntyped(documentType, payload);
}
}
public class MultiFileMessagePackBackingStore : MultiFileBackingStore
{
public MultiFileMessagePackBackingStore(string path) : base(path)
{
}
protected override byte[] SerializeRecord(CultPersistedRecord record)
{
return CultDocumentMessagePackSerialization.SerializePersistedRecord(record);
}
protected override CultPersistedRecord DeserializeRecord(byte[] data)
{
return CultDocumentMessagePackSerialization.DeserializePersistedRecord(data);
}
protected override byte[] SerializeCatalog(CultSchemaCatalogEntry[] catalog)
{
return CultDocumentMessagePackSerialization.SerializeSchemaCatalog(catalog);
}
protected override CultSchemaCatalogEntry[] DeserializeCatalog(byte[] data)
{
return CultDocumentMessagePackSerialization.DeserializeSchemaCatalog(data);
}
protected override byte[] SerializePayload(object document)
{
return CultDocumentMessagePackSerialization.SerializeUntyped(document, document.GetType());
}
protected override object DeserializePayload(Type documentType, byte[] payload)
{
return CultDocumentMessagePackSerialization.DeserializeUntyped(documentType, payload);
}
public override string Extension => "msgpack";
}

View file

@ -1,25 +1,25 @@
# GameCult.Caching.MessagePack
`GameCult.Caching.MessagePack` provides MessagePack persistence for the
attribute-first `GameCult.Caching` stack.
`GameCult.Caching.MessagePack` provides the canonical CultCache persistence
format for the attribute-first `GameCult.Caching` stack.
## Included Types
- `SingleFileMessagePackBackingStore`
- `MultiFileMessagePackBackingStore`
- `CultDocumentMessagePackSerialization`
- `CultDocumentResolver`
- `CultRecordRefFormatter<T>`
When a project declares `[CultDocument]` models, wire in the
`GameCult.Caching.MessagePack.Generator` analyzer there as well. It emits
assembly-local metadata providers for the cache registry; MessagePack itself
still handles payload serialization through the normal resolver path.
assembly-local metadata providers for the cache registry. Cult documents then
serialize through explicit generated slot codecs, while the store snapshot
format is written by hand against `MessagePackWriter`/`MessagePackReader`.
## What It Does
- stores CultCache snapshots and records in MessagePack
- serializes plain attributed document payloads
- stores whole CultCache snapshots in MessagePack
- serializes plain attributed document payloads through explicit generated slot codecs
- keeps explicit `CultRecordRef<T>` values compact on disk/wire
- preserves the cache/store split where metadata lives outside the domain model
@ -30,7 +30,6 @@ using GameCult.Caching;
using MessagePack;
[CultDocument("gamecult.item_data", "gamecult.item_data.v1")]
[MessagePackObject]
public sealed class ItemData
{
[Key(0)] [CultName] public string Name = string.Empty;
@ -45,7 +44,7 @@ using GameCult.Caching;
using GameCult.Caching.MessagePack;
var cache = new CultCache();
var store = new MultiFileMessagePackBackingStore("Data");
var store = new SingleFileMessagePackBackingStore("Data.msgpack");
cache.AddBackingStore(store);
await cache.PullAllBackingStoresAsync();
@ -54,7 +53,7 @@ await cache.PullAllBackingStoresAsync();
## Notes
- Payload bytes are MessagePack. Store metadata and schema catalogs are also
persisted through MessagePack in this package.
persisted through hand-written MessagePack array layouts in this package.
- The generator package now targets attributed document types instead of
`DatabaseEntry` subclasses.
- The raw CultNet document lane should treat these payload bytes as already