aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/server/configstore.h
blob: 67b61c3d7e471e70c78df844824d0f68c506bcdf (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
45
46
47
48
49
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "feedconfigstore.h"
#include <vespa/searchcommon/common/schema.h>

namespace vespa::config::search::core::internal {
    class InternalProtonType;
}
namespace proton {

class DocumentDBConfig;

struct ConfigStore : FeedConfigStore {
    using UP = std::unique_ptr<ConfigStore>;
    using SerialNum = search::SerialNum;
    using ProtonConfig = const vespa::config::search::core::internal::InternalProtonType;
    using ProtonConfigSP = std::shared_ptr<ProtonConfig>;

    /**
     * @param currentSnapshot the current snapshot, for reusing
     *                        unchanged parts .
     * @param serialNum the serial number of the config snapshot to load.
     * @param loadedSnapshot the shared pointer in which to store the
     *                       resulting config snapshot.
     */
    virtual void loadConfig(const DocumentDBConfig &currentSnapshot, SerialNum serialNum,
                            std::shared_ptr<DocumentDBConfig> &loadedSnapshot) = 0;
    virtual void saveConfig(const DocumentDBConfig &snapshot, SerialNum serialNum) = 0;

    virtual void removeInvalid() = 0;
    /**
     * Perform prune after everything up to and including serialNum has been
     * flushed to stable storage.
     *
     * @param serialNum The serial number flushed to stable storage.
     */
    virtual void prune(SerialNum serialNum) = 0;

    virtual SerialNum getBestSerialNum() const = 0;
    virtual SerialNum getOldestSerialNum() const = 0;
    virtual bool hasValidSerial(SerialNum serialNum) const = 0;
    virtual SerialNum getPrevValidSerial(SerialNum serialNum) const = 0;
    virtual void setProtonConfig(const ProtonConfigSP &protonConfig) = 0;
};

}  // namespace proton