}
// -----------------------------------------------------------------------------
+const std::string ErasureCodeIsaDefault::DEFAULT_K("7");
+const std::string ErasureCodeIsaDefault::DEFAULT_M("3");
+
int
ErasureCodeIsa::create_ruleset(const string &name,
CrushWrapper &crush,
ErasureCodeIsa::init(ErasureCodeProfile &profile, ostream *ss)
{
int err = 0;
- dout(10) << "technique=" << technique << dendl;
- map<string, string>::const_iterator parameter;
- parameter = profile.find("ruleset-root");
- if (parameter != profile.end())
- ruleset_root = parameter->second;
- parameter = profile.find("ruleset-failure-domain");
- if (parameter != profile.end())
- ruleset_failure_domain = parameter->second;
+ err |= to_string("ruleset-root", profile,
+ &ruleset_root,
+ DEFAULT_RULESET_ROOT, ss);
+ err |= to_string("ruleset-failure-domain", profile,
+ &ruleset_failure_domain,
+ DEFAULT_RULESET_FAILURE_DOMAIN, ss);
err |= parse(profile, ss);
if (err)
return err;
#include <list>
// -----------------------------------------------------------------------------
+#define DEFAULT_RULESET_ROOT "default"
+#define DEFAULT_RULESET_FAILURE_DOMAIN "host"
+
class ErasureCodeIsa : public ErasureCode {
public:
w(0),
tcache(_tcache),
technique(_technique),
- ruleset_root("default"),
- ruleset_failure_domain("host")
+ ruleset_root(DEFAULT_RULESET_ROOT),
+ ruleset_failure_domain(DEFAULT_RULESET_FAILURE_DOMAIN)
{
}
public:
- static const int DEFAULT_K = 7;
- static const int DEFAULT_M = 3;
+ static const std::string DEFAULT_K;
+ static const std::string DEFAULT_M;
unsigned char* encode_coeff; // encoding coefficient
unsigned char* encode_tbls; // encoding table
ostream *ss)
{
ErasureCodeIsa *interface;
- std::string t = "reed_sol_van";
- if (profile.find("technique") != profile.end())
- t = profile.find("technique")->second;
+ std::string t;
+ if (profile.find("technique") == profile.end())
+ profile["technique"] = "reed_sol_van";
+ t = profile.find("technique")->second;
if ((t == "reed_sol_van")) {
interface = new ErasureCodeIsaDefault(tcache,
ErasureCodeIsaDefault::kVandermonde);