aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/server/document_subdb_reconfig.h
blob: 094fe949eccb7636246ea82acce7f03e55318cd3 (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.
#pragma once

#include <vespa/searchlib/common/serialnum.h>
#include <memory>

namespace proton {

struct IAttributeManager;
class IAttributeManagerReconfig;
class Matchers;

/**
 * Class representing the result of the prepare step of a IDocumentSubDB reconfig.
 */
class DocumentSubDBReconfig {
private:
    std::shared_ptr<Matchers> _old_matchers;
    std::shared_ptr<Matchers> _new_matchers;
    std::shared_ptr<IAttributeManager> _old_attribute_manager;
    std::shared_ptr<IAttributeManager> _new_attribute_manager;
    std::unique_ptr<IAttributeManagerReconfig> _attribute_manager_reconfig;

public:
    DocumentSubDBReconfig(std::shared_ptr<Matchers> matchers_in, std::shared_ptr<IAttributeManager> attribute_manager_in);
    ~DocumentSubDBReconfig();

    void set_matchers(std::shared_ptr<Matchers> value) {
        _new_matchers = std::move(value);
    }
    bool has_matchers_changed() const noexcept {
        return _old_matchers != _new_matchers;
    }
    std::shared_ptr<Matchers> matchers() const noexcept { return _new_matchers; }
    bool has_attribute_manager_changed() const noexcept {
        return _old_attribute_manager != _new_attribute_manager;
    }
    std::shared_ptr<IAttributeManager> attribute_manager() const noexcept { return _new_attribute_manager; }
    void set_attribute_manager_reconfig(std::unique_ptr<IAttributeManagerReconfig> attribute_manager_reconfig);

    void complete(uint32_t docid_limit, search::SerialNum serial_num);
};

}