void Database_Dummy::listAllLoadableBlocks(std::vector<v3s16> &dst) { dst.reserve(m_database.size()); for (std::map<s64, std::string>::const_iterator x = m_database.begin(); x != m_database.end(); ++x) { dst.push_back(getIntegerAsBlock(x->first)); } }
void Database_Dummy::listAllLoadableBlocks(std::list<v3s16> &dst) { for(std::map<u64, std::string>::iterator x = m_database.begin(); x != m_database.end(); ++x) { v3s16 p = getIntegerAsBlock(x->first); //dstream<<"block_i="<<block_i<<" p="<<PP(p)<<std::endl; dst.push_back(p); } }
void Database_LevelDB::listAllLoadableBlocks(std::list<v3s16> &dst) { leveldb::Iterator* it = m_database->NewIterator(leveldb::ReadOptions()); for (it->SeekToFirst(); it->Valid(); it->Next()) { dst.push_back(getIntegerAsBlock(stoi64(it->key().ToString()))); } ENSURE_STATUS_OK(it->status()); // Check for any errors found during the scan delete it; }
void Database_SQLite3::listAllLoadableBlocks(std::vector<v3s16> &dst) { verifyDatabase(); while (sqlite3_step(m_stmt_list) == SQLITE_ROW) { dst.push_back(getIntegerAsBlock(sqlite3_column_int64(m_stmt_list, 0))); } sqlite3_reset(m_stmt_list); }
void Database_SQLite3::listAllLoadableBlocks(core::list<v3s16> &dst) { verifyDatabase(); while(sqlite3_step(m_database_list) == SQLITE_ROW) { sqlite3_int64 block_i = sqlite3_column_int64(m_database_list, 0); v3s16 p = getIntegerAsBlock(block_i); //dstream<<"block_i="<<block_i<<" p="<<PP(p)<<std::endl; dst.push_back(p); } }
void Database_Redis::listAllLoadableBlocks(std::list<v3s16> &dst) { redisReply *reply; reply = (redisReply*) redisCommand(ctx, "HKEYS %s", hash.c_str()); if(!reply) throw FileNotGoodException(std::string("redis command 'HKEYS %s' failed: ") + ctx->errstr); if(reply->type != REDIS_REPLY_ARRAY) throw FileNotGoodException("Failed to get keys from database"); for(size_t i = 0; i < reply->elements; i++) { assert(reply->element[i]->type == REDIS_REPLY_STRING); dst.push_back(getIntegerAsBlock(stoi64(reply->element[i]->str))); } freeReplyObject(reply); }
void Database_Redis::listAllLoadableBlocks(std::vector<v3s16> &dst) { redisReply *reply = static_cast<redisReply *>(redisCommand(ctx, "HKEYS %s", hash.c_str())); if (!reply) { throw FileNotGoodException(std::string( "Redis command 'HKEYS %s' failed: ") + ctx->errstr); } switch (reply->type) { case REDIS_REPLY_ARRAY: for (size_t i = 0; i < reply->elements; i++) { assert(reply->element[i]->type == REDIS_REPLY_STRING); dst.push_back(getIntegerAsBlock(stoi64(reply->element[i]->str))); } case REDIS_REPLY_ERROR: throw FileNotGoodException(std::string( "Failed to get keys from database: ") + reply->str); } freeReplyObject(reply); }