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

Function hs_find

lib_acl_cpp/samples/hsclient/main.cpp:174–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174static void hs_find(const char* addr, int num, bool enable_cache)
175{
176 const char* dbn = "test", *tbl = "user", *idx = "user_name";
177 const char* flds = "user_id,user_name,user_email";
178 const char* bufs[2];
179 char buf[256];
180 acl::hsclient client(addr, enable_cache);
181
182 if (client.open_tbl(dbn, tbl, idx, flds) == false)
183 {
184 printf("connect %s error\n", addr);
185 return;
186 }
187
188 printf(">>dbn: %s, tbl: %s, idx: %s, flds: %s\n", dbn, tbl, idx, flds);
189
190 for (int i = 0; i < num; i++)
191 {
192 snprintf(buf, sizeof(buf), "zsxxsz%d", i);
193 bufs[0] = buf;
194
195 const std::vector<acl::hsrow*>& rows =
196 client.get(bufs, 1, "=", 1, 0);
197 if (rows.empty())
198 {
199 printf("find(%s) error:%s(%d)\n",
200 buf, client.get_last_serror(), client.get_error());
201 break;
202 }
203
204 if (i > 0 && i % 10000 == 0)
205 {
206 snprintf(buf, sizeof(buf), "find, num: %d\n", i);
207 ACL_METER_TIME(buf);
208 }
209 if (i > 1000)
210 continue;
211 hs_dump(rows);
212 }
213}
214
215static void hs_find2(const char* addr, int num, bool enable_cache)
216{

Callers

nothing calls this directly

Calls 6

hs_dumpFunction · 0.85
open_tblMethod · 0.80
get_last_serrorMethod · 0.80
getMethod · 0.45
emptyMethod · 0.45
get_errorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…