aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcorespi/index/indexwriteutilities.h
blob: 313ab3cc1c7c90c69a6d8a78c71f972c11f32553 (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 Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/searchcommon/common/schema.h>
#include <vespa/searchlib/attribute/fixedsourceselector.h>
#include <vespa/searchlib/common/tunefileinfo.h>
#include <vespa/searchlib/common/fileheadercontext.h>
#include <vespa/searchlib/common/serialnum.h>
#include <vespa/vespalib/stllike/string.h>

namespace searchcorespi::index {

/**
 * Utility class with functions to write aspects of an index to disk.
 * Used by the index maintainer.
 */
struct IndexWriteUtilities
{
    static void
    writeSerialNum(search::SerialNum serialNum,
                   const vespalib::string &dir,
                   const search::common::FileHeaderContext &fileHeaderContext);

    static bool
    copySerialNumFile(const vespalib::string &sourceDir,
                      const vespalib::string &destDir);

    static void
    writeSourceSelector(search::FixedSourceSelector::SaveInfo &saveInfo,
                        uint32_t sourceId,
                        const search::TuneFileAttributes &tuneFileAttributes,
                        const search::common::FileHeaderContext &
                        fileHeaderContext,
                        search::SerialNum serialNum);

    static void
    updateDiskIndexSchema(const vespalib::string &indexDir,
                          const search::index::Schema &schema,
                          search::SerialNum serialNum);
};

}