aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/test/clusterstatehandler.h
blob: 663f95c2f62eb669d55f433b757e138550215936 (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 Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/searchcore/proton/server/iclusterstatechangednotifier.h>
#include <vespa/searchcore/proton/server/iclusterstatechangedhandler.h>
#include <set>

namespace proton::test {

/**
 * Test cluster state handler that forwards cluster state change
 * notifications as appropriate.
 */
class ClusterStateHandler : public IClusterStateChangedNotifier
{
    std::set<IClusterStateChangedHandler *> _handlers;
public:
    ClusterStateHandler();
    ~ClusterStateHandler() override;

    void addClusterStateChangedHandler(IClusterStateChangedHandler *handler) override;
    void removeClusterStateChangedHandler(IClusterStateChangedHandler *handler) override;
    void notifyClusterStateChanged(const std::shared_ptr<IBucketStateCalculator> &newCalc);
};


}