refactor(runtime): own canonical entity and object lifetime
Introduce one presentation-free RuntimeEntityObjectLifetime for the exact entity directory and ClientObjectTable. Make GameWindow, graphical projections, retained UI, interaction, session routing, create/delete integration, and reset borrow that owner while preserving synchronous retail ordering, dormant retention, and retry semantics. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
d9bf4c4960
commit
5ef8b5371d
40 changed files with 712 additions and 170 deletions
50
tests/AcDream.App.Tests/LiveEntityRuntimeFixture.cs
Normal file
50
tests/AcDream.App.Tests/LiveEntityRuntimeFixture.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
using AcDream.App.Streaming;
|
||||
using AcDream.App.World;
|
||||
using AcDream.Runtime.Entities;
|
||||
|
||||
namespace AcDream.App.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Explicit isolated lifetime-group seam for App projection tests. Production
|
||||
/// composition supplies its session-owned group from GameWindow; focused tests
|
||||
/// use a fresh group per runtime so identity never leaks between fixtures.
|
||||
/// </summary>
|
||||
internal static class LiveEntityRuntimeFixture
|
||||
{
|
||||
public static LiveEntityRuntime Create(
|
||||
GpuWorldState spatial,
|
||||
ILiveEntityResourceLifecycle resources,
|
||||
uint firstLocalEntityId = RuntimeEntityDirectory.FirstLocalEntityId)
|
||||
{
|
||||
var lifetime = new RuntimeEntityObjectLifetime(firstLocalEntityId);
|
||||
return new LiveEntityRuntime(spatial, resources, lifetime);
|
||||
}
|
||||
|
||||
public static LiveEntityRuntime Create(
|
||||
GpuWorldState spatial,
|
||||
ILiveEntityResourceLifecycle resources,
|
||||
Action<LiveEntityRecord> tearDownRuntimeComponents,
|
||||
uint firstLocalEntityId = RuntimeEntityDirectory.FirstLocalEntityId)
|
||||
{
|
||||
var lifetime = new RuntimeEntityObjectLifetime(firstLocalEntityId);
|
||||
return new LiveEntityRuntime(
|
||||
spatial,
|
||||
resources,
|
||||
tearDownRuntimeComponents,
|
||||
lifetime);
|
||||
}
|
||||
|
||||
public static LiveEntityRuntime Create(
|
||||
GpuWorldState spatial,
|
||||
ILiveEntityResourceLifecycle resources,
|
||||
ILiveEntityRuntimeComponentLifecycle runtimeComponentLifecycle,
|
||||
uint firstLocalEntityId = RuntimeEntityDirectory.FirstLocalEntityId)
|
||||
{
|
||||
var lifetime = new RuntimeEntityObjectLifetime(firstLocalEntityId);
|
||||
return new LiveEntityRuntime(
|
||||
spatial,
|
||||
resources,
|
||||
runtimeComponentLifecycle,
|
||||
lifetime);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue