1 parent
11850b1a8d
commit
46ff4068cf
9 files changed
+4657
-96
No files matched your search
@@ -0,0 +1,83 @@
|
||||
#pragma once
|
||||
|
||||
#include <Types.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace Echoion::Standalone
|
||||
{
|
||||
// Roll back any uncommitted managed-plugin activation before Core loads and
|
||||
// discovers plugin `current` links. This must run before PluginHost
|
||||
// startup.
|
||||
[[nodiscard]] Api::Result<void> reconcileManagedPluginUpdates(
|
||||
const std::filesystem::path& stateDirectory);
|
||||
|
||||
// Host-owned update coordinator. Core only forwards authenticated RPC
|
||||
// requests across the append-only host interface; all trust, download,
|
||||
// staging and activation decisions remain in the long-lived daemon.
|
||||
class UpdateService final
|
||||
{
|
||||
public:
|
||||
|
||||
struct Options {
|
||||
std::filesystem::path configPath;
|
||||
std::filesystem::path stateDirectory;
|
||||
std::filesystem::path installRoot;
|
||||
std::filesystem::path runningExecutable;
|
||||
std::filesystem::path currentCore;
|
||||
std::filesystem::path releaseManifestPath;
|
||||
std::string officialFeedUrl;
|
||||
std::string officialPublicKeysJson = "[]";
|
||||
std::string runtimeVersion;
|
||||
std::string apiVersion;
|
||||
std::string toolchainAbi;
|
||||
// Trusted administrator drop directory for file://
|
||||
// feeds/artifacts. Empty selects stateDirectory /
|
||||
// "incoming".
|
||||
std::filesystem::path incomingDirectory;
|
||||
};
|
||||
|
||||
struct Hooks {
|
||||
std::function<Api::Result<void>(
|
||||
const std::filesystem::path&)>
|
||||
replaceCore;
|
||||
std::function<Api::Result<std::string>(const std::string&)>
|
||||
managePlugins;
|
||||
std::function<Api::Result<std::string>(const std::string&)>
|
||||
manageRuntime;
|
||||
std::function<bool()> playbackActive;
|
||||
std::function<std::string()> coreVersion;
|
||||
};
|
||||
|
||||
UpdateService(Options options, Hooks hooks);
|
||||
~UpdateService();
|
||||
|
||||
UpdateService(const UpdateService&) = delete;
|
||||
UpdateService& operator=(const UpdateService&) = delete;
|
||||
UpdateService(UpdateService&&) noexcept;
|
||||
UpdateService& operator=(UpdateService&&) noexcept;
|
||||
|
||||
[[nodiscard]] Api::Result<void> start();
|
||||
void stop() noexcept;
|
||||
|
||||
// Execute host mutations which must not run on the Core RPC stack.
|
||||
// The daemon calls this from its polling loop after an RPC has
|
||||
// returned.
|
||||
void processPendingHostActions();
|
||||
|
||||
// Methods are the internal `updates.*` names forwarded by Core.
|
||||
// Requests and successful responses are JSON documents matching the
|
||||
// web contract.
|
||||
[[nodiscard]] Api::Result<std::string>
|
||||
handle(const std::string& method,
|
||||
const std::string& requestJson);
|
||||
|
||||
private:
|
||||
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> impl_;
|
||||
};
|
||||
} // namespace Echoion::Standalone
|
||||
Reference in new issue
Block a user