Esempio n. 1
0
void BingoPgSection::_setBinData(indigo::Array<char>& buf, int& last_buf, ItemPointerData& item_data) {
   if(buf.size() == 0) {
      BINGO_PG_TRY {
         ItemPointerSet(&item_data, InvalidBlockNumber, 0);
      } BINGO_PG_HANDLE(throw Error("internal error: can not set block data: %s", message));
      return;
   }
Esempio n. 2
0
void BingoPgIndex::readXyzItem(int section_idx, int mol_idx, indigo::Array<char>& xyz_buf) {
   /*
    * Prepare info for reading
    */
   BingoPgSection& current_section = _jumpToSection(section_idx);
   int map_block_idx = mol_idx / BINGO_MOLS_PER_MAPBLOCK;
   int map_mol_idx = mol_idx % BINGO_MOLS_PER_MAPBLOCK;
   BingoPgBufferCacheMap& map_cache = current_section.getMapBufferCache(map_block_idx);

   elog(DEBUG1, "bingo: index: read xyz: start read structure %d for section = %d", mol_idx, section_idx);

   /*
    * Get xyz item
    */
   ItemPointerData xyz_item;
   map_cache.getXyzItem(map_mol_idx, xyz_item);
   /*
    * Check for correct block num
    */
   dword block_num = ItemPointerGetBlockNumber(&xyz_item);
   if(block_num == InvalidBlockNumber) {
      xyz_buf.clear();
      elog(DEBUG1, "bingo: index: read xyz: xyz is empty for structure %d for section = %d", mol_idx, section_idx);
      return;
   }
   unsigned short block_offset = ItemPointerGetOffsetNumber(&xyz_item);
   /*
    * Read xyz buffer for a given offset
    */
   BingoPgBufferCacheBin& bin_cache = current_section.getBinBufferCache(block_num);
   bin_cache.readBin(block_offset, xyz_buf);
   elog(DEBUG1, "bingo: index: read xyz: successfully read xyz of size %d for block %d offset %d", xyz_buf.size(), block_num, block_offset);
}