blob: 1885aa7e534b2f3106813e10675a8b0a7550241f (
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 Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/config/common/configkey.h>
#include <vespa/config/common/source.h>
#include <vespa/fnet/frt/invoker.h>
namespace config {
class FRTConfigRequestFactory;
class ConnectionFactory;
class ConfigAgent;
class FRTConfigRequest;
/**
* Class for sending and receiving config requests via FRT.
*/
class FRTSource : public Source,
public FRT_IRequestWait
{
public:
FRTSource(std::shared_ptr<ConnectionFactory> connectionFactory, const FRTConfigRequestFactory & requestFactory, std::unique_ptr<ConfigAgent> agent, const ConfigKey & key);
~FRTSource() override;
void RequestDone(FRT_RPCRequest * request) override;
void close() override;
void reload(int64_t generation) override;
void getConfig() override;
private:
void scheduleNextGetConfig();
std::shared_ptr<ConnectionFactory> _connectionFactory;
const FRTConfigRequestFactory & _requestFactory;
std::unique_ptr<ConfigAgent> _agent;
std::unique_ptr<FRTConfigRequest> _currentRequest;
const ConfigKey _key;
std::mutex _lock; // Protects _task and _closed
std::unique_ptr<FNET_Task> _task;
bool _closed;
};
} // namespace config
|