Delete the standalone schema catalog serializers
SerializeSchemaCatalog and DeserializeSchemaCatalog had no consumer outside the snapshot round-trip test. Catalog entries still serialize inside SerializeSnapshot/DeserializeSnapshot through the same per-entry reader and writer, and the round-trip test now checks the catalog through the snapshot. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
900e148d8a
commit
360dd0ae2f
2 changed files with 1 additions and 36 deletions
|
|
@ -141,39 +141,6 @@ public static class CultDocumentMessagePackSerialization
|
|||
return ReadPersistedRecord(ref reader);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes a schema catalog.
|
||||
/// </summary>
|
||||
public static byte[] SerializeSchemaCatalog(CultSchemaCatalogEntry[] catalog)
|
||||
{
|
||||
var buffer = new global::System.Buffers.ArrayBufferWriter<byte>();
|
||||
var writer = new MessagePackWriter(buffer);
|
||||
writer.WriteArrayHeader(catalog.Length);
|
||||
foreach (var entry in catalog)
|
||||
{
|
||||
WriteSchemaCatalogEntry(ref writer, entry);
|
||||
}
|
||||
|
||||
writer.Flush();
|
||||
return buffer.WrittenSpan.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes a schema catalog.
|
||||
/// </summary>
|
||||
public static CultSchemaCatalogEntry[] DeserializeSchemaCatalog(byte[] payload)
|
||||
{
|
||||
var reader = new MessagePackReader(payload);
|
||||
var count = reader.ReadArrayHeader();
|
||||
var catalog = new CultSchemaCatalogEntry[count];
|
||||
for (var index = 0; index < count; index++)
|
||||
{
|
||||
catalog[index] = ReadSchemaCatalogEntry(ref reader);
|
||||
}
|
||||
|
||||
return catalog;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes a complete persisted store snapshot.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -805,8 +805,6 @@ namespace GameCult.Caching.Tests
|
|||
|
||||
var roundTripRecord = CultDocumentMessagePackSerialization.DeserializePersistedRecord(
|
||||
CultDocumentMessagePackSerialization.SerializePersistedRecord(record));
|
||||
var roundTripCatalog = CultDocumentMessagePackSerialization.DeserializeSchemaCatalog(
|
||||
CultDocumentMessagePackSerialization.SerializeSchemaCatalog(catalog));
|
||||
var roundTripSnapshot = CultDocumentMessagePackSerialization.DeserializeSnapshot(
|
||||
CultDocumentMessagePackSerialization.SerializeSnapshot(snapshot));
|
||||
|
||||
|
|
@ -814,7 +812,7 @@ namespace GameCult.Caching.Tests
|
|||
Assert.That(roundTripRecord.SchemaId, Is.EqualTo("schema-1"));
|
||||
Assert.That(roundTripRecord.StoredAt, Is.EqualTo("2026-05-08T12:00:00Z"));
|
||||
Assert.That(roundTripRecord.Payload, Is.EqualTo(record.Payload));
|
||||
Assert.That(roundTripCatalog.Single().CompatibleSchemaIds, Is.EqualTo(catalog.Single().CompatibleSchemaIds));
|
||||
Assert.That(roundTripSnapshot.SchemaCatalog.Single().CompatibleSchemaIds, Is.EqualTo(catalog.Single().CompatibleSchemaIds));
|
||||
Assert.That(roundTripSnapshot.FormatVersion, Is.EqualTo("cultcache.store.v1"));
|
||||
Assert.That(roundTripSnapshot.SchemaCatalog.Single().SchemaName, Is.EqualTo("tests.named_entry"));
|
||||
Assert.That(roundTripSnapshot.Records.Single().Key, Is.EqualTo("record-1"));
|
||||
|
|
|
|||
Loading…
Reference in a new issue