Coverage Report

Created: 2026-03-12 14:13

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/cloud/delete_bitmap_file_writer.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 "cloud/cloud_storage_engine.h"
21
#include "common/status.h"
22
#include "io/fs/file_reader_writer_fwd.h"
23
#include "io/fs/packed_file_manager.h"
24
25
namespace doris {
26
27
class DeleteBitmapPB;
28
29
class DeleteBitmapFileWriter {
30
public:
31
    explicit DeleteBitmapFileWriter(int64_t tablet_id, const std::string& rowset_id,
32
                                    std::optional<StorageResource>& storage_resource);
33
    // Constructor with packed file support
34
    explicit DeleteBitmapFileWriter(int64_t tablet_id, const std::string& rowset_id,
35
                                    std::optional<StorageResource>& storage_resource,
36
                                    bool enable_packed_file, int64_t txn_id);
37
    ~DeleteBitmapFileWriter();
38
39
    Status init();
40
    Status write(const DeleteBitmapPB& delete_bitmap);
41
    Status close();
42
43
    // Get packed slice location after close
44
    Status get_packed_slice_location(io::PackedSliceLocation* location) const;
45
0
    bool is_packed() const { return _is_packed; }
46
47
public:
48
    static constexpr const char* DELETE_BITMAP_MAGIC = "DBM1";
49
    static const uint32_t MAGIC_SIZE = 4;
50
    static const int64_t LENGTH_SIZE = sizeof(uint64_t);
51
    static const int64_t CHECKSUM_SIZE = sizeof(uint32_t);
52
53
private:
54
    int64_t _tablet_id;
55
    std::string _rowset_id;
56
    std::optional<StorageResource> _storage_resource;
57
    std::string _path;
58
    io::FileWriterPtr _file_writer;
59
60
    // Packed file support
61
    bool _enable_packed_file = false;
62
    int64_t _txn_id = 0;
63
    bool _is_packed = false;
64
    io::PackedSliceLocation _packed_location;
65
};
66
67
} // namespace doris