예제 #1
0
void SimpleTableDump::dumpAttribute(std::string name, atable_ptr_t table, size_t col) {
  assert(std::dynamic_pointer_cast<Store>(table) ==
         nullptr);  // this should never be called with a store directly, but with main and delta table sepratly.
  std::string fullPath = _baseDirectory + "/" + name + "/" + table->nameOfColumn(col) + ".attr.dat";
  std::ofstream data(fullPath, std::ios::out | std::ios::binary);

  // size_t tableSize = table->size(); // get size before, to avoid chasing updates..
  auto tableSize = table->checkpointSize();

  std::vector<value_id_t> vidVector;
  vidVector.resize(tableSize);

  for (size_t i = 0; i < tableSize; ++i) {
    ValueId v;
    v = table->getValueId(col, i);
    vidVector[i] = v.valueId;
  }
  data.write((char*)&vidVector[0], tableSize * sizeof(value_id_t));
  data.close();
}
예제 #2
0
void SimpleTableDump::dumpMetaData(std::string name, atable_ptr_t table) {
  std::string fullPath = _baseDirectory + "/" + name + "/metadata.dat";
  std::ofstream data(fullPath, std::ios::out | std::ios::binary);
  data << table->checkpointSize();
  data.close();
}