MCPcopy Create free account
hub / github.com/acl-dev/acl / xpending_summary

Method xpending_summary

lib_acl_cpp/src/redis/redis_stream.cpp:831–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

829//////////////////////////////////////////////////////////////////////////////
830
831bool redis_stream::xpending_summary(const char* key, const char* group,
832 redis_pending_summary& result)
833{
834 const char* argv[3];
835 size_t lens[3];
836
837 argv[0] = "XPENDING";
838 lens[0] = sizeof("XPENDING") - 1;
839 argv[1] = key;
840 lens[1] = strlen(key);
841 argv[2] = group;
842 lens[2] = strlen(group);
843
844 hash_slot(key);
845 build_request(3, argv, lens);
846 const redis_result* rr = run();
847 if (rr == NULL || rr->get_type() != REDIS_RESULT_ARRAY) {
848 return false;
849 }
850
851 size_t size;
852 const redis_result** children = rr->get_children(&size);
853 if (size < 4) {
854 return false;
855 }
856
857 rr = children[0];
858 if (rr->get_type() != REDIS_RESULT_INTEGER) {
859 return false;
860 }
861
862 int n = rr->get_integer();
863 if (n < 0) {
864 return false;
865 } else if (n == 0) {
866 return true;
867 }
868
869 rr = children[1];
870 if (rr->get_type() == REDIS_RESULT_STRING) {
871 rr->argv_to_string(result.smallest_id);
872 }
873
874 rr = children[2];
875 if (rr->get_type() == REDIS_RESULT_STRING) {
876 rr->argv_to_string(result.greatest_id);
877 }
878
879 rr = children[3];
880 if (rr->get_type() != REDIS_RESULT_ARRAY) {
881 return false;
882 }
883
884 children = rr->get_children(&size);
885 if (children == NULL || size == 0) {
886 return false;
887 }
888

Callers 1

xpending_summaryFunction · 0.80

Calls 9

hash_slotFunction · 0.85
build_requestFunction · 0.50
runFunction · 0.50
get_typeMethod · 0.45
get_childrenMethod · 0.45
get_integerMethod · 0.45
argv_to_stringMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected