Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
git-hulk committed Jun 15, 2024
1 parent 60cd76b commit 89a61d8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/cluster/replication.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1001,17 +1001,17 @@ Status ReplicationThread::parseWriteBatch(const std::string &batch_string) {

bool ReplicationThread::isRestoringError(std::string_view err) {
// err doesn't contain the CRLF, so cannot use redis::Error here.
return err == RESP_PREFIX_ERROR + redis::StatusToRedisError({Status::RedisLoading, redis::errRestoringBackup});
return err == RESP_PREFIX_ERROR + redis::StatusToRedisErrorMsg({Status::RedisLoading, redis::errRestoringBackup});
}

bool ReplicationThread::isWrongPsyncNum(std::string_view err) {
// err doesn't contain the CRLF, so cannot use redis::Error here.
return err == RESP_PREFIX_ERROR + redis::StatusToRedisError({Status::NotOK, redis::errWrongNumArguments});
return err == RESP_PREFIX_ERROR + redis::StatusToRedisErrorMsg({Status::NotOK, redis::errWrongNumArguments});
}

bool ReplicationThread::isUnknownOption(std::string_view err) {
// err doesn't contain the CRLF, so cannot use redis::Error here.
return err == RESP_PREFIX_ERROR + redis::StatusToRedisError({Status::NotOK, redis::errUnknownOption});
return err == RESP_PREFIX_ERROR + redis::StatusToRedisErrorMsg({Status::NotOK, redis::errUnknownOption});
}

rocksdb::Status WriteBatchHandler::PutCF(uint32_t column_family_id, const rocksdb::Slice &key,
Expand Down
4 changes: 2 additions & 2 deletions src/server/redis_reply.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ void Reply(evbuffer *output, const std::string &data) { evbuffer_add(output, dat

std::string SimpleString(const std::string &data) { return "+" + data + CRLF; }

std::string Error(const Status &s) { return RESP_PREFIX_ERROR + StatusToRedisError(s) + CRLF; }
std::string Error(const Status &s) { return RESP_PREFIX_ERROR + StatusToRedisErrorMsg(s) + CRLF; }

std::string StatusToRedisError(const Status &s) {
std::string StatusToRedisErrorMsg(const Status &s) {
CHECK(!s.IsOK());
std::string prefix = "ERR";
if (auto it = redisErrorPrefixMapping.find(s.GetCode()); it != redisErrorPrefixMapping.end()) {
Expand Down
2 changes: 1 addition & 1 deletion src/server/redis_reply.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void Reply(evbuffer *output, const std::string &data);
std::string SimpleString(const std::string &data);

std::string Error(const Status &s);
std::string StatusToRedisError(const Status &s);
std::string StatusToRedisErrorMsg(const Status &s);

template <typename T, std::enable_if_t<std::is_integral_v<T>, int> = 0>
std::string Integer(T data) {
Expand Down
2 changes: 1 addition & 1 deletion src/storage/scripting.cc
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ int RedisGenericCommand(lua_State *lua, int raise_error) {
if (config->cluster_enabled) {
auto s = srv->cluster->CanExecByMySelf(attributes, args, conn);
if (!s.IsOK()) {
PushError(lua, redis::StatusToRedisError(s).c_str());
PushError(lua, redis::StatusToRedisErrorMsg(s).c_str());
return raise_error ? RaiseError(lua) : 1;
}
}
Expand Down

0 comments on commit 89a61d8

Please sign in to comment.