summaryrefslogtreecommitdiffstats
path: root/configd/src/apps/sentinel/env.h
diff options
context:
space:
mode:
Diffstat (limited to 'configd/src/apps/sentinel/env.h')
-rw-r--r--configd/src/apps/sentinel/env.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/configd/src/apps/sentinel/env.h b/configd/src/apps/sentinel/env.h
new file mode 100644
index 00000000000..da04a328c41
--- /dev/null
+++ b/configd/src/apps/sentinel/env.h
@@ -0,0 +1,44 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include "cmdq.h"
+#include "config-owner.h"
+#include "metrics.h"
+#include "rpcserver.h"
+#include "state-api.h"
+#include <vespa/vespalib/net/state_server.h>
+
+namespace config::sentinel {
+
+/**
+ * Environment for config sentinel, with config
+ * subscription, rpc server, state server, and
+ * metrics.
+ **/
+class Env {
+public:
+ Env();
+ ~Env();
+
+ ConfigOwner &configOwner() { return _cfgOwner; }
+ CommandQueue &commandQueue() { return _rpcCommandQueue; }
+ StartMetrics &metrics() { return _startMetrics; }
+
+ void boot(const std::string &configId);
+ void rpcPort(int portnum);
+ void statePort(int portnum);
+
+ void notifyConfigUpdated();
+
+private:
+ ConfigOwner _cfgOwner;
+ CommandQueue _rpcCommandQueue;
+ std::unique_ptr<RpcServer> _rpcServer;
+ StateApi _stateApi;
+ StartMetrics _startMetrics;
+ std::unique_ptr<vespalib::StateServer> _stateServer;
+ int _statePort;
+};
+
+}