MCPcopy Create free account
hub / github.com/F-Stack/f-stack / streamRewriteTrimArgument

Function streamRewriteTrimArgument

app/redis-6.2.6/src/t_stream.c:1770–1782  ·  view source on GitHub ↗

We propagate MAXLEN/MINID ~ as MAXLEN/MINID = * otherwise trimming is no longer deterministic on replicas / AOF. */

Source from the content-addressed store, hash-verified

1768/* We propagate MAXLEN/MINID ~ <count> as MAXLEN/MINID = <resulting-len-of-stream>
1769 * otherwise trimming is no longer deterministic on replicas / AOF. */
1770void streamRewriteTrimArgument(client *c, stream *s, int trim_strategy, int idx) {
1771 robj *arg;
1772 if (trim_strategy == TRIM_STRATEGY_MAXLEN) {
1773 arg = createStringObjectFromLongLong(s->length);
1774 } else {
1775 streamID first_id;
1776 streamGetEdgeID(s, 1, &first_id);
1777 arg = createObjectFromStreamID(&first_id);
1778 }
1779
1780 rewriteClientCommandArgument(c,idx,arg);
1781 decrRefCount(arg);
1782}
1783
1784/* XADD key [(MAXLEN [~|=] <count> | MINID [~|=] <id>) [LIMIT <entries>]] [NOMKSTREAM] <ID or *> [field value] [field value] ... */
1785void xaddCommand(client *c) {

Callers 2

xaddCommandFunction · 0.85
xtrimCommandFunction · 0.85

Calls 5

streamGetEdgeIDFunction · 0.85
createObjectFromStreamIDFunction · 0.85
decrRefCountFunction · 0.85

Tested by

no test coverage detected