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

#pragma once

#include "i_gid_to_lid_change_handler.h"

namespace proton {

/*
 * Helper class for registering listeners that get notification when
 * gid to lid mapping changes.  Will also unregister stale listeners for
 * same doctype.
 */
class GidToLidChangeRegistrator
{
    std::shared_ptr<IGidToLidChangeHandler> _handler;
    vespalib::string _docTypeName;
    std::set<vespalib::string> _keepNames;

public:
    GidToLidChangeRegistrator(std::shared_ptr<IGidToLidChangeHandler> handler,
                              const vespalib::string &docTypeName);
    ~GidToLidChangeRegistrator();
    void addListener(std::unique_ptr<IGidToLidChangeListener> listener);
};

} // namespace proton