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

Method layers_description

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

Source from the content-addressed store, hash-verified

109}
110
111int ErasureCodeLrc::layers_description(const ErasureCodeProfile &profile,
112 json_spirit::mArray *description,
113 ostream *ss) const
114{
115 if (profile.count("layers") == 0) {
116 *ss << "could not find 'layers' in " << profile << std::endl;
117 return ERROR_LRC_DESCRIPTION;
118 }
119 string str = profile.find("layers")->second;
120 try {
121 json_spirit::mValue json;
122 json_spirit::read_or_throw(str, json);
123
124 if (json.type() != json_spirit::array_type) {
125 *ss << "layers='" << str
126 << "' must be a JSON array but is of type "
127 << json.type() << " instead" << std::endl;
128 return ERROR_LRC_ARRAY;
129 }
130 *description = json.get_array();
131 } catch (json_spirit::Error_position &e) {
132 *ss << "failed to parse layers='" << str << "'"
133 << " at line " << e.line_ << ", column " << e.column_
134 << " : " << e.reason_ << std::endl;
135 return ERROR_LRC_PARSE_JSON;
136 }
137 return 0;
138}
139
140int ErasureCodeLrc::layers_parse(const string &description_string,
141 json_spirit::mArray description,

Callers 1

TESTFunction · 0.80

Calls 3

countMethod · 0.45
findMethod · 0.45
typeMethod · 0.45

Tested by 1

TESTFunction · 0.64