| 30 | */ |
| 31 | template <typename SInfo> |
| 32 | int ECEncoder<SInfo>::ec_init_plugin(ceph::ErasureCodeInterfaceRef &ec_impl) |
| 33 | { |
| 34 | auto plugin = profile.find("plugin"); |
| 35 | if (plugin == profile.end()) { |
| 36 | std::cerr << "Invalid profile: plugin not specified." << std::endl; |
| 37 | return 1; |
| 38 | } |
| 39 | |
| 40 | std::stringstream ss; |
| 41 | std::string dir = g_conf().get_val<std::string>("erasure_code_dir"); |
| 42 | ceph::ErasureCodePluginRegistry::instance().factory(plugin->second, |
| 43 | dir, profile, |
| 44 | &ec_impl, &ss); |
| 45 | if (!ec_impl) { |
| 46 | std::cerr << "Invalid profile: " << ss.str() << std::endl; |
| 47 | return 1; |
| 48 | } |
| 49 | |
| 50 | return 0; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Initialize the stripe_info_t needed to perform encode. Optimized version for new EC. |