bool increment(llong* id, valvec<byte>* key) override { auto owner = static_cast<const SeqNumIndex*>(m_index.get()); if (nark_likely(m_curr < owner->m_cnt)) { getIndexKey(id, key, owner, --m_curr); return true; } return false; }
bool increment(llong* id, valvec<byte>* key) override { auto owner = static_cast<const MockReadonlyIndex*>(m_index.get()); assert(nullptr != id); if (terark_likely(m_pos > 0)) { owner->getIndexKey(id, key, --m_pos); return true; } return false; }
void parseIndexFile(int maptype) { FILE *iniFptr = NULL; struct stat fileData; char line[300]; char * strkey = NULL; char fileName[256] = "\0"; /* * 0 - kwrd Map * 1 - SHA1 Map * 2 - name Map */ if(maptype == 0) { // Insert into kwrd Map strcpy(fileName,kwrdIndexFileName); } else if(maptype == 1) { // Insert into SHA1 Map strcpy(fileName,sha1IndexFileName); } else if(maptype == 2) { //Insert into Filename Map strcpy(fileName,fileNameIndexFileName); } /* * Parse Index File */ if(stat(fileName,&fileData) < 0) { //The specified ini file does not exist iniFptr = fopen(fileName,"w"); fclose(iniFptr); } if((iniFptr = fopen(fileName,"r")) == NULL) { printf("\nError opening ini file: %s\n",fileName); exit(0); } while(fgets(line,sizeof(line),iniFptr) != NULL) { if(strcmp(line,"\n") != 0) { //This is not a section, these are key value pairs strkey = getIndexKey(line); if(strkey != NULL) getIndexValue(strkey); populateIndexMap(indexkey,indexvalue,maptype); } } fclose(iniFptr); }
int seekLowerBound(fstring key, llong* id, valvec<byte>* retKey) override { auto owner = static_cast<const MockReadonlyIndex*>(m_index.get()); int ret = owner->forwardLowerBound(key, &m_pos); if (ret >= 0) { assert(m_pos < owner->m_ids.size()); owner->getIndexKey(id, retKey, m_pos); m_pos++; } return ret; }
void IndexDesc::getNonKeyColumnSet(ValueIdSet& nonKeyColumnSet) const { const ValueIdList &indexColumns = getIndexColumns(), &keyColumns = getIndexKey(); // clean up input: nonKeyColumnSet.clear(); // Add all index columns CollIndex i = 0; for (i=0; i < indexColumns.entries(); i++) { nonKeyColumnSet.insert(indexColumns[i]); } // And remove all key columns: for (i=0; i < keyColumns.entries(); i++) { nonKeyColumnSet.remove(keyColumns[i]); // if this is a secondary index, the base column // which is part of the index, // may also be present, remove it: const ItemExpr *colPtr = keyColumns[i].getItemExpr(); if (colPtr->getOperatorType() == ITM_INDEXCOLUMN) { const ValueId & colDef = ((IndexColumn *)(colPtr))->getDefinition(); nonKeyColumnSet.remove(colDef); } } } // IndexDesc::getNonKeyColumnSet(ValueIdSet& nonKeyColumnSet) const