aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/test/buckethandler.h
blob: 47dc3145f726152a52e9514c7aa642bcc02668b1 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/searchcore/proton/server/ibucketstatechangednotifier.h>
#include <vespa/searchcore/proton/server/ibucketstatechangedhandler.h>
#include <set>

namespace proton
{

namespace test
{

/**
 * Test bucket handler that forwards bucket state change notifications
 * as appropriate.
 */
class BucketHandler : public IBucketStateChangedNotifier
{
    std::set<IBucketStateChangedHandler *> _handlers;
public:
    BucketHandler();

    virtual
    ~BucketHandler();

    virtual void
    addBucketStateChangedHandler(IBucketStateChangedHandler *handler) override;

    virtual void
    removeBucketStateChangedHandler(IBucketStateChangedHandler *handler) override;

    void
    notifyBucketStateChanged(const document::BucketId &bucketId,
                             storage::spi::BucketInfo::ActiveState newState);
};


} // namespace test

} // namespace proton