本文整理汇总了C++中leveldb::DB::NewIterator方法的典型用法代码示例。如果您正苦于以下问题:C++ DB::NewIterator方法的具体用法?C++ DB::NewIterator怎么用?C++ DB::NewIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类leveldb::DB
的用法示例。
在下文中一共展示了DB::NewIterator方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: key
inline BOOL ConfDB::GetLicense(astring &strLicense)
{
VSCConfLicenseKey sLicKey;
leveldb::Slice key((char *)&sLicKey, sizeof(sLicKey));
leveldb::Iterator* it = m_pDb->NewIterator(leveldb::ReadOptions());
it->Seek(key);
leveldb::Slice sysValue;
if (it->Valid())
{
sysValue = it->value();
strLicense = sysValue.ToString();
}
// Check for any errors found during the scan
assert(it->status().ok());
delete it;
return TRUE;
}
示例2: GetVIPCData
inline BOOL ConfDB::GetVIPCData(u32 nId, VSCVIPCData &pData)
{
VSCConfVIPCKey sChKey(nId);
leveldb::Slice key((char *)&sChKey, sizeof(sChKey));
leveldb::Iterator* it = m_pDb->NewIterator(leveldb::ReadOptions());
it->Seek(key);
leveldb::Slice sysValue;
if (it->Valid())
{
sysValue = it->value();
}
if (sysValue.size() != sizeof(VSCVIPCData))
{
VDC_DEBUG( "Device Can not find !!!\n");
delete it;
return FALSE;
}
memcpy(&pData, sysValue.data(), sizeof(VSCVIPCData));
// Check for any errors found during the scan
assert(it->status().ok());
delete it;
return TRUE;
}
示例3: Failure
Future<std::set<string> > LevelDBStorageProcess::names()
{
if (error.isSome()) {
return Failure(error.get());
}
std::set<string> results;
leveldb::Iterator* iterator = db->NewIterator(leveldb::ReadOptions());
iterator->SeekToFirst();
while (iterator->Valid()) {
results.insert(iterator->key().ToString());
iterator->Next();
}
delete iterator;
return results;
}
示例4: GetSystemConf
inline BOOL ConfDB::GetSystemConf(VSCConfData &pSys)
{
VSCConfSystemKey sSysKey;
leveldb::Slice key((char *)&sSysKey, sizeof(sSysKey));
leveldb::Iterator* it = m_pDb->NewIterator(leveldb::ReadOptions());
it->Seek(key);
leveldb::Slice sysValue;
if (it->Valid())
{
sysValue = it->value();
}
if (sysValue.size() != sizeof(VSCConfData))
{
VDC_DEBUG( "System Config is not init\n");
delete it;
memset(&pSys, 0, sizeof(VSCConfData));
SysConfDataDefault(pSys);
UpdateSysData(pSys);
astring strLicense = " ";
SetLicense(strLicense);//set the default license
/* Call get system again */
return TRUE;
}
memcpy(&pSys, sysValue.data(), sizeof(VSCConfData));
// Check for any errors found during the scan
assert(it->status().ok());
delete it;
return TRUE;
}
示例5: GetHdfsRecordConf
inline BOOL ConfDB::GetHdfsRecordConf(VSCHdfsRecordData &pData)
{
VSCConfHdfsRecordKey sKey;
leveldb::Slice key((char *)&sKey, sizeof(sKey));
leveldb::Iterator* it = m_pDb->NewIterator(leveldb::ReadOptions());
it->Seek(key);
leveldb::Slice sysValue;
if (it->Valid())
{
sysValue = it->value();
}
if (sysValue.size() != sizeof(VSCHdfsRecordData))
{
VDC_DEBUG( "Hdfs Record Config is not init\n");
delete it;
memset(&pData, 0, sizeof(VSCHdfsRecordData));
VSCHdfsRecordDataItemDefault(pData.data.conf);
UpdateHdfsRecordData(pData);
/* Call get system again */
return TRUE;
}
memcpy(&pData, sysValue.data(), sizeof(VSCHdfsRecordData));
// Check for any errors found during the scan
assert(it->status().ok());
delete it;
return TRUE;
}
示例6: dump
void dump()
{
leveldb::Iterator* it=db->NewIterator(this->read_options);
for (it->SeekToFirst(); it->Valid(); it->Next())
{
std::auto_ptr<vector<Hit> > hits = decode(it->value().ToString());
size_t i0=0;
while(i0 < hits->size())
{
size_t i1=i0+1;
while(i1<hits->size())
{
if(hits->at(i0).bamIndex==hits->at(i1).bamIndex) {++i1; continue;}
if(IS_FLAG_SET(hits->at(i0).flag,BAM_FREAD1)!=IS_FLAG_SET(hits->at(i1).flag,BAM_FREAD1))
{
++i1;
continue;
}
if(IS_FLAG_SET(hits->at(i0).flag,BAM_FREAD2)!=IS_FLAG_SET(hits->at(i1).flag,BAM_FREAD2))
{
++i1;
continue;
}
if(!hits->at(i0).mapped() && !hits->at(i1).mapped())
{
break;
}
if(hits->at(i0).tid==-1 && hits->at(i1).tid==-1)
{
break;
}
else if(sameChromosome(
index2chromNames[hits->at(i0).bamIndex][hits->at(i0).tid].c_str(),
index2chromNames[hits->at(i1).bamIndex][hits->at(i1).tid].c_str()
))
{
if(hits->at(i0).pos==hits->at(i1).pos)
{
break;
}
}
++i1;
}
if(i1!= hits->size())
{
cout << it->key().ToString()
<< "\t";
if(IS_FLAG_SET(hits->at(i0).flag,BAM_FREAD1)) { cout << "1\t"; }
else if(IS_FLAG_SET(hits->at(i0).flag,BAM_FREAD2)) { cout << "2\t";}
else cout << "?\t";
print(hits->at(i0));
cout << "\t";
print(hits->at(i1));
cout << "\t=";
cout << endl;
hits->erase(hits->begin()+i1);//that one before
hits->erase(hits->begin()+i0);
}
else
{
++i0;
}
}
for(i0=0;i0<hits->size();++i0)
{
cout << it->key().ToString()
<< "\t";
if(IS_FLAG_SET(hits->at(i0).flag,BAM_FREAD1)) cout << "1\t";
else if(IS_FLAG_SET(hits->at(i0).flag,BAM_FREAD2)) cout << "2\t";
else cout << "?\t";
if(hits->at(i0).bamIndex==1) cout << ".\t";
print(hits->at(i0));
if(hits->at(i0).bamIndex==0) cout << "\t.";
cout << endl;
}
}
delete it;
}