1#ifndef YAZE_APP_NET_ROM_VERSION_MANAGER_H_
2#define YAZE_APP_NET_ROM_VERSION_MANAGER_H_
9#include "absl/status/status.h"
10#include "absl/status/statusor.h"
14#include "nlohmann/json.hpp"
39 nlohmann::json metadata;
50 std::vector<std::pair<size_t, std::vector<uint8_t>>>
changes;
88 absl::StatusOr<std::string>
CreateSnapshot(
const std::string& description,
89 const std::string& creator,
90 bool is_checkpoint =
false);
105 std::vector<RomSnapshot>
GetSnapshots(
bool safe_points_only =
false)
const;
110 absl::StatusOr<RomSnapshot>
GetSnapshot(
const std::string& snapshot_id)
const;
121 const std::string& to_id)
const;
137 const std::string& filepath);
177 std::vector<uint8_t>
CompressData(
const std::vector<uint8_t>& data)
const;
179 const std::vector<uint8_t>& compressed)
const;
224 void SetHost(
const std::string& host_username);
230 const std::string& sender,
231 const std::string& description,
232 const nlohmann::json& proposal_data);
238 const std::string& username,
bool approved);
254 const std::string& proposal_id)
const;
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Manages proposal approval workflow for collaborative sessions.
std::vector< std::string > participants_
void SetHost(const std::string &host_username)
absl::Status RejectProposal(const std::string &proposal_id)
absl::StatusOr< ApprovalStatus > GetProposalStatus(const std::string &proposal_id) const
std::vector< ApprovalStatus > GetAuditLog() const
absl::Status VoteOnProposal(const std::string &proposal_id, const std::string &username, bool approved)
std::string host_username_
void SetApprovalMode(ApprovalMode mode)
bool IsProposalApproved(const std::string &proposal_id) const
RomVersionManager * version_mgr_
absl::Status SubmitProposal(const std::string &proposal_id, const std::string &sender, const std::string &description, const nlohmann::json &proposal_data)
std::vector< ApprovalStatus > GetPendingProposals() const
bool CheckApprovalThreshold(const ApprovalStatus &status) const
absl::Status ApplyProposal(const std::string &proposal_id, Rom *rom)
ProposalApprovalManager(RomVersionManager *version_mgr)
std::map< std::string, ApprovalStatus > proposals_
Manages ROM versioning, snapshots, and rollback capabilities.
absl::StatusOr< VersionDiff > GenerateDiff(const std::string &from_id, const std::string &to_id) const
std::string ComputeRomHash() const
absl::Status CleanupOldSnapshots()
std::vector< uint8_t > DecompressData(const std::vector< uint8_t > &compressed) const
size_t GetTotalStorageUsed() const
absl::StatusOr< std::string > CreateSnapshot(const std::string &description, const std::string &creator, bool is_checkpoint=false)
absl::StatusOr< RomSnapshot > GetSnapshot(const std::string &snapshot_id) const
absl::Status ExportSnapshot(const std::string &snapshot_id, const std::string &filepath)
std::string GetCurrentHash() const
std::map< std::string, RomSnapshot > snapshots_
absl::Status ValidateRomIntegrity() const
absl::Status ImportSnapshot(const std::string &filepath)
std::string last_known_hash_
RomVersionManager(Rom *rom)
absl::Status Initialize(const Config &config)
absl::Status AutoRecover()
absl::StatusOr< bool > DetectCorruption()
absl::Status RestoreSnapshot(const std::string &snapshot_id)
absl::Status MarkAsSafePoint(const std::string &snapshot_id)
std::vector< uint8_t > CompressData(const std::vector< uint8_t > &data) const
int64_t last_backup_time_
absl::Status DeleteSnapshot(const std::string &snapshot_id)
std::vector< RomSnapshot > GetSnapshots(bool safe_points_only=false) const
std::string snapshot_after
std::string snapshot_before
std::map< std::string, bool > votes
Represents a versioned snapshot of ROM state.
std::vector< uint8_t > rom_data
bool enable_corruption_detection
int auto_backup_interval_seconds
size_t total_storage_bytes
size_t manual_checkpoints
int64_t oldest_snapshot_timestamp
int64_t newest_snapshot_timestamp
Represents differences between two ROM versions.
std::string from_snapshot_id
std::vector< std::pair< size_t, std::vector< uint8_t > > > changes
std::vector< std::string > proposals_applied
std::string to_snapshot_id
size_t total_bytes_changed