blob: d8803e22a02eb64e04a73a6e7832fdcd47b4e32f (
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.
#include <string>
#include <vespa/vespalib/util/count_down_latch.h>
#include <vespa/fnet/frt/supervisor.h>
#include <vespa/fnet/frt/invoker.h>
#include <vespa/fnet/frt/rpcrequest.h>
#include <vespa/fnet/frt/supervisor.h>
#include <vespa/fnet/frt/target.h>
namespace config::sentinel {
struct OutwardCheckContext {
vespalib::CountDownLatch latch;
std::string myHostname;
int myPortnum;
FRT_Supervisor &orb;
OutwardCheckContext(size_t count,
const std::string &hostname,
int portnumber,
FRT_Supervisor &supervisor)
: latch(count),
myHostname(hostname),
myPortnum(portnumber),
orb(supervisor)
{}
~OutwardCheckContext();
};
enum class CcResult { UNKNOWN, AFFIRMED_DOWN, CONN_FAIL, UNREACHABLE_UP, REVERSE_FAIL, REVERSE_UNAVAIL, ALL_OK };
class OutwardCheck : public FRT_IRequestWait {
private:
CcResult _result = CcResult::UNKNOWN;
FRT_Target *_target = nullptr;
FRT_RPCRequest *_req = nullptr;
std::string _spec;
OutwardCheckContext &_context;
public:
OutwardCheck(const std::string &spec, OutwardCheckContext &context);
virtual ~OutwardCheck();
void RequestDone(FRT_RPCRequest *req) override;
bool ok() const { return _result == CcResult::ALL_OK; }
CcResult result() const { return _result; }
void classifyResult(CcResult value);
};
}
|