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

#pragma once

#include "service_mapping.h"
#include <memory>
#include <functional>

namespace slobrok {

struct MappingMonitorOwner {
    virtual void up(const ServiceMapping& mapping) = 0;
    virtual void down(const ServiceMapping& mapping) = 0;
protected:
    virtual ~MappingMonitorOwner() = default;
};

struct MappingMonitor {
    using UP = std::unique_ptr<MappingMonitor>;
    virtual void start(const ServiceMapping& mapping, bool hurry) = 0;
    virtual void stop(const ServiceMapping& mapping) = 0;
    virtual ~MappingMonitor() = default;
};

using MappingMonitorFactory = std::function<MappingMonitor::UP(MappingMonitorOwner &)>;

} // namespace slobrok