void checkReadValuesImpl(Result expected_result, ReadSet expected, Result result, ReadSet* rs) { TS_ASSERT_EQUALS(expected_result, result); if ((result != OH::Storage::SUCCESS) || (expected_result != OH::Storage::SUCCESS)) return; if (!rs) { TS_ASSERT_EQUALS(expected.size(), 0); return; } TS_ASSERT_EQUALS(expected.size(), rs->size()); for(ReadSet::iterator it = expected.begin(); it != expected.end(); it++) { String key = it->first; String value = it->second; TS_ASSERT(rs->find(key) != rs->end()); TS_ASSERT_EQUALS((*rs)[key], value); } }
void Depot::load_overlaps(OverlapSet& dst, uint32_t begin, uint32_t length, const ReadSet& reads) { ASSERT(reads.size() != 0, "Depot", "Empty read set!"); load(dst, begin, length, overlap_data_, overlap_index_); for (auto& it: dst) { auto id = (uint64_t) it->read_a_; ASSERT(id < reads.size(), "Depot", "Missing read %lu!", id); it->read_a_ = reads[id]; id = (uint64_t) it->read_b_; ASSERT(id < reads.size(), "Depot", "Missing read %lu!", id); it->read_b_ = reads[id]; } }
void CassandraStorage::executeRangeRead(const Bucket& bucket, SliceRange& range, CommitCallback cb, const String& timestamp) { ReadSet* rs = new ReadSet; bool success = true; try { *rs = mDB->db()->getColumnsValues(bucket.rawHexData(),CF_NAME, timestamp, range); } catch(...){ success = false; } if (rs->size()==0) success = false; mContext->mainStrand->post(std::tr1::bind(&CassandraStorage::completeRange, this, cb, success, rs)); }
void Depot::store_reads(const ReadSet& src) { ASSERT(src.size() != 0, "Depot", "Can not store an empty ReadSet!"); store(src, read_data_, read_index_); }