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

Function main

lib_acl_cpp/samples/redis/redis_cluster/redis_cluster.cpp:124–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124int main(int argc, char* argv[])
125{
126 int ch, conn_timeout = 10, rw_timeout = 10;
127 acl::string addr("127.0.0.1:6379"), cmd, node;
128
129 while ((ch = getopt(argc, argv, "hs:n:C:T:a:i:")) > 0) {
130 switch (ch) {
131 case 'h':
132 usage(argv[0]);
133 return 0;
134 case 's':
135 addr = optarg;
136 break;
137 case 'C':
138 conn_timeout = atoi(optarg);
139 break;
140 case 'T':
141 rw_timeout = atoi(optarg);
142 break;
143 case 'a':
144 cmd = optarg;
145 break;
146 case 'i':
147 node = optarg;
148 break;
149 default:
150 break;
151 }
152 }
153
154 acl::acl_cpp_init();
155 acl::redis_client client(addr.c_str(), conn_timeout, rw_timeout);
156 acl::redis_cluster redis(&client);
157
158 bool ret;
159
160 if (cmd == "slots")
161 ret = test_slots(redis);
162 else if (cmd == "preset")
163 ret = preset_all(addr.c_str());
164 else if (cmd == "nodes")
165 ret = test_nodes(redis);
166 else if (cmd == "slaves") {
167 if (node.empty()) {
168 printf("usage: %s -a slaves -i node\r\n", argv[0]);
169 return 1;
170 }
171 ret = test_slaves(redis, node.c_str());
172 } else if (cmd == "info")
173 ret = test_info(redis);
174 else {
175 ret = false;
176 printf("unknown cmd: %s\r\n", cmd.c_str());
177 }
178
179 if (ret == true)
180 printf("test OK!\r\n");
181 else

Callers

nothing calls this directly

Calls 10

acl_cpp_initFunction · 0.85
test_slotsFunction · 0.85
preset_allFunction · 0.85
test_nodesFunction · 0.85
test_slavesFunction · 0.85
usageFunction · 0.70
test_infoFunction · 0.70
getoptFunction · 0.50
c_strMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…