Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
b4ba5ac8
Commit
b4ba5ac8
authored
Jul 16, 2018
by
zhaozhao.zz
Browse files
Streams: show last id for streams and groups
parent
ab33bcd3
Changes
1
Show whitespace changes
Inline
Side-by-side
src/t_stream.c
View file @
b4ba5ac8
...
@@ -2279,18 +2279,20 @@ NULL
...
@@ -2279,18 +2279,20 @@ NULL
raxSeek(&ri,"^",NULL,0);
raxSeek(&ri,"^",NULL,0);
while(raxNext(&ri)) {
while(raxNext(&ri)) {
streamCG *cg = ri.data;
streamCG *cg = ri.data;
addReplyMultiBulkLen
(
c
,
6
);
addReplyMultiBulkLen(c,
8
);
addReplyStatus(c,"name");
addReplyStatus(c,"name");
addReplyBulkCBuffer(c,ri.key,ri.key_len);
addReplyBulkCBuffer(c,ri.key,ri.key_len);
addReplyStatus(c,"consumers");
addReplyStatus(c,"consumers");
addReplyLongLong(c,raxSize(cg->consumers));
addReplyLongLong(c,raxSize(cg->consumers));
addReplyStatus(c,"pending");
addReplyStatus(c,"pending");
addReplyLongLong(c,raxSize(cg->pel));
addReplyLongLong(c,raxSize(cg->pel));
addReplyStatus(c,"last-delivered-id");
addReplyStreamID(c,&cg->last_id);
}
}
raxStop(&ri);
raxStop(&ri);
} else if (!strcasecmp(opt,"STREAM") && c->argc == 3) {
} else if (!strcasecmp(opt,"STREAM") && c->argc == 3) {
/* XINFO STREAM <key> (or the alias XINFO <key>). */
/* XINFO STREAM <key> (or the alias XINFO <key>). */
addReplyMultiBulkLen
(
c
,
1
2
);
addReplyMultiBulkLen(c,1
4
);
addReplyStatus(c,"length");
addReplyStatus(c,"length");
addReplyLongLong(c,s->length);
addReplyLongLong(c,s->length);
addReplyStatus(c,"radix-tree-keys");
addReplyStatus(c,"radix-tree-keys");
...
@@ -2299,6 +2301,8 @@ NULL
...
@@ -2299,6 +2301,8 @@ NULL
addReplyLongLong(c,s->rax->numnodes);
addReplyLongLong(c,s->rax->numnodes);
addReplyStatus(c,"groups");
addReplyStatus(c,"groups");
addReplyLongLong(c,s->cgroups ? raxSize(s->cgroups) : 0);
addReplyLongLong(c,s->cgroups ? raxSize(s->cgroups) : 0);
addReplyStatus(c,"last-id");
addReplyStreamID(c,&s->last_id);
/* To emit the first/last entry we us the streamReplyWithRange()
/* To emit the first/last entry we us the streamReplyWithRange()
* API. */
* API. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment