aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.h
blob: b5011575ceda304aca985e3fcac9203e2c958552 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "translogserver.h"
#include <vespa/searchlib/config/config-translogserver.h>
#include <vespa/config/helper/ifetchercallback.h>
#include <vespa/vespalib/util/ptrholder.h>

namespace config {
    class ConfigFetcher;
    class ConfigUri;
}
namespace search::common { class FileHeaderContext; }

namespace search::transactionlog {

class TransLogServerApp : public config::IFetcherCallback<searchlib::TranslogserverConfig>
{
private:
    mutable std::mutex                                   _lock;
    TransLogServer::SP                                   _tls;
    vespalib::PtrHolder<searchlib::TranslogserverConfig> _tlsConfig;
    std::unique_ptr<config::ConfigFetcher>               _tlsConfigFetcher;
    const common::FileHeaderContext                    & _fileHeaderContext;

    void configure(std::unique_ptr<searchlib::TranslogserverConfig> cfg) override ;

public:
    TransLogServerApp(const config::ConfigUri & tlsConfigUri,
                      const common::FileHeaderContext &fileHeaderContext);
    ~TransLogServerApp() override;

    TransLogServer::SP getTransLogServer() const;

    void start(FNET_Transport & transport, uint32_t num_cores);
};

}