aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storageframework/generic/component/managedcomponent.h
blob: c512d399d4b9a988775dd57af00726d91f023e0e (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 Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * \class storage::framework::ManagedComponent
 * \ingroup component
 *
 * \brief Interface to expose to manager of components.
 *
 * As to not make the functions needed by the component manager exposed to the
 * component implementation, and vice versa, this interface exist to be what
 * the manager is interested in. That way, component implementation can
 * implement that privately, but expose it to the component register.
 */
#pragma once

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

namespace metrics {
    class Metric;
}

namespace storage::framework {

struct StatusReporter;
struct MetricRegistrator;
struct MetricUpdateHook;
struct ThreadPool;
struct Clock;

struct ManagedComponent {
    virtual ~ManagedComponent() = default;

    [[nodiscard]] virtual const vespalib::string& getName() const = 0;
    virtual metrics::Metric* getMetric() = 0;
    virtual const StatusReporter* getStatusReporter() = 0;

    virtual void setMetricRegistrator(MetricRegistrator&) = 0;
    virtual void setClock(Clock&) = 0;
    virtual void setThreadPool(ThreadPool&) = 0;
    virtual void open() = 0;
    virtual void close() = 0;

};

}