MCPcopy Create free account
hub / github.com/ceph/ceph / factory

Method factory

src/erasure-code/shec/ErasureCodePluginShec.cc:40–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40int ErasureCodePluginShec::factory(const std::string &directory,
41 ceph::ErasureCodeProfile &profile,
42 ceph::ErasureCodeInterfaceRef *erasure_code,
43 std::ostream *ss) {
44 ErasureCodeShec *interface;
45
46 if (profile.find("technique") == profile.end())
47 profile["technique"] = "multiple";
48 std::string t = profile.find("technique")->second;
49
50 if (t == "single"){
51 interface = new ErasureCodeShecReedSolomonVandermonde(tcache, ErasureCodeShec::SINGLE);
52 } else if (t == "multiple"){
53 interface = new ErasureCodeShecReedSolomonVandermonde(tcache, ErasureCodeShec::MULTIPLE);
54 } else {
55 *ss << "technique=" << t << " is not a valid coding technique. "
56 << "Choose one of the following: "
57 << "single, multiple ";
58 return -ENOENT;
59 }
60 int r = interface->init(profile, ss);
61 if (r) {
62 delete interface;
63 return r;
64 }
65 *erasure_code = ceph::ErasureCodeInterfaceRef(interface);
66
67 dout(10) << "ErasureCodePluginShec: factory() completed" << dendl;
68
69 return 0;
70}
71
72const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; }
73

Callers

nothing calls this directly

Calls 3

findMethod · 0.45
endMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected