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

Method create_node

lib_acl_cpp/src/disque/disque.cpp:497–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495}
496
497disque_node* disque::create_node(const redis_result* rr)
498{
499 if (rr->get_type() != REDIS_RESULT_ARRAY) {
500 return NULL;
501 }
502
503 size_t n;
504 const redis_result** children = rr->get_children(&n);
505 if (n < 4) {
506 return NULL;
507 }
508
509 if (children[0]->get_type() != REDIS_RESULT_STRING) {
510 return NULL;
511 }
512 string id;
513 children[0]->argv_to_string(id);
514
515 if (children[1]->get_type() != REDIS_RESULT_STRING) {
516 return NULL;
517 }
518 string ip;
519 children[1]->argv_to_string(ip);
520
521 if (children[2]->get_type() != REDIS_RESULT_STRING) {
522 return NULL;
523 }
524 string tmp;
525 children[2]->argv_to_string(tmp);
526 int port = ::atoi(tmp.c_str());
527
528 if (children[3]->get_type() != REDIS_RESULT_STRING) {
529 return NULL;
530 }
531 children[3]->argv_to_string(tmp);
532 int priority = ::atoi(tmp.c_str());
533
534 disque_node* node = NEW disque_node;
535 node->set_id(id.c_str());
536 node->set_ip(ip.c_str());
537 node->set_port(port);
538 node->set_priority(priority);
539
540 return node;
541}
542
543void disque::free_nodes(void)
544{

Callers 14

mainFunction · 0.45
testFunction · 0.45
test_buildFunction · 0.45
mainFunction · 0.45
testFunction · 0.45
test_buildFunction · 0.45
testFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
testFunction · 0.45
mainFunction · 0.45
testFunction · 0.45

Calls 5

get_typeMethod · 0.45
get_childrenMethod · 0.45
argv_to_stringMethod · 0.45
c_strMethod · 0.45
set_idMethod · 0.45

Tested by 2

test_buildFunction · 0.36
test_buildFunction · 0.36