void glob update std string key leveldb DB db leveldb Options options

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
void glob::update(std::string key){
leveldb::DB* db;
leveldb::Options options;
options.create_if_missing = true;
leveldb::Status status = leveldb::DB::Open(options, "/tmp/searchdb1", &db);
assert(status.ok());
if (!status.ok()) std::cout << status.ToString() << std::endl;
/*
const int i = 1;
const char* fileName = "saved.txt";
{
std::ofstream ofs(fileName);
boost::archive::text_oarchive ar(ofs);
ar & states[0].path & states[0].search & states[0].total; //узел конфигурации с сериализацией
}
std::ifstream ifs(fileName);
std::string value;
std::getline(ifs, value);*/
double start = clock();
long long int loop = 8000000;
for(int i = 0; i < loop; i++)
db->Put(leveldb::WriteOptions(), "key", states[0].path);
printf("TIME %f\n", ((double)clock() - start)/(CLOCKS_PER_SEC*loop));
delete db;
}