Interface IHotkeySystemRuntimeData
- Namespace
- FishMMO.Server.Core.World.SceneServer
- Assembly
- FishMMO.Server.dll
Runtime state for hotkey ingress guards and pending hotkey persistence.
public interface IHotkeySystemRuntimeData : IRuntimeDataContainer, IServerComponent
Properties
IngressGuard
Shared ingress guard for per-connection per-operation debounce and in-flight tracking.
IngressGuard IngressGuard { get; }
Property Value
Methods
DrainHotkeyWrites(List<KeyValuePair<long, HotkeyData[]>>)
Moves every staged snapshot into destination and empties the stage.
bool DrainHotkeyWrites(List<KeyValuePair<long, HotkeyData[]>> destination)
Parameters
destinationList<KeyValuePair<long, HotkeyData[]>>List to receive the staged snapshots.
Returns
- bool
True if anything was drained.
NextHotkeyVersion()
Produces the next strictly-increasing persistence version for a hotkey row.
long NextHotkeyVersion()
Returns
- long
A monotonic version value.
Remarks
The hotkey upsert is gated WHERE EXCLUDED.version > character_hotkey.version,
so a write only lands if it carries a strictly larger version than whatever is already
in the row. Nothing in the runtime tracked a hotkey version at all — the load path
reads the column and discards it — so the version has to be derived rather than
remembered.
DateTime.UtcNow.Ticks supplies that: it is larger than every version any
previous session wrote, and the running maximum below keeps it strictly increasing
even when two writes land inside one tick of clock resolution. It is deliberately NOT
long.MaxValue — the item layer's per-slot poisoning bug (audit CRIT-2) is
exactly what happens when a "make sure this write wins" sentinel is stamped into a
version column: the row becomes permanently unwritable.
StageHotkeyWrite(long, IReadOnlyList<HotkeyData>)
Records the character's current hotkey bar as the next thing to be written to the database, replacing any earlier unwritten snapshot for that character.
void StageHotkeyWrite(long characterID, IReadOnlyList<HotkeyData> hotkeys)
Parameters
characterIDlongThe character whose bar changed.
hotkeysIReadOnlyList<HotkeyData>The character's live hotkey list. Copied, not retained.
Remarks
Coalescing by character is deliberate. Dragging one ability along a twelve-slot bar produces a dozen accepted requests in a couple of seconds, and each one would otherwise be its own round trip to Postgres. Only the newest snapshot can be correct, so keeping only the newest is both cheaper and more accurate.
TryDrainHotkeyWrite(long, out HotkeyData[])
Removes and returns the staged snapshot for one character, if any.
bool TryDrainHotkeyWrite(long characterID, out HotkeyData[] hotkeys)
Parameters
characterIDlongThe character to drain.
hotkeysHotkeyData[]The staged snapshot.
Returns
- bool
True if a snapshot was staged for that character.