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

llnl / dftracer-utils / 27171677342

08 Jun 2026 10:43PM UTC coverage: 51.99% (+0.05%) from 51.937%
27171677342

Pull #77

github

web-flow
Merge 3a1432eec into 8045f0be3
Pull Request #77: chore: bump version to 0.0.10

36972 of 92663 branches covered (39.9%)

Branch coverage included in aggregate %.

33405 of 42703 relevant lines covered (78.23%)

20411.31 hits per line

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

82.05
/src/dftracer/utils/core/rocksdb/key_codec.cpp
1
#include <dftracer/utils/core/rocksdb/key_codec.h>
2

3
#include <stdexcept>
4

5
namespace dftracer::utils::rocksdb {
6

7
namespace {
8

9
template <typename T>
10
T decode_big_endian(std::string_view bytes) {
565,669✔
11
    if (bytes.size() != sizeof(T)) {
565,669!
12
        throw std::invalid_argument(
×
13
            "KeyCodec: invalid big-endian integer width");
14
    }
15

16
    T value = 0;
565,709✔
17
    for (unsigned char byte : bytes) {
4,783,076✔
18
        value = static_cast<T>((value << 8U) | byte);
4,217,367✔
19
    }
20
    return value;
565,722✔
21
}
22

23
}  // namespace
24

25
std::string KeyCodec::encode_be32(std::uint32_t value) {
32,873✔
26
    std::string out;
32,873✔
27
    out.reserve(sizeof(value));
32,902✔
28
    append_be32(out, value);
32,885✔
29
    return out;
32,879✔
30
}
16,462!
31

32
std::string KeyCodec::encode_be64(std::uint64_t value) {
2,886✔
33
    std::string out;
2,886✔
34
    out.reserve(sizeof(value));
2,889!
35
    append_be64(out, value);
2,890!
36
    return out;
2,889✔
37
}
1,446!
38

39
std::uint32_t KeyCodec::decode_be32(std::string_view bytes) {
76,997✔
40
    return decode_big_endian<std::uint32_t>(bytes);
76,997✔
41
}
42

43
std::uint64_t KeyCodec::decode_be64(std::string_view bytes) {
488,670✔
44
    return decode_big_endian<std::uint64_t>(bytes);
488,670✔
45
}
46

47
void KeyCodec::append_be32(std::string& out, std::uint32_t value) {
136,009✔
48
    for (int shift = 24; shift >= 0; shift -= 8) {
679,712✔
49
        out.push_back(static_cast<char>((value >> shift) & 0xFFU));
543,733✔
50
    }
272,232✔
51
}
135,979✔
52

53
void KeyCodec::append_be64(std::string& out, std::uint64_t value) {
139,512✔
54
    for (int shift = 56; shift >= 0; shift -= 8) {
1,253,211✔
55
        out.push_back(static_cast<char>((value >> shift) & 0xFFU));
1,113,922✔
56
    }
558,326✔
57
}
139,289✔
58

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

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

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

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

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

84
std::string KeyBuilder::build() const { return key_; }
2✔
85

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

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

© 2026 Coveralls, Inc