Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Replace std::list by std::vector into ServerMap::listAllLoadableBlock…
…s ServerMap::listAllLoadedBlocks and their database backends. This adds a speedup on database migration and /clearobjects command
- Loading branch information
Showing
13 changed files
with
43 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,16 +147,15 @@ bool Database_Redis::deleteBlock(v3s16 blockpos) | |
return true; | ||
} | ||
|
||
void Database_Redis::listAllLoadableBlocks(std::list<v3s16> &dst) | ||
void Database_Redis::listAllLoadableBlocks(std::vector<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++) | ||
{ | ||
for(size_t i = 0; i < reply->elements; i++) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
nerzhul
Author
Member
|
||
assert(reply->element[i]->type == REDIS_REPLY_STRING); | ||
dst.push_back(getIntegerAsBlock(stoi64(reply->element[i]->str))); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can optimize some places like here by adding
dst.reserve(reply->elements);
to prevent reallocations.