From 360dd0ae2f69eb74de2daedaa344fef97c729b8f Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 13 Sep 2026 16:51:35 +0200 Subject: [PATCH] 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 --- .../CultDocumentMessagePackSerialization.cs | 33 ------------------- .../BackingStoreTests.cs | 4 +-- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/src/GameCult.Caching.MessagePack/CultDocumentMessagePackSerialization.cs b/src/GameCult.Caching.MessagePack/CultDocumentMessagePackSerialization.cs index 00ed2993..fe9519b9 100644 --- a/src/GameCult.Caching.MessagePack/CultDocumentMessagePackSerialization.cs +++ b/src/GameCult.Caching.MessagePack/CultDocumentMessagePackSerialization.cs @@ -141,39 +141,6 @@ public static class CultDocumentMessagePackSerialization return ReadPersistedRecord(ref reader); } - /// - /// Serializes a schema catalog. - /// - public static byte[] SerializeSchemaCatalog(CultSchemaCatalogEntry[] catalog) - { - var buffer = new global::System.Buffers.ArrayBufferWriter(); - var writer = new MessagePackWriter(buffer); - writer.WriteArrayHeader(catalog.Length); - foreach (var entry in catalog) - { - WriteSchemaCatalogEntry(ref writer, entry); - } - - writer.Flush(); - return buffer.WrittenSpan.ToArray(); - } - - /// - /// Deserializes a schema catalog. - /// - 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; - } - /// /// Serializes a complete persisted store snapshot. /// diff --git a/tests/GameCult.Caching.Tests/BackingStoreTests.cs b/tests/GameCult.Caching.Tests/BackingStoreTests.cs index 486f644f..42c38421 100644 --- a/tests/GameCult.Caching.Tests/BackingStoreTests.cs +++ b/tests/GameCult.Caching.Tests/BackingStoreTests.cs @@ -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"));