From 2ffd2379458dc03122e4aa63838798a24b2f2986 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 13 Jun 2026 06:55:59 +0100 Subject: [PATCH] Disable legacy backing store writes --- .../ServerShared/CultCache/CultCache.cs | 34 ++++--------------- docs/aetheria-perfect-machine-map.md | 2 ++ 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/Assets/Scripts/ServerShared/CultCache/CultCache.cs b/Assets/Scripts/ServerShared/CultCache/CultCache.cs index 9e0d297f8..43ca95e69 100644 --- a/Assets/Scripts/ServerShared/CultCache/CultCache.cs +++ b/Assets/Scripts/ServerShared/CultCache/CultCache.cs @@ -297,34 +297,19 @@ public abstract class MultiFileBackingStore : CacheBackingStore, RealtimeBacking } } - private string GetFileName(DatabaseEntry entry) => - $"{(entry is INamedEntry namedEntry ? namedEntry.EntryName : entry.ID.ToString())}.{Extension}"; - public override void Push(DatabaseEntry entry) { - var type = entry.GetType(); - Entries[entry.ID] = entry; - var directory = _entryTypeDirectories[type]; - directory.Create(); - File.WriteAllBytes(Path.Combine(directory.FullName, GetFileName(entry)), Serialize(entry)); + throw new NotSupportedException("Legacy multi-file backing stores are read-only migration inputs."); } public override void Delete(DatabaseEntry entry) { - if(Entries.ContainsKey(entry.ID)) - { - var type = entry.GetType(); - Entries.Remove(entry.ID); - var directory = _entryTypeDirectories[type]; - var file = new FileInfo(Path.Combine(directory.FullName, GetFileName(entry))); - if (file.Exists) - file.Delete(); - } + throw new NotSupportedException("Legacy multi-file backing stores are read-only migration inputs."); } public override void PushAll(bool soft = false) { - foreach(var entry in Entries.Values.ToArray()) Push(entry); + throw new NotSupportedException("Legacy multi-file backing stores are read-only migration inputs."); } public void ObserveChanges() @@ -400,24 +385,17 @@ public abstract class SingleFileBackingStore : CacheBackingStore public override void Push(DatabaseEntry entry) { - var type = entry.GetType(); - Entries[entry.ID] = entry; - PushAll(); + throw new NotSupportedException("Legacy single-file backing stores are read-only migration inputs."); } public override void Delete(DatabaseEntry entry) { - if(Entries.ContainsKey(entry.ID)) - { - Entries.Remove(entry.ID); - PushAll(); - } + throw new NotSupportedException("Legacy single-file backing stores are read-only migration inputs."); } public override void PushAll(bool soft = false) { - var entriesArray = Entries.Values.ToArray(); - File.WriteAllBytes(FileInfo.FullName, Serialize(entriesArray)); + throw new NotSupportedException("Legacy single-file backing stores are read-only migration inputs."); } } diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 9eba3fda4..f7b971663 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -35,6 +35,8 @@ local CultCache, and legacy UI paths should be migration-only or deleted. - `LegacyCatalogBoundary` opens the legacy `CultCache` in read-only mode. Old MessagePack backing stores may hydrate in-memory domain objects for the current Unity runtime, but this path cannot push or delete legacy files. + `SingleFileMessagePackBackingStore` and `MultiFileMessagePackBackingStore` + now throw on `Push`, `Delete`, and `PushAll`. - `DatabaseLink.Value` can resolve legacy links only after `LegacyCatalogBoundary` binds the read-only catalog cache. `CultCache` construction no longer grabs global `DatabaseLinkBase` authority.