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

paticcaa / pain / 17455596282

04 Sep 2025 06:40AM UTC coverage: 56.572% (+0.4%) from 56.202%
17455596282

push

github

ivanallen
add snapshot

Signed-off-by: allen <1007729991@qq.com>

1424 of 3382 branches covered (42.11%)

Branch coverage included in aggregate %.

53 of 79 new or added lines in 9 files covered. (67.09%)

5 existing lines in 3 files now uncovered.

1688 of 2119 relevant lines covered (79.66%)

439.4 hits per line

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

69.57
/src/deva/op.cc
1
#include "deva/op.h"
2
#include <pain/base/plog.h>
3
#include <functional>
4
#include "butil/iobuf.h"
5
#include "butil/time.h"
6

7
namespace pain::deva {
8

9
void encode(int32_t version, OpPtr op, IOBuf* buf) {
26✔
10
    OpMeta op_meta = {};
26✔
11
    static_assert(sizeof(op_meta) == 64, "OpMeta size must be 64byte"); // NOLINT(readability-magic-numbers)
12
    op_meta.version = version;
26✔
13
    op_meta.type = op->type();
26!
14
    op_meta.timestamp = butil::gettimeofday_us();
26✔
15
    butil::IOBuf meta;
26!
16
    op->encode(&meta);
26!
17
    op_meta.size = meta.size();
26!
18
    buf->append(&op_meta, sizeof(op_meta));
26!
19
    buf->append(meta);
26!
20
}
52✔
21

22
OpPtr decode(IOBuf* buf, std::move_only_function<OpPtr(int32_t, OpType, IOBuf*)> decode) {
48✔
23
    OpMeta op_meta = {};
48✔
24
    static_assert(sizeof(op_meta) == 64, "OpMeta size must be 64byte"); // NOLINT(readability-magic-numbers)
25
    uint32_t op_size = 0;
48✔
26
    buf->cutn(&op_meta, sizeof(op_meta));
48!
27
    op_size = op_meta.size;
48✔
28
    if (buf->size() < op_size) {
48!
NEW
29
        PLOG_ERROR(("desc", "op size is too small") //
×
30
                   ("op_size", op_size)             //
31
                   ("buf_size", buf->size()));
NEW
32
        return nullptr;
×
33
    }
34
    auto op = decode(op_meta.version, op_meta.type, buf);
48!
35
    return op;
48✔
36
}
48✔
37

38
} // namespace pain::deva
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