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

paticcaa / pain / 18547817035

16 Oct 2025 01:53AM UTC coverage: 55.128% (-0.06%) from 55.184%
18547817035

Pull #15

github

web-flow
Merge 1928fd14d into fdb473e85
Pull Request #15: spdk 去除-lmana, 去除无用链接选项

1660 of 4120 branches covered (40.29%)

Branch coverage included in aggregate %.

1936 of 2403 relevant lines covered (80.57%)

498.45 hits per line

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

31.03
/src/deva/deva_op_factory.h
1
#pragma once
2

3
#include "pain/proto/deva_store.pb.h"
4
#include "common/rsm/container_op.h"
5
#include "common/rsm/op_factory.h"
6

7
#define BRANCH(name)                                                                                                   \
8
    case OpType::k##name:                                                                                              \
9
        return create_op<OpType::k##name, proto::deva::store::name##Request, proto::deva::store::name##Response>(      \
10
            version, rsm);                                                                                             \
11
        break;
12

13
namespace pain::deva {
14
class Deva;
15

16
using OpPtr = common::OpPtr;
17
using RsmPtr = common::RsmPtr;
18

19
template <typename Request, typename Response>
20
using ContainerOp = common::ContainerOp<Deva, Request, Response>;
21

22
enum class OpType : uint32_t {
23
    kInvalid = 0,
24
    // DevaOp: 1 ~ 100
25
    DEFINE_RSM_OP(1, CreateFile, true),
26
    DEFINE_RSM_OP(2, CreateDir, true),
27
    DEFINE_RSM_OP(3, RemoveFile, true),
28
    DEFINE_RSM_OP(4, SealFile, true),
29
    DEFINE_RSM_OP(5, CreateChunk, true),
30
    DEFINE_RSM_OP(6, CheckInChunk, true),
31
    DEFINE_RSM_OP(7, SealChunk, true),
32
    DEFINE_RSM_OP(8, SealAndNewChunk, true),
33
    DEFINE_RSM_OP(9, ReadDir, false),
34
    DEFINE_RSM_OP(10, GetFileInfo, false),
35
    DEFINE_RSM_OP(20, ManusyaHeartbeat, false),
36
    DEFINE_RSM_OP(21, ListManusya, false),
37
    DEFINE_RSM_OP(100, MaxDevaOp, true),
38
};
39

40
template <OpType OpType, typename Request, typename Response>
41
OpPtr create_op(int32_t version, RsmPtr rsm) {
50✔
42
    Request request;
50!
43
    OpPtr op = nullptr;
50✔
44

45
    if constexpr (OpType < OpType::kMaxDevaOp) {
46
        op = new ContainerOp<Request, Response>(version, static_cast<uint32_t>(OpType), rsm, request, nullptr);
50!
47
    }
48
    return op;
100✔
49
}
50✔
50

51
class DevaOpFactory : public common::OpFactory {
52
public:
53
    OpPtr create(uint32_t op_type, int32_t version, RsmPtr rsm) override {
50✔
54
        switch (static_cast<OpType>(op_type)) {
50!
55
            BRANCH(CreateFile)
24!
56
            BRANCH(CreateDir)
26!
57
            BRANCH(ReadDir)
×
58
            BRANCH(RemoveFile)
×
59
            BRANCH(SealFile)
×
60
            BRANCH(CreateChunk)
×
61
            BRANCH(CheckInChunk)
×
62
            BRANCH(SealChunk)
×
63
            BRANCH(SealAndNewChunk)
×
64
        default:
×
65
            BOOST_ASSERT_MSG(false, fmt::format("unknown op type: {}", op_type).c_str());
×
66
        }
67
        return nullptr;
×
68
    }
69
};
70

71
} // 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