blob: 9a347e8cd85e0da48ea6fc0f5190ad678868acf4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// 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; }
static constexpr int maxRetryLoops = 5;
static constexpr int maxRetriesInsideLoop = 10;
void boot(const std::string &configId);
void rpcPort(int portnum);
void statePort(int portnum);
void notifyConfigUpdated();
private:
void respondAsEmpty();
bool waitForConnectivity(int outerRetry);
ConfigOwner _cfgOwner;
CommandQueue _rpcCommandQueue;
std::unique_ptr<RpcServer> _rpcServer;
StateApi _stateApi;
StartMetrics _startMetrics;
std::unique_ptr<vespalib::StateServer> _stateServer;
int _statePort;
};
}
|