• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

llnl / dftracer-utils / 29187058583

12 Jul 2026 09:11AM UTC coverage: 51.324% (-1.4%) from 52.754%
29187058583

Pull #96

github

web-flow
Merge 7e90b76dd into 056c79287
Pull Request #96: fix: consolidate stale-index rebuilds across consumers and fix multi-run breaks

33807 of 84432 branches covered (40.04%)

Branch coverage included in aggregate %.

145 of 152 new or added lines in 16 files covered. (95.39%)

5186 existing lines in 197 files now uncovered.

34558 of 48770 relevant lines covered (70.86%)

10797.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.3
/src/dftracer/utils/core/rocksdb/key_codec.cpp
1
#include <dftracer/utils/core/common/error.h>
2
#include <dftracer/utils/core/rocksdb/key_codec.h>
3

4
#include <stdexcept>
5

6
namespace dftracer::utils::rocksdb {
7

8
namespace {
9

10
template <typename T>
11
T decode_big_endian(std::string_view bytes) {
326,873✔
12
    if (bytes.size() != sizeof(T)) {
326,873!
13
        throw DFTUtilsException(ErrorCode::PARSE,
×
UNCOV
14
                                "KeyCodec: invalid big-endian integer width");
×
15
    }
16

17
    T value = 0;
326,873✔
18
    for (unsigned char byte : bytes) {
2,759,535✔
19
        value = static_cast<T>((value << 8U) | byte);
2,432,662✔
20
    }
21
    return value;
326,873✔
UNCOV
22
}
×
23

24
}  // namespace
25

26
std::string KeyCodec::encode_be32(std::uint32_t value) {
18,069✔
27
    std::string out;
18,069✔
28
    out.reserve(sizeof(value));
18,069!
29
    append_be32(out, value);
18,069!
30
    return out;
18,069✔
31
}
18,069!
32

33
std::string KeyCodec::encode_be64(std::uint64_t value) {
1,725✔
34
    std::string out;
1,725✔
35
    out.reserve(sizeof(value));
1,725!
36
    append_be64(out, value);
1,725!
37
    return out;
1,725✔
38
}
1,725!
39

40
std::uint32_t KeyCodec::decode_be32(std::string_view bytes) {
45,560✔
41
    return decode_big_endian<std::uint32_t>(bytes);
45,560✔
42
}
43

44
std::uint64_t KeyCodec::decode_be64(std::string_view bytes) {
281,317✔
45
    return decode_big_endian<std::uint64_t>(bytes);
281,317✔
46
}
47

48
void KeyCodec::append_be32(std::string& out, std::uint32_t value) {
79,397✔
49
    for (int shift = 24; shift >= 0; shift -= 8) {
396,932✔
50
        out.push_back(static_cast<char>((value >> shift) & 0xFFU));
317,535✔
51
    }
317,535✔
52
}
79,397✔
53

54
void KeyCodec::append_be64(std::string& out, std::uint64_t value) {
83,066✔
55
    for (int shift = 56; shift >= 0; shift -= 8) {
747,281✔
56
        out.push_back(static_cast<char>((value >> shift) & 0xFFU));
664,215✔
57
    }
664,215✔
58
}
83,066✔
59

60
KeyBuilder& KeyBuilder::append_tag(std::string_view tag) {
1✔
61
    key_.append(tag);
1✔
62
    return *this;
1✔
63
}
64

65
KeyBuilder& KeyBuilder::append_separator() {
1✔
66
    key_.push_back('\0');
1✔
67
    return *this;
1✔
68
}
69

70
KeyBuilder& KeyBuilder::append_string(std::string_view value) {
×
71
    key_.append(value);
×
72
    return *this;
×
73
}
74

75
KeyBuilder& KeyBuilder::append_be32(std::uint32_t value) {
1✔
76
    KeyCodec::append_be32(key_, value);
1✔
77
    return *this;
1✔
78
}
79

80
KeyBuilder& KeyBuilder::append_be64(std::uint64_t value) {
1✔
81
    KeyCodec::append_be64(key_, value);
1✔
82
    return *this;
1✔
83
}
84

85
std::string KeyBuilder::build() const { return key_; }
1✔
86

87
void KeyBuilder::clear() { key_.clear(); }
×
88

89
}  // namespace dftracer::utils::rocksdb
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc