aboutsummaryrefslogtreecommitdiffstats
path: root/messagebus/src/vespa/messagebus/testlib/slobrok.h
blob: bcc90ca3f17edc3bdc8659e5ff78d98662ac8072 (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 Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/messagebus/common.h>
#include <vespa/slobrok/cfg.h>
#include <thread>

namespace slobrok {
class SBEnv;
} // namespace slobrok

namespace mbus {

class Slobrok
{
private:
    std::unique_ptr<slobrok::SBEnv>  _env;
    int _port;
    std::thread _thread;

    Slobrok(const Slobrok &);
    Slobrok &operator=(const Slobrok &);

    void init();

public:
    using UP = std::unique_ptr<Slobrok>;
    Slobrok();
    Slobrok(int port);
    ~Slobrok();
    int port() const;
    config::ConfigUri config() const;
};

} // namespace mbus