aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/util/filesizecalculator.h
blob: be795b84c8b1546bff501533697853466aac6960 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/vespalib/stllike/string.h>

namespace vespalib { class GenericHeader; }

namespace search {

/*
 * Class to calculate logical file size of a file based on header tags
 * and physical file size.  Logical file size can be smaller than
 * physical file size due to padding for directio alignment
 * constraints.
 */
class FileSizeCalculator
{
public:
    static bool
    extractFileSize(const vespalib::GenericHeader &header, size_t headerLen,
                    vespalib::string fileName, uint64_t &fileSize);
};

}