Skip to content

Commit

Permalink
DBRedis: add replyTypeStr
Browse files Browse the repository at this point in the history
Maps Redis response constants to strings
  • Loading branch information
Nestorfish authored and sfan5 committed Oct 21, 2016
1 parent 26b6293 commit 53706e8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions db-redis.cpp
Expand Up @@ -71,6 +71,26 @@ std::vector<BlockPos> DBRedis::getBlockPos()
}


std::string DBRedis::replyTypeStr(int type) {
switch(type) {
case REDIS_REPLY_STATUS:
return "REDIS_REPLY_STATUS";
case REDIS_REPLY_ERROR:
return "REDIS_REPLY_ERROR";
case REDIS_REPLY_INTEGER:
return "REDIS_REPLY_INTEGER";
case REDIS_REPLY_NIL:
return "REDIS_REPLY_NIL";
case REDIS_REPLY_STRING:
return "REDIS_REPLY_STRING";
case REDIS_REPLY_ARRAY:
return "REDIS_REPLY_ARRAY";
default:
return "UNKNOWN_REPLY_TYPE";
}
}


void DBRedis::loadPosCache()
{
redisReply *reply;
Expand Down
2 changes: 2 additions & 0 deletions db-redis.h
Expand Up @@ -11,6 +11,8 @@ class DBRedis : public DB {
virtual void getBlocksOnZ(std::map<int16_t, BlockList> &blocks, int16_t zPos);
virtual ~DBRedis();
private:
static std::string replyTypeStr(int type);

void loadPosCache();

std::vector<BlockPos> posCache;
Expand Down

0 comments on commit 53706e8

Please sign in to comment.