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

Method init

src/erasure-code/lrc/ErasureCodeLrc.cc:494–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492}
493
494int ErasureCodeLrc::init(ErasureCodeProfile &profile,
495 ostream *ss)
496{
497 int r;
498
499 r = parse_kml(profile, ss);
500 if (r)
501 return r;
502
503 r = parse(profile, ss);
504 if (r)
505 return r;
506
507 json_spirit::mArray description;
508 r = layers_description(profile, &description, ss);
509 if (r)
510 return r;
511
512 string description_string = profile.find("layers")->second;
513
514 dout(10) << "init(" << description_string << ")" << dendl;
515
516 r = layers_parse(description_string, description, ss);
517 if (r)
518 return r;
519
520 r = layers_init(ss);
521 if (r)
522 return r;
523
524 if (profile.count("mapping") == 0) {
525 *ss << "the 'mapping' profile is missing from " << profile;
526 return ERROR_LRC_MAPPING;
527 }
528 string mapping = profile.find("mapping")->second;
529 data_chunk_count = count(begin(mapping), end(mapping), 'D');
530 chunk_count = mapping.length();
531
532 r = layers_sanity_checks(description_string, ss);
533 if (r)
534 return r;
535
536 //
537 // When initialized with kml, the profile parameters
538 // that were generated should not be stored because
539 // they would otherwise be exposed to the caller.
540 //
541 if (profile.find("l") != profile.end() &&
542 profile.find("l")->second != DEFAULT_KML) {
543 profile.erase("mapping");
544 profile.erase("layers");
545 }
546 ErasureCode::init(profile, ss);
547 return 0;
548}
549
550set<int> ErasureCodeLrc::get_erasures(const set<int> &want,
551 const set<int> &available) const

Callers 1

factoryMethod · 0.45

Calls 9

parseFunction · 0.50
beginFunction · 0.50
endFunction · 0.50
initFunction · 0.50
findMethod · 0.45
countMethod · 0.45
lengthMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected