| 1005 | } |
| 1006 | |
| 1007 | bool redis_stream::get_pending_message(const redis_result& rr, |
| 1008 | redis_pending_message& message) |
| 1009 | { |
| 1010 | if (rr.get_type() != REDIS_RESULT_ARRAY) { |
| 1011 | return false; |
| 1012 | } |
| 1013 | |
| 1014 | size_t size; |
| 1015 | const redis_result** children = rr.get_children(&size); |
| 1016 | if (children == NULL || size < 4) { |
| 1017 | return false; |
| 1018 | } |
| 1019 | |
| 1020 | const redis_result* child = children[0]; |
| 1021 | if (child->get_type() != REDIS_RESULT_STRING) { |
| 1022 | return false; |
| 1023 | } |
| 1024 | child->argv_to_string(message.id); |
| 1025 | |
| 1026 | child = children[1]; |
| 1027 | if (child->get_type() != REDIS_RESULT_STRING) { |
| 1028 | return false; |
| 1029 | } |
| 1030 | child->argv_to_string(message.consumer); |
| 1031 | |
| 1032 | child = children[2]; |
| 1033 | if (child->get_type() != REDIS_RESULT_INTEGER) { |
| 1034 | return false; |
| 1035 | } |
| 1036 | bool success; |
| 1037 | long long n = child->get_integer64(&success); |
| 1038 | if (n < 0 || !success) { |
| 1039 | return false; |
| 1040 | } |
| 1041 | message.elapsed = (unsigned long long) n; |
| 1042 | |
| 1043 | n = child->get_integer(&success); |
| 1044 | if (n < 0 || !success) { |
| 1045 | return false; |
| 1046 | } |
| 1047 | message.delivered = (size_t) n; |
| 1048 | |
| 1049 | return true; |
| 1050 | } |
| 1051 | |
| 1052 | ////////////////////////////////////////////////////////////////////////////// |
| 1053 |
nothing calls this directly
no test coverage detected