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

Method factory

src/erasure-code/isa/ErasureCodePluginIsa.cc:33–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31// -----------------------------------------------------------------------------
32
33int ErasureCodePluginIsa::factory(const std::string &directory,
34 ceph::ErasureCodeProfile &profile,
35 ceph::ErasureCodeInterfaceRef *erasure_code,
36 std::ostream *ss)
37{
38 ErasureCodeIsa *interface;
39 std::string technique;
40 technique = profile.find("technique")->second;
41 std::string _m = profile.find("m")->second;
42 if ((technique == "reed_sol_van")) {
43 interface = new ErasureCodeIsaDefault(tcache,
44 technique,
45 ErasureCodeIsaDefault::kVandermonde,
46 _m);
47 } else if ((technique == "cauchy")) {
48 interface = new ErasureCodeIsaDefault(tcache,
49 technique,
50 ErasureCodeIsaDefault::kCauchy,
51 _m);
52 } else {
53 *ss << "technique=" << technique << " is not a valid coding technique. "
54 << " Choose one of the following: "
55 << "reed_sol_van,"
56 << "cauchy" << std::endl;
57 return -ENOENT;
58 }
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 return 0;
67}
68
69// -----------------------------------------------------------------------------
70

Callers

nothing calls this directly

Calls 2

findMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected