Move daemon checkpoint state onto managed pointers
This commit is contained in:
parent
7043db8f4b
commit
d2baa6c4b4
4 changed files with 63 additions and 27 deletions
|
|
@ -298,16 +298,17 @@ public static class AetheriaEveCommandBridge
|
|||
var commit = command.LoadoutTemplate ?? throw new InvalidOperationException(
|
||||
$"Loadout template command '{command.CommandId}' is missing its typed payload.");
|
||||
var loadout = AetheriaRuntimeStateMapper.ToLoadoutTemplate(commit, command.IssuedAtUtc);
|
||||
await node.PutLoadoutTemplateAsync(
|
||||
AetheriaRuntimeStateMapper.LoadoutKey(loadout.Name),
|
||||
loadout).ConfigureAwait(false);
|
||||
await node.LoadoutTemplate(AetheriaRuntimeStateMapper.LoadoutKey(loadout.Name))
|
||||
.ReplaceAsync(loadout)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static async Task ExecuteTradeValuePolicyCommandAsync(
|
||||
AetheriaStateNode node,
|
||||
AetheriaRuntimeEveCommandDocument command)
|
||||
{
|
||||
var policy = await node.GetTradeValuePolicyAsync().ConfigureAwait(false) ??
|
||||
var tradeValuePolicy = node.TradeValuePolicy();
|
||||
var policy = await tradeValuePolicy.ReadAsync().ConfigureAwait(false) ??
|
||||
AetheriaRuntimeStateMapper.ToTradeValuePolicy(
|
||||
AetheriaRuntimeTradeValueSettings.Default,
|
||||
command.IssuedAtUtc);
|
||||
|
|
@ -343,7 +344,7 @@ public static class AetheriaEveCommandBridge
|
|||
if (persistPolicy)
|
||||
{
|
||||
policy.UpdatedAtUtc = command.IssuedAtUtc;
|
||||
await node.PutTradeValuePolicyAsync(policy).ConfigureAwait(false);
|
||||
await tradeValuePolicy.ReplaceAsync(policy).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -225,6 +225,37 @@ public sealed class AetheriaStateNode : IAsyncDisposable, IDisposable
|
|||
return MutableDocumentPointer<AetheriaEveCommandAcceptanceStatus>(EveCommandAcceptanceStatusKey);
|
||||
}
|
||||
|
||||
public CultMeshMutableStatePointer<AetheriaWorldState> World()
|
||||
{
|
||||
return MutableDocumentPointer<AetheriaWorldState>(new CultRecordKey("global:aetheria.world_state.v1"));
|
||||
}
|
||||
|
||||
public CultMeshMutableStatePointer<AetheriaTradeValuePolicy> TradeValuePolicy()
|
||||
{
|
||||
return MutableDocumentPointer<AetheriaTradeValuePolicy>(
|
||||
new CultRecordKey(AetheriaTradeValuePolicy.RecordKey));
|
||||
}
|
||||
|
||||
public CultMeshMutableStatePointer<AetheriaLoadoutTemplate> LoadoutTemplate(CultRecordKey key)
|
||||
{
|
||||
return MutableDocumentPointer<AetheriaLoadoutTemplate>(key);
|
||||
}
|
||||
|
||||
public CultMeshMutableStatePointer<AetheriaRunState> RunState(CultRecordKey key)
|
||||
{
|
||||
return MutableDocumentPointer<AetheriaRunState>(key);
|
||||
}
|
||||
|
||||
public CultMeshMutableStatePointer<AetheriaZoneState> ZoneState(CultRecordKey key)
|
||||
{
|
||||
return MutableDocumentPointer<AetheriaZoneState>(key);
|
||||
}
|
||||
|
||||
public CultMeshMutableStatePointer<AetheriaEntitySnapshot> EntitySnapshot(CultRecordKey key)
|
||||
{
|
||||
return MutableDocumentPointer<AetheriaEntitySnapshot>(key);
|
||||
}
|
||||
|
||||
public Task<CultRecordHandle<AetheriaWorldState>> PutWorldAsync(AetheriaWorldState world)
|
||||
{
|
||||
return Database.PutAsync(new CultRecordKey("global:aetheria.world_state.v1"), world);
|
||||
|
|
|
|||
Loading…
Reference in a new issue