1 parent
639362fbf5
commit
bdd69f0aad
101 files changed
+22691
-531
No files matched your search
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <variant>
|
||||
|
||||
namespace Echoion::Updater
|
||||
{
|
||||
|
||||
struct RuntimeActivation {
|
||||
std::string stagingId;
|
||||
std::string version;
|
||||
std::string manifestSha256;
|
||||
std::uint32_t retainHealthyVersions = 2;
|
||||
};
|
||||
|
||||
struct RuntimeRollback {
|
||||
std::string version;
|
||||
std::uint32_t retainHealthyVersions = 2;
|
||||
};
|
||||
|
||||
struct RuntimeCommit {
|
||||
std::string version;
|
||||
std::uint32_t retainHealthyVersions = 2;
|
||||
};
|
||||
|
||||
struct PendingRuntime {
|
||||
std::string candidateId;
|
||||
std::string version;
|
||||
std::string previousVersion;
|
||||
std::string manifestSha256;
|
||||
std::string activatedAt;
|
||||
std::uint32_t retainHealthyVersions = 2;
|
||||
};
|
||||
|
||||
using PrivilegedRequest =
|
||||
std::variant<RuntimeActivation, RuntimeRollback, RuntimeCommit>;
|
||||
|
||||
[[nodiscard]] RuntimeActivation
|
||||
parseActivationRequest(std::string_view json);
|
||||
[[nodiscard]] PrivilegedRequest
|
||||
parsePrivilegedRequest(std::string_view json);
|
||||
[[nodiscard]] PendingRuntime parsePendingRuntime(std::string_view json);
|
||||
|
||||
[[nodiscard]] std::string sha256File(const std::filesystem::path& path);
|
||||
|
||||
void copyAndValidateRelease(int sourceDirectoryDescriptor,
|
||||
const std::filesystem::path& destination,
|
||||
const RuntimeActivation& activation);
|
||||
void removeReleaseTreeAt(int parentDirectoryDescriptor,
|
||||
std::string_view name);
|
||||
|
||||
void validateRelease(const std::filesystem::path& release,
|
||||
const std::string& expectedVersion,
|
||||
const std::string& expectedManifestSha256 = {});
|
||||
|
||||
void syncReleaseTree(const std::filesystem::path& root);
|
||||
|
||||
} // namespace Echoion::Updater
|
||||
Reference in new issue
Block a user