Skip to content

Commit

Permalink
Remove unneeded namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanie-wang committed Feb 14, 2019
1 parent f508521 commit d5db5bd
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/ray/gcs/redis_module/ray_redis_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,15 @@ extern RedisChainModule module;
#define AUTO_MEMORY(FUNC) \
int FUNC(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { \
RedisModule_AutoMemory(ctx); \
return redis_commands::FUNC(ctx, argv, argc); \
return internal_redis_commands::FUNC(ctx, argv, argc); \
}

/// Commands in this namespace can be wrapped with AUTO_MEMORY in the
/// auto_memory_redis_commands namespace to enable automatic memory management.
namespace redis_commands {
// Commands in this namespace should not be used directly. They should first be
// wrapped with AUTO_MEMORY in the global namespace to enable automatic memory
// management.
// TODO(swang): Ideally, we would make the commands that don't have auto memory
// management inaccessible instead of just using a separate namespace.
namespace internal_redis_commands {

/// Map from pub sub channel to clients that are waiting on that channel.
std::unordered_map<std::string, std::vector<std::string>> notification_map;
Expand Down Expand Up @@ -684,7 +687,6 @@ int DebugString_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int
}
};

namespace auto_memory_redis_commands {
// Wrap all Redis commands with Redis' auto memory management.
AUTO_MEMORY(TableAdd_RedisCommand);
AUTO_MEMORY(TableAppend_RedisCommand);
Expand All @@ -697,13 +699,8 @@ AUTO_MEMORY(DebugString_RedisCommand);
AUTO_MEMORY(ChainTableAdd_RedisCommand);
AUTO_MEMORY(ChainTableAppend_RedisCommand);
#endif
};

extern "C" {
// Only use commands that have auto memory management.
// TODO(swang): Ideally, we would make the commands that don't have auto memory
// management inaccessible instead of just using separate namespaces.
using namespace auto_memory_redis_commands;

/* This function must be present on each Redis module. It is used in order to
* register the commands into the Redis server. */
Expand Down

0 comments on commit d5db5bd

Please sign in to comment.