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

Method get_slot

lib_acl_cpp/src/redis/redis_cluster.cpp:599–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

597}
598
599redis_slot* redis_cluster::get_slot(const redis_result* rr,
600 size_t slot_max, size_t slot_min)
601{
602 if (rr == NULL) {
603 return NULL;
604 }
605
606 size_t size;
607 const redis_result** children = rr->get_children(&size);
608 if (children == NULL || size < 2) {
609 return NULL;
610 }
611
612 char ip[128];
613 if (children[0]->argv_to_string(ip, sizeof(ip)) <= 0) {
614 return NULL;
615 }
616
617 int port = children[1]->get_integer();
618 if (port <= 0) {
619 return NULL;
620 }
621
622 redis_slot* slot = NEW redis_slot(slot_min, slot_max, ip, port);
623 return slot;
624}
625
626void redis_cluster::free_slots()
627{

Callers 4

reopenMethod · 0.80
cluster_downMethod · 0.80
runMethod · 0.80
runMethod · 0.80

Calls 4

redis_slotClass · 0.50
get_childrenMethod · 0.45
argv_to_stringMethod · 0.45
get_integerMethod · 0.45

Tested by

no test coverage detected