aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/vespa/config/file_acquirer/file_acquirer.h
blob: a6d90fbee15e97eca62b48e70b04586f5de7d60f (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/vespalib/stllike/string.h>
#include <memory>

class FRT_Supervisor;
class FNET_Transport;

namespace config {

/**
 * Interface used to wait for the availability of files and map file
 * references to concrete paths.
 **/
struct FileAcquirer {
    virtual vespalib::string wait_for(const vespalib::string &file_ref, double timeout_s) = 0;
    virtual ~FileAcquirer() {}
};

/**
 * File acquirer implementation using rpc to talk to an external rpc
 * server to wait for files to be ready.
 **/
class RpcFileAcquirer : public FileAcquirer
{
private:
    std::unique_ptr<FRT_Supervisor>   _orb;
    vespalib::string                  _spec;
public:
    RpcFileAcquirer(FNET_Transport & transport, const vespalib::string &spec);
    vespalib::string wait_for(const vespalib::string &file_ref, double timeout_s) override;
    ~RpcFileAcquirer() override;
};

} // namespace config