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

Method get_messages

lib_acl_cpp/src/redis/redis_stream.cpp:427–465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

425}
426
427bool redis_stream::get_messages(const redis_result& rr,
428 redis_stream_messages& messages)
429{
430 size_t size;
431 const redis_result** children = rr.get_children(&size);
432 if (size != 2) {
433 return false;
434 }
435
436 const redis_result* child = children[0];
437 if (child->get_type() != REDIS_RESULT_STRING) {
438 return false;
439 }
440 child->argv_to_string(messages.key);
441
442 child = children[1];
443 if (child->get_type() != REDIS_RESULT_ARRAY) {
444 return false;
445 }
446
447 children = child->get_children(&size);
448 if (size == 0 || children == NULL) {
449 return false;
450 }
451
452 for (size_t i = 0; i < size; i++) {
453 child = children[i];
454 if (child->get_type() != REDIS_RESULT_ARRAY) {
455 continue;
456 }
457
458 redis_stream_message message;
459 bool ret = get_one_message(*child, message);
460 if (ret && !message.fields.empty()) {
461 messages.messages.push_back(message);
462 }
463 }
464 return true;
465}
466
467bool redis_stream::get_one_message(const redis_result& rr,
468 redis_stream_message& message)

Callers

nothing calls this directly

Calls 5

get_childrenMethod · 0.45
get_typeMethod · 0.45
argv_to_stringMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected