| 31 | // ----------------------------------------------------------------------------- |
| 32 | |
| 33 | int 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 | |