aboutsummaryrefslogtreecommitdiffstats
path: root/configd/src/apps/sentinel/peer-check.h
blob: 041f8a68be16d2ee5e39bd15dd0ce6020d3522e5 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "status-callback.h"
#include <string>
#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 {

class PeerCheck : public FRT_IRequestWait
{
public:
    PeerCheck(StatusCallback &callback, const std::string &host, int portnum, FRT_Supervisor &orb, int timeout_ms);
    ~PeerCheck();

    bool okStatus() const { return _statusOk; }
    const std::string& getHostname() const { return _hostname; }

    PeerCheck(const PeerCheck &) = delete;
    PeerCheck(PeerCheck &&) = delete;
    PeerCheck& operator= (const PeerCheck &) = delete;
    PeerCheck& operator= (PeerCheck &&) = delete;

    /** from FRT_IRequestWait **/
    void RequestDone(FRT_RPCRequest *req) override;
private:
    StatusCallback &_callback;
    std::string     _hostname;
    int             _portnum;
    FRT_Target     *_target;
    FRT_RPCRequest *_req;
    bool            _statusOk;
};

}