Coverage Report

Created: 2026-07-13 02:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/io/fs/file_meta_disk_cache.h
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#pragma once
19
20
#include <string>
21
#include <string_view>
22
23
#include "io/fs/file_meta_cache.h"
24
25
namespace doris {
26
27
namespace io {
28
class BlockFileCache;
29
struct UInt128Wrapper;
30
} // namespace io
31
32
class FileMetaDiskCache final : public FileMetaPersistentCache {
33
public:
34
9
    explicit FileMetaDiskCache(io::BlockFileCache* cache = nullptr) : _cache(cache) {}
35
36
    Status read(FileMetaCacheFormat format, const std::string& key, int64_t modification_time,
37
                int64_t file_size, std::string* payload) override;
38
39
    Status write(FileMetaCacheFormat format, const std::string& key, int64_t modification_time,
40
                 int64_t file_size, std::string_view payload) override;
41
42
    void remove(FileMetaCacheFormat format, const std::string& key) override;
43
44
private:
45
    static std::string get_key(FileMetaCacheFormat format, std::string_view file_meta_cache_key);
46
47
    io::BlockFileCache* get_cache(const io::UInt128Wrapper& hash) const;
48
49
    io::BlockFileCache* _cache = nullptr;
50
};
51
52
} // namespace doris