mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
Streams: XRANGE REV option -> XREVRANGE command.
This commit is contained in:
parent
9dc79c039a
commit
9bb18e5438
@ -304,6 +304,7 @@ struct redisCommand redisCommandTable[] = {
|
||||
{"pfdebug",pfdebugCommand,-3,"w",0,NULL,0,0,0,0,0},
|
||||
{"xadd",xaddCommand,-5,"wmF",0,NULL,1,1,1,0,0},
|
||||
{"xrange",xrangeCommand,-4,"r",0,NULL,1,1,1,0,0},
|
||||
{"xrevrange",xrevrangeCommand,-4,"r",0,NULL,1,1,1,0,0},
|
||||
{"xlen",xlenCommand,2,"rF",0,NULL,1,1,1,0,0},
|
||||
{"xread",xreadCommand,-3,"rs",0,xreadGetKeys,1,1,1,0,0},
|
||||
{"post",securityWarningCommand,-1,"lt",0,NULL,0,0,0,0,0},
|
||||
|
@ -2010,6 +2010,7 @@ void moduleCommand(client *c);
|
||||
void securityWarningCommand(client *c);
|
||||
void xaddCommand(client *c);
|
||||
void xrangeCommand(client *c);
|
||||
void xrevrangeCommand(client *c);
|
||||
void xlenCommand(client *c);
|
||||
void xreadCommand(client *c);
|
||||
|
||||
|
@ -856,16 +856,17 @@ void xaddCommand(client *c) {
|
||||
signalKeyAsReady(c->db, c->argv[1]);
|
||||
}
|
||||
|
||||
/* XRANGE key start end [COUNT <n>] [REV] */
|
||||
void xrangeCommand(client *c) {
|
||||
/* XRANGE/XREVRANGE actual implementation. */
|
||||
void xrangeGenericCommand(client *c, int rev) {
|
||||
robj *o;
|
||||
stream *s;
|
||||
streamID startid, endid;
|
||||
long long count = 0;
|
||||
int rev = 0;
|
||||
robj *startarg = rev ? c->argv[3] : c->argv[2];
|
||||
robj *endarg = rev ? c->argv[2] : c->argv[3];
|
||||
|
||||
if (streamParseIDOrReply(c,c->argv[2],&startid,0) == C_ERR) return;
|
||||
if (streamParseIDOrReply(c,c->argv[3],&endid,UINT64_MAX) == C_ERR) return;
|
||||
if (streamParseIDOrReply(c,startarg,&startid,0) == C_ERR) return;
|
||||
if (streamParseIDOrReply(c,endarg,&endid,UINT64_MAX) == C_ERR) return;
|
||||
|
||||
/* Parse the COUNT option if any. */
|
||||
if (c->argc > 4) {
|
||||
@ -876,8 +877,6 @@ void xrangeCommand(client *c) {
|
||||
!= C_OK) return;
|
||||
if (count < 0) count = 0;
|
||||
j++; /* Consume additional arg. */
|
||||
} else if (strcasecmp(c->argv[j]->ptr,"REV") == 0) {
|
||||
rev = 1;
|
||||
} else {
|
||||
addReply(c,shared.syntaxerr);
|
||||
return;
|
||||
@ -892,6 +891,16 @@ void xrangeCommand(client *c) {
|
||||
streamReplyWithRange(c,s,&startid,&endid,count,rev);
|
||||
}
|
||||
|
||||
/* XRANGE key start end [COUNT <n>] */
|
||||
void xrangeCommand(client *c) {
|
||||
xrangeGenericCommand(c,0);
|
||||
}
|
||||
|
||||
/* XREVRANGE key end start [COUNT <n>] */
|
||||
void xrevrangeCommand(client *c) {
|
||||
xrangeGenericCommand(c,1);
|
||||
}
|
||||
|
||||
/* XLEN */
|
||||
void xlenCommand(client *c) {
|
||||
robj *o;
|
||||
|
Loading…
x
Reference in New Issue
Block a user