From 8ac76be5f2d44341a1c7f67645c753aafbde7804 Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 1 Dec 2017 15:04:05 +0100 Subject: [PATCH] Streams: DEBUG DIGEST support. --- src/debug.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/debug.c b/src/debug.c index 5c3fd3471..5b08475a5 100644 --- a/src/debug.c +++ b/src/debug.c @@ -239,6 +239,27 @@ void computeDatasetDigest(unsigned char *final) { xorDigest(digest,eledigest,20); } hashTypeReleaseIterator(hi); + } else if (o->type == OBJ_STREAM) { + streamIterator si; + streamIteratorStart(&si,o->ptr,NULL,NULL,0); + streamID id; + int64_t numfields; + + while(streamIteratorGetID(&si,&id,&numfields)) { + sds itemid = sdscatfmt(sdsempty(),"%U.%U",id.ms,id.seq); + mixDigest(digest,itemid,sdslen(itemid)); + sdsfree(itemid); + + while(numfields--) { + unsigned char *field, *value; + int64_t field_len, value_len; + streamIteratorGetField(&si,&field,&value, + &field_len,&value_len); + mixDigest(digest,field,field_len); + mixDigest(digest,value,value_len); + } + } + streamIteratorStop(&si); } else if (o->type == OBJ_MODULE) { RedisModuleDigest md; moduleValue *mv = o->ptr;