[
https://issues.apache.org/jira/browse/GEODE-8151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17112764#comment-17112764
]
ASF GitHub Bot commented on GEODE-8151:
---------------------------------------
dschneider-pivotal commented on a change in pull request #5140:
URL: https://github.com/apache/geode/pull/5140#discussion_r428425213
##########
File path:
geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HScanExecutor.java
##########
@@ -95,28 +94,24 @@ public void executeCommand(Command command,
ExecutionHandlerContext context) {
count = Coder.bytesToInt(bytes);
}
} catch (NumberFormatException e) {
-
command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(),
ERROR_COUNT));
- return;
+ return RedisResponse.error(ERROR_COUNT);
}
}
if (count < 0) {
-
command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(),
ERROR_COUNT));
- return;
+ return RedisResponse.error(ERROR_COUNT);
}
try {
matchPattern = convertGlobToRegex(globMatchPattern);
} catch (PatternSyntaxException e) {
- command.setResponse(
- Coder.getErrorResponse(context.getByteBufAllocator(),
RedisConstants.ERROR_ILLEGAL_GLOB));
- return;
+ return RedisResponse.error(RedisConstants.ERROR_ILLEGAL_GLOB);
Review comment:
a static import of ERROR_ILLEGAL_GLOB would be nice
##########
File path:
geode-redis/src/main/java/org/apache/geode/redis/internal/executor/hash/HExistsExecutor.java
##########
@@ -53,12 +54,7 @@ public void executeCommand(Command command,
ExecutionHandlerContext context) {
RedisHash map = getRedisHash(context, key);
boolean hasField = map.containsKey(field);
- if (hasField) {
-
command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(),
EXISTS));
- } else {
-
command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(),
NOT_EXISTS));
- }
-
+ return RedisResponse.integer(hasField ? EXISTS : NOT_EXISTS);
Review comment:
What do you think of supporting a flavor of "integer(boolean)" that
would respond with 1 if true and 0 if false? I've seen a large number of redis
commands that do this
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Convert all redis commands to return RedisResponse
> --------------------------------------------------
>
> Key: GEODE-8151
> URL: https://issues.apache.org/jira/browse/GEODE-8151
> Project: Geode
> Issue Type: Improvement
> Components: redis
> Reporter: Jens Deppe
> Assignee: Jens Deppe
> Priority: Major
>
> This is an ongoing effort to refactor all redis commands to return
> RedisResponse
--
This message was sent by Atlassian Jira
(v8.3.4#803005)