diff --git a/Assets/Scripts/Gameplay/LegacyCatalogBoundary.cs b/Assets/Scripts/Gameplay/LegacyCatalogBoundary.cs index e95aaf7f9..b6046a6bf 100644 --- a/Assets/Scripts/Gameplay/LegacyCatalogBoundary.cs +++ b/Assets/Scripts/Gameplay/LegacyCatalogBoundary.cs @@ -18,7 +18,7 @@ public static class LegacyCatalogBoundary { if (_catalogCache != null) return _catalogCache; - _catalogCache = new CultCache(readOnly: true); + _catalogCache = new CultCache(); _catalogCache.AddBackingStore(new SingleFileMessagePackBackingStore(GetLegacyCatalogPath(gameDataDirectory))); _catalogCache.AddBackingStore(new MultiFileMessagePackBackingStore(gameDataDirectory.FullName), typeof(NameFile)); _catalogCache.PullAllBackingStores(); diff --git a/Assets/Scripts/ServerShared/CultCache/CultCache.cs b/Assets/Scripts/ServerShared/CultCache/CultCache.cs index 0f143c586..98ff5c164 100644 --- a/Assets/Scripts/ServerShared/CultCache/CultCache.cs +++ b/Assets/Scripts/ServerShared/CultCache/CultCache.cs @@ -26,11 +26,9 @@ public class CultCache private readonly Dictionary> _types = new Dictionary>(); public IEnumerable AllEntries => _entries.Values; - public bool ReadOnly { get; } - public CultCache(bool readOnly = false) + public CultCache() { - ReadOnly = readOnly; foreach (var type in typeof(DatabaseEntry).GetAllChildClasses()) { _types[type] = new HashSet(); @@ -66,14 +64,6 @@ public class CultCache foreach(var store in _storeTypes.Keys) store.PullAll(); } - public void Add(DatabaseEntry entry, CacheBackingStore source = null) - { - if (ReadOnly && source == null) - throw new InvalidOperationException("Legacy CultCache is read-only. Durable state belongs to the Verse state spine."); - - AddInternal(entry, source); - } - private void AddInternal(DatabaseEntry entry, CacheBackingStore source = null) { lock(addLock) @@ -88,7 +78,7 @@ public class CultCache { if(_globals[type]!=null) { - Remove(_globals[type]); + RemoveInternal(_globals[type]); exists = true; } _globals[type] = entry; @@ -108,17 +98,6 @@ public class CultCache public bool IsGlobal(DatabaseEntry entry) => _globals.ContainsKey(entry.GetType()); - public void AddAll(IEnumerable entries) - { - if (ReadOnly) - throw new InvalidOperationException("Legacy CultCache is read-only. Durable state belongs to the Verse state spine."); - - foreach (var entry in entries) - { - AddInternal(entry); - } - } - public DatabaseEntry Get(Guid guid) { DatabaseEntry entry; @@ -153,11 +132,8 @@ public class CultCache return !_types.ContainsKey(type) ? Enumerable.Empty() : _types[type].Cast(); } - public void Remove(DatabaseEntry entry, CacheBackingStore source = null) + private void RemoveInternal(DatabaseEntry entry) { - if (ReadOnly && source == null) - throw new InvalidOperationException("Legacy CultCache is read-only. Durable state belongs to the Verse state spine."); - _entries.Remove(entry.ID); var type = entry.GetType(); foreach (var parentType in type.GetParentTypes()) diff --git a/Assets/Scripts/ServerShared/CultCache/DatabaseEntry.cs b/Assets/Scripts/ServerShared/CultCache/DatabaseEntry.cs index 57ad82058..ef504256f 100644 --- a/Assets/Scripts/ServerShared/CultCache/DatabaseEntry.cs +++ b/Assets/Scripts/ServerShared/CultCache/DatabaseEntry.cs @@ -91,8 +91,6 @@ public class DatabaseLinkBase public static void BindLegacyCatalog(CultCache cache) { if (cache == null) throw new ArgumentNullException(nameof(cache)); - if (!cache.ReadOnly) - throw new InvalidOperationException("Legacy DatabaseLink resolution requires a read-only catalog cache."); LegacyCatalogCache = cache; } diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index e1ede4389..62ad4dc7b 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -32,13 +32,11 @@ local CultCache, and legacy UI paths should be migration-only or deleted. `GameData/KeyboardLayouts/*.msgpack` authority paths are disabled or deleted. The old `SavedGame`/`SavedZone` DTOs and `Galaxy` save-loader constructor are 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. The - legacy backing-store abstraction is pull-only; its write and realtime - watcher APIs have been deleted. Public `Add`, `AddAll`, and `Remove` calls - against the read-only cache are rejected; only backing-store pull hydration - can populate it. +- `LegacyCatalogBoundary` opens the legacy `CultCache` as a pull-only catalog + cache. Old MessagePack backing stores may hydrate in-memory domain objects + for the current Unity runtime, but this path cannot push or delete legacy + files. The legacy backing-store write/realtime APIs and public cache mutation + methods have been deleted; only backing-store pull hydration can populate it. - `DatabaseLink.Value` can resolve legacy links only after `LegacyCatalogBoundary` binds the read-only catalog cache. `CultCache` construction no longer grabs global `DatabaseLinkBase` authority. @@ -81,7 +79,8 @@ local CultCache, and legacy UI paths should be migration-only or deleted. - Owner: `Aetheria.State` owns the new typed state spine for durable state. `LegacyCatalogBoundary` is the only named owner for old MessagePack catalog reads and legacy `DatabaseLink` resolution inside the Unity runtime until - catalog migration lands. + catalog migration lands. The legacy cache no longer has a public mutation + surface. - Inputs: Unity gameplay code, legacy catalog files, typed state documents, and CultMesh server state. - Outputs: `Aetheria.State` emits `.cc` state and CultMesh documents. Legacy @@ -219,6 +218,7 @@ First Aetheria surfaces to publish: - Done: stop legacy `CultCache` pull/read paths from writing entries back to their source backing store. - Done: delete legacy `CultCache` backing-store write/realtime APIs. + - Done: delete public legacy `CultCache` mutation APIs. - Remaining: delete or quarantine old cache abstractions that no longer protect an invariant once catalog migration has a typed reader.