diff options
Diffstat (limited to 'src/zenserver/hub/zenhubserver.h')
| -rw-r--r-- | src/zenserver/hub/zenhubserver.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/zenserver/hub/zenhubserver.h b/src/zenserver/hub/zenhubserver.h index a3eeb2ead..f6a3eb1bc 100644 --- a/src/zenserver/hub/zenhubserver.h +++ b/src/zenserver/hub/zenhubserver.h @@ -4,6 +4,8 @@ #include "zenserver.h" +#include <zenutil/consul.h> + namespace cxxopts { class Options; } @@ -20,10 +22,15 @@ class HttpHubService; struct ZenHubServerConfig : public ZenServerConfig { std::string UpstreamNotificationEndpoint; - std::string InstanceId; // For use in notifications + std::string InstanceId; // For use in notifications + std::string ConsulEndpoint; // If set, enables Consul service registration + uint16_t HubBasePortNumber = 21000; + int HubInstanceLimit = 1000; + bool HubUseJobObject = true; }; class Hub; +struct HubProvisionedInstanceInfo; struct ZenHubServerConfigurator : public ZenServerConfiguratorBase { @@ -78,6 +85,9 @@ public: void SetContentRoot(std::filesystem::path Root) { m_ContentRoot = Root; } private: + void OnProvisioned(std::string_view HubInstanceId, std::string_view ModuleId, const HubProvisionedInstanceInfo& Info); + void OnDeprovisioned(std::string_view HubInstanceId, std::string_view ModuleId, const HubProvisionedInstanceInfo& Info); + bool m_IsDedicatedMode = false; bool m_TestMode = false; std::filesystem::path m_DataRoot; @@ -90,9 +100,13 @@ private: std::unique_ptr<HttpApiService> m_ApiService; std::unique_ptr<HttpFrontendService> m_FrontendService; + std::unique_ptr<consul::ConsulClient> m_ConsulClient; + std::unique_ptr<consul::ServiceRegistration> m_ConsulRegistration; + void InitializeState(const ZenHubServerConfig& ServerConfig); void InitializeServices(const ZenHubServerConfig& ServerConfig); void RegisterServices(const ZenHubServerConfig& ServerConfig); + void InitializeConsulRegistration(const ZenHubServerConfig& ServerConfig, int EffectivePort); }; } // namespace zen |