blob: c1e41249dd5dbe5d23664f2f45076bcf0aabece2 (
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
|
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "rpcserver.h"
#include "cc-result.h"
#include <vespa/config-sentinel.h>
#include <vespa/config-model.h>
#include <string>
#include <map>
using cloud::config::SentinelConfig;
using cloud::config::ModelConfig;
namespace config::sentinel {
/**
* Utility class for running connectivity check.
**/
class Connectivity {
public:
using SpecMap = std::map<std::string, int>;
using HostAndPort = SpecMap::value_type;
Connectivity();
~Connectivity();
void configure(const SentinelConfig::Connectivity &config);
bool checkConnectivity(RpcServer &rpcServer);
private:
class Accumulator {
private:
size_t _numOk = 0;
size_t _numBad = 0;
size_t _numHandled = 0;
public:
void handleResult(CcResult value);
bool enoughOk(const SentinelConfig::Connectivity &config) const;
};
SentinelConfig::Connectivity _config;
SpecMap _checkSpecs;
std::map<std::string, std::string> _detailsPerHost;
};
}
|