Permalink
Browse files

TOUCH ascii-to-binary

Change-Id: Icf6d56350a57895a0e5b13c101c8f68755c89011
Reviewed-on: http://review.membase.org/6460
Tested-by: Steve Yen <steve.yen@gmail.com>
Reviewed-by: Bin Cui <bin.cui@gmail.com>
  • Loading branch information...
1 parent 9c43939 commit 27d639722e66091da96e33bcaf5dd7c07d21770c @steveyen steveyen committed with bcui6611 May 23, 2011
Showing with 19 additions and 0 deletions.
  1. +10 −0 cproxy_protocol_a.c
  2. +9 −0 cproxy_protocol_a2b.c
View
@@ -303,7 +303,17 @@ void cproxy_process_upstream_ascii(conn *c, char *line) {
(false == self_command) &&
(c->cmd_curr = PROTOCOL_BINARY_CMD_UNL)) {
cproxy_pause_upstream_for_downstream(ptd, c);
+
SEEN(STATS_CMD_UNL, false, cmd_len);
+
+ } else if (ntokens == 4 && // Ex: "touch <key> <expiration>"
+ (false == self_command) &&
+ (strncmp(cmd, "touch", 5) == 0) &&
+ (c->cmd_curr = PROTOCOL_BINARY_CMD_TOUCH)) {
+ cproxy_pause_upstream_for_downstream(ptd, c);
+
+ // TODO: SEEN(STATS_CMD_TOUCH, false, cmd_len);
+
} else {
out_string(c, "ERROR");
View
@@ -146,6 +146,14 @@ struct A2BSpec a2b_specs[] = {
.cmdq = -1,
.size = sizeof(protocol_binary_request_header)
},
+ { .line = "touch <key> <xpiration>",
+ .cmd = PROTOCOL_BINARY_CMD_TOUCH,
+ .cmdq = -1,
+ // The size should be...
+ // sizeof(protocol_binary_request_header) [24 bytes] +
+ // sizeof(protocol_binary_request_touch.message.body) [4 bytes]
+ .size = sizeof(protocol_binary_request_header) + 4,
+ },
{ .line = 0 } // NULL sentinel.
};
@@ -830,6 +838,7 @@ void a2b_process_downstream_response(conn *c) {
case PROTOCOL_BINARY_CMD_REPLACE:
case PROTOCOL_BINARY_CMD_APPEND:
case PROTOCOL_BINARY_CMD_PREPEND:
+ case PROTOCOL_BINARY_CMD_TOUCH:
conn_set_state(c, conn_pause);
if (uc != NULL) {

0 comments on commit 27d6397

Please sign in to comment.