Migrate core infrastructure to VoidLibrary
This commit is contained in:
1 parent
53801f2b53
commit
2bdb63766d
65 files changed
+16109
-12011
No files matched your search
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
#include "StateBlob.hpp"
|
||||
#include "echoion/core/state/StateVersions.hpp"
|
||||
#include <Types.hpp>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace Echoion::Core
|
||||
{
|
||||
|
||||
class StateSerializer
|
||||
{
|
||||
public:
|
||||
|
||||
// Current version being used
|
||||
static constexpr uint32_t CURRENT_VERSION = 1;
|
||||
|
||||
// Serialize current state to opaque blob
|
||||
static Api::StateBlob serialize(const StateV1& state);
|
||||
|
||||
// Deserialize blob to current version (handles migration)
|
||||
static Api::Result<StateV1> deserialize(const Api::StateBlob& blob);
|
||||
|
||||
// Check if version is supported
|
||||
static bool isVersionSupported(uint32_t version);
|
||||
|
||||
// Get supported version range
|
||||
static uint32_t getMinimumSupportedVersion();
|
||||
static uint32_t getCurrentVersion();
|
||||
|
||||
private:
|
||||
|
||||
// Extract version from JSON blob
|
||||
static uint32_t extractVersion(const std::string& jsonStr);
|
||||
|
||||
// Helper to get current timestamp
|
||||
static std::string getCurrentTimestampISO8601();
|
||||
|
||||
// Make it accessible to StateMigration
|
||||
friend class StateMigration;
|
||||
};
|
||||
|
||||
} // namespace Echoion::Core
|
||||
Reference in new issue
Block a user