const map<int, bufferlist> &chunks,
map<int, bufferlist> *decoded)
{
+ vector<int> have;
+ have.reserve(chunks.size());
+ for (map<int, bufferlist>::const_iterator i = chunks.begin();
+ i != chunks.end();
+ ++i) {
+ have.push_back(i->first);
+ }
+ if (includes(
+ have.begin(), have.end(), want_to_read.begin(), want_to_read.end())) {
+ for (set<int>::iterator i = want_to_read.begin();
+ i != want_to_read.end();
+ ++i) {
+ (*decoded)[*i] = chunks.find(*i)->second;
+ }
+ return 0;
+ }
unsigned blocksize = (*chunks.begin()).second.length();
int erasures[k + m + 1];
int erasures_count = 0;
EXPECT_EQ(0, jerasure.decode(set<int>(want_to_decode, want_to_decode+2),
encoded,
&decoded));
- // always decode all, regardless of want_to_decode
- EXPECT_EQ(4u, decoded.size());
+ EXPECT_EQ(2u, decoded.size());
EXPECT_EQ(length, decoded[0].length());
EXPECT_EQ(0, strncmp(decoded[0].c_str(), in.c_str(), length));
EXPECT_EQ(0, strncmp(decoded[1].c_str(), in.c_str() + length,