2016-08-17 3 views
0

나는 다음과 같은 코드 조각이 :사용 rocksdb :: 반복자 및 열 패밀리가 작동하지

rocksdb::DBWithTTL* db = ... 
rocksdb::WriteOptions writeOptions; 
rocksdb::ColumnFamilyHandle cfHandle = ... 

std::string keyPrefix = "prefix"; 
std::string key = keyPrefix + "_key"; 
std::string value = "value"; 
rocksdb::Status s = db->Put(writeOptions, cfHandle, key, value); 

rocksdb::ReadOptions readOptions; 
readOptions.prefix_same_as_start; 
readOptions.snapshot = db->GetSnapshot(); 
rocksdb::Iterator* iterator = db->NewIterator(readOptions); 

rocksdb::Sliced start = rocksdb::Slice(keyPrefix); 
for (iterator->Seek(start); iterator->Valid(); iterator->Next()) { 
    printf("hello"); 
} 

printf이 명중되지 않습니다를. 나는에 Put 라인을 변경하는 경우

그러나, 상기 column family handle을 제거

rocksdb::Status s = db->Put(writeOptions, key, value); 

의미, 나는 선 인쇄 벌금을 얻고있다.

필자는 iterator API가 열 패밀리를 고려해야한다고 생각하지만 문서를 찾을 수 없습니다.

답변

0

는 사실 누락 된 API 호출했다 :

rocksdb::Iterator* iterator = db->NewIterator(readOptions, cfHandle); 
관련 문제