| 38 | } |
| 39 | |
| 40 | int 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 | |
| 72 | const char *__erasure_code_version() { return CEPH_GIT_NICE_VER; } |
| 73 | |