feat(replay): add BattleContextStore for start->finish handoff
Bridges the start-time -> finish-time gap. /finish carries neither battle_id nor opponent identity; this store holds both for the finish handler to compose a ViewerBattleHistory row. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
17
SVSim.Database/Services/Replay/IBattleContextStore.cs
Normal file
17
SVSim.Database/Services/Replay/IBattleContextStore.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace SVSim.Database.Services.Replay;
|
||||
|
||||
/// <summary>
|
||||
/// In-memory per-viewer battle context store. Bridges the start-time → finish-time
|
||||
/// gap: the /finish request body carries neither battle_id nor opponent identity,
|
||||
/// so this stash holds everything the finish hook needs to compose a
|
||||
/// ViewerBattleHistory row.
|
||||
/// </summary>
|
||||
public interface IBattleContextStore
|
||||
{
|
||||
/// <summary>Store the viewer's active battle context. Overwrites any prior entry.</summary>
|
||||
void Set(long viewerId, BattleContext ctx);
|
||||
|
||||
/// <summary>Atomic read+clear. Returns null when no context (server restart,
|
||||
/// non-tracked family, already taken). Finish handlers must tolerate null.</summary>
|
||||
BattleContext? TakeFor(long viewerId);
|
||||
}
|
||||
Reference in New Issue
Block a user