Step 5 storng option
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
#include "CommittedLiveState.h"
|
||||
|
||||
bool CommittedLiveState::LoadPersistentStateValue(const JsonValue& root)
|
||||
{
|
||||
return mLayerStack.LoadPersistentStateValue(root);
|
||||
}
|
||||
|
||||
JsonValue CommittedLiveState::BuildPersistentStateValue(const ShaderPackageCatalog& shaderCatalog) const
|
||||
{
|
||||
return mLayerStack.BuildPersistentStateValue(shaderCatalog);
|
||||
}
|
||||
|
||||
void CommittedLiveState::NormalizeLayerIds()
|
||||
{
|
||||
mLayerStack.NormalizeLayerIds();
|
||||
}
|
||||
|
||||
void CommittedLiveState::EnsureDefaultsForAllLayers(const ShaderPackageCatalog& shaderCatalog)
|
||||
{
|
||||
mLayerStack.EnsureDefaultsForAllLayers(shaderCatalog);
|
||||
}
|
||||
|
||||
void CommittedLiveState::EnsureDefaultLayer(const ShaderPackageCatalog& shaderCatalog)
|
||||
{
|
||||
mLayerStack.EnsureDefaultLayer(shaderCatalog);
|
||||
}
|
||||
|
||||
void CommittedLiveState::RemoveLayersWithMissingPackages(const ShaderPackageCatalog& shaderCatalog)
|
||||
{
|
||||
mLayerStack.RemoveLayersWithMissingPackages(shaderCatalog);
|
||||
}
|
||||
|
||||
bool CommittedLiveState::CreateLayer(const ShaderPackageCatalog& shaderCatalog, const std::string& shaderId, std::string& error)
|
||||
{
|
||||
return mLayerStack.CreateLayer(shaderCatalog, shaderId, error);
|
||||
}
|
||||
|
||||
bool CommittedLiveState::DeleteLayer(const std::string& layerId, std::string& error)
|
||||
{
|
||||
return mLayerStack.DeleteLayer(layerId, error);
|
||||
}
|
||||
|
||||
bool CommittedLiveState::MoveLayer(const std::string& layerId, int direction, std::string& error)
|
||||
{
|
||||
return mLayerStack.MoveLayer(layerId, direction, error);
|
||||
}
|
||||
|
||||
bool CommittedLiveState::MoveLayerToIndex(const std::string& layerId, std::size_t targetIndex, std::string& error)
|
||||
{
|
||||
return mLayerStack.MoveLayerToIndex(layerId, targetIndex, error);
|
||||
}
|
||||
|
||||
bool CommittedLiveState::SetLayerBypassState(const std::string& layerId, bool bypassed, std::string& error)
|
||||
{
|
||||
return mLayerStack.SetLayerBypassState(layerId, bypassed, error);
|
||||
}
|
||||
|
||||
bool CommittedLiveState::SetLayerShaderSelection(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, const std::string& shaderId, std::string& error)
|
||||
{
|
||||
return mLayerStack.SetLayerShaderSelection(shaderCatalog, layerId, shaderId, error);
|
||||
}
|
||||
|
||||
bool CommittedLiveState::SetParameterValue(const std::string& layerId, const std::string& parameterId, const ShaderParameterValue& value, std::string& error)
|
||||
{
|
||||
return mLayerStack.SetParameterValue(layerId, parameterId, value, error);
|
||||
}
|
||||
|
||||
bool CommittedLiveState::ResetLayerParameterValues(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, std::string& error)
|
||||
{
|
||||
return mLayerStack.ResetLayerParameterValues(shaderCatalog, layerId, error);
|
||||
}
|
||||
|
||||
bool CommittedLiveState::HasLayer(const std::string& layerId) const
|
||||
{
|
||||
return mLayerStack.HasLayer(layerId);
|
||||
}
|
||||
|
||||
bool CommittedLiveState::TryGetParameterById(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, const std::string& parameterId, StoredParameterSnapshot& snapshot, std::string& error) const
|
||||
{
|
||||
return mLayerStack.TryGetParameterById(shaderCatalog, layerId, parameterId, snapshot, error);
|
||||
}
|
||||
|
||||
bool CommittedLiveState::TryGetParameterByControlKey(const ShaderPackageCatalog& shaderCatalog, const std::string& layerKey, const std::string& parameterKey, StoredParameterSnapshot& snapshot, std::string& error) const
|
||||
{
|
||||
return mLayerStack.TryGetParameterByControlKey(shaderCatalog, layerKey, parameterKey, snapshot, error);
|
||||
}
|
||||
|
||||
bool CommittedLiveState::ResolveLayerMove(const std::string& layerId, int direction, bool& shouldMove, std::string& error) const
|
||||
{
|
||||
return mLayerStack.ResolveLayerMove(layerId, direction, shouldMove, error);
|
||||
}
|
||||
|
||||
bool CommittedLiveState::ResolveLayerMoveToIndex(const std::string& layerId, std::size_t targetIndex, bool& shouldMove, std::string& error) const
|
||||
{
|
||||
return mLayerStack.ResolveLayerMoveToIndex(layerId, targetIndex, shouldMove, error);
|
||||
}
|
||||
|
||||
JsonValue CommittedLiveState::BuildStackPresetValue(const ShaderPackageCatalog& shaderCatalog, const std::string& presetName) const
|
||||
{
|
||||
return mLayerStack.BuildStackPresetValue(shaderCatalog, presetName);
|
||||
}
|
||||
|
||||
bool CommittedLiveState::LoadStackPresetValue(const ShaderPackageCatalog& shaderCatalog, const JsonValue& root, std::string& error)
|
||||
{
|
||||
return mLayerStack.LoadStackPresetValue(shaderCatalog, root, error);
|
||||
}
|
||||
|
||||
CommittedLiveStateReadModel CommittedLiveState::BuildReadModel(const ShaderPackageCatalog& shaderCatalog) const
|
||||
{
|
||||
CommittedLiveStateReadModel model;
|
||||
model.layers = mLayerStack.Layers();
|
||||
model.packagesById = shaderCatalog.CaptureSnapshot().packagesById;
|
||||
return model;
|
||||
}
|
||||
|
||||
std::vector<CommittedLiveState::LayerPersistentState> CommittedLiveState::CopyLayerStates() const
|
||||
{
|
||||
return mLayerStack.Layers();
|
||||
}
|
||||
|
||||
const std::vector<CommittedLiveState::LayerPersistentState>& CommittedLiveState::Layers() const
|
||||
{
|
||||
return mLayerStack.Layers();
|
||||
}
|
||||
|
||||
std::vector<CommittedLiveState::LayerPersistentState>& CommittedLiveState::Layers()
|
||||
{
|
||||
return mLayerStack.Layers();
|
||||
}
|
||||
|
||||
const CommittedLiveState::LayerPersistentState* CommittedLiveState::FindLayerById(const std::string& layerId) const
|
||||
{
|
||||
return mLayerStack.FindLayerById(layerId);
|
||||
}
|
||||
|
||||
const LayerStackStore& CommittedLiveState::LayerStack() const
|
||||
{
|
||||
return mLayerStack;
|
||||
}
|
||||
|
||||
LayerStackStore& CommittedLiveState::LayerStack()
|
||||
{
|
||||
return mLayerStack;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include "LayerStackStore.h"
|
||||
#include "RuntimeStoreReadModels.h"
|
||||
#include "ShaderPackageCatalog.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class CommittedLiveState
|
||||
{
|
||||
public:
|
||||
using LayerPersistentState = LayerStackStore::LayerPersistentState;
|
||||
using StoredParameterSnapshot = LayerStackStore::StoredParameterSnapshot;
|
||||
|
||||
bool LoadPersistentStateValue(const JsonValue& root);
|
||||
JsonValue BuildPersistentStateValue(const ShaderPackageCatalog& shaderCatalog) const;
|
||||
void NormalizeLayerIds();
|
||||
void EnsureDefaultsForAllLayers(const ShaderPackageCatalog& shaderCatalog);
|
||||
void EnsureDefaultLayer(const ShaderPackageCatalog& shaderCatalog);
|
||||
void RemoveLayersWithMissingPackages(const ShaderPackageCatalog& shaderCatalog);
|
||||
|
||||
bool CreateLayer(const ShaderPackageCatalog& shaderCatalog, const std::string& shaderId, std::string& error);
|
||||
bool DeleteLayer(const std::string& layerId, std::string& error);
|
||||
bool MoveLayer(const std::string& layerId, int direction, std::string& error);
|
||||
bool MoveLayerToIndex(const std::string& layerId, std::size_t targetIndex, std::string& error);
|
||||
bool SetLayerBypassState(const std::string& layerId, bool bypassed, std::string& error);
|
||||
bool SetLayerShaderSelection(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, const std::string& shaderId, std::string& error);
|
||||
bool SetParameterValue(const std::string& layerId, const std::string& parameterId, const ShaderParameterValue& value, std::string& error);
|
||||
bool ResetLayerParameterValues(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, std::string& error);
|
||||
|
||||
bool HasLayer(const std::string& layerId) const;
|
||||
bool TryGetParameterById(const ShaderPackageCatalog& shaderCatalog, const std::string& layerId, const std::string& parameterId, StoredParameterSnapshot& snapshot, std::string& error) const;
|
||||
bool TryGetParameterByControlKey(const ShaderPackageCatalog& shaderCatalog, const std::string& layerKey, const std::string& parameterKey, StoredParameterSnapshot& snapshot, std::string& error) const;
|
||||
bool ResolveLayerMove(const std::string& layerId, int direction, bool& shouldMove, std::string& error) const;
|
||||
bool ResolveLayerMoveToIndex(const std::string& layerId, std::size_t targetIndex, bool& shouldMove, std::string& error) const;
|
||||
|
||||
JsonValue BuildStackPresetValue(const ShaderPackageCatalog& shaderCatalog, const std::string& presetName) const;
|
||||
bool LoadStackPresetValue(const ShaderPackageCatalog& shaderCatalog, const JsonValue& root, std::string& error);
|
||||
|
||||
CommittedLiveStateReadModel BuildReadModel(const ShaderPackageCatalog& shaderCatalog) const;
|
||||
std::vector<LayerPersistentState> CopyLayerStates() const;
|
||||
const std::vector<LayerPersistentState>& Layers() const;
|
||||
std::vector<LayerPersistentState>& Layers();
|
||||
const LayerPersistentState* FindLayerById(const std::string& layerId) const;
|
||||
const LayerStackStore& LayerStack() const;
|
||||
LayerStackStore& LayerStack();
|
||||
|
||||
private:
|
||||
LayerStackStore mLayerStack;
|
||||
};
|
||||
@@ -92,7 +92,7 @@ std::vector<RuntimeStateLayerDescriptor> GetRuntimeStateLayerInventory()
|
||||
{
|
||||
RuntimeStateLayerKind::CommittedLive,
|
||||
"Committed live state",
|
||||
"RuntimeCoordinator, physically backed by RuntimeStore during migration",
|
||||
"RuntimeCoordinator / CommittedLiveState",
|
||||
"Current running session",
|
||||
"May request persistence depending on mutation policy",
|
||||
"Operator/session truth until changed again"
|
||||
@@ -152,14 +152,14 @@ std::vector<RuntimeStateFieldDescriptor> GetRuntimeStateFieldInventory()
|
||||
RuntimeStateField::CommittedSessionParameterValues,
|
||||
ClassifyRuntimeStateField(RuntimeStateField::CommittedSessionParameterValues),
|
||||
"committed session parameter values",
|
||||
"RuntimeCoordinator policy, RuntimeStore backing during migration",
|
||||
"RuntimeCoordinator policy, CommittedLiveState backing",
|
||||
"Operator/API truth after accepted mutations"
|
||||
},
|
||||
{
|
||||
RuntimeStateField::CommittedLayerBypass,
|
||||
ClassifyRuntimeStateField(RuntimeStateField::CommittedLayerBypass),
|
||||
"committed layer bypass",
|
||||
"RuntimeCoordinator policy, RuntimeStore backing during migration",
|
||||
"RuntimeCoordinator policy, CommittedLiveState backing",
|
||||
"Current operator/API bypass state"
|
||||
},
|
||||
{
|
||||
@@ -227,4 +227,3 @@ std::vector<RuntimeStateFieldDescriptor> GetRuntimeStateFieldInventory()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user