Delete legacy cache mutation surface
This commit is contained in:
parent
e18cede05e
commit
60b2d48630
4 changed files with 12 additions and 38 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -26,11 +26,9 @@ public class CultCache
|
|||
private readonly Dictionary<Type, HashSet<DatabaseEntry>> _types = new Dictionary<Type, HashSet<DatabaseEntry>>();
|
||||
|
||||
public IEnumerable<DatabaseEntry> 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<DatabaseEntry>();
|
||||
|
|
@ -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<DatabaseEntry> 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<T>() : _types[type].Cast<T>();
|
||||
}
|
||||
|
||||
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())
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<T>.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<T>` 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.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue