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

Function hs_find2

lib_acl_cpp/samples/hsclient/main.cpp:215–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213}
214
215static void hs_find2(const char* addr, int num, bool enable_cache)
216{
217 const char* dbn = "test", *tbl = "user", *idx = "PRIMARY";
218 const char* flds = "user_id,user_name,user_email";
219 char buf[256];
220 acl::hsclient client(addr, enable_cache);
221
222 if (client.open_tbl(dbn, tbl, idx, flds) == false)
223 {
224 printf("open %s error: %s\n", addr, client.get_last_serror());
225 return;
226 }
227
228 for (int i = 0; i < num; i++)
229 {
230 snprintf(buf, sizeof(buf), "%d", i);
231
232 const std::vector<acl::hsrow*>& rows =
233 client.get(buf, NULL);
234 if (rows.empty())
235 {
236 printf("find(%s) error\n", buf);
237 break;
238 }
239
240
241 if (i % 10000 == 0)
242 {
243 snprintf(buf, sizeof(buf), "find, num: %d\n", i);
244 ACL_METER_TIME(buf);
245 }
246 if (i > 1000)
247 continue;
248
249 hs_dump(rows);
250 }
251}
252
253static void hs_update(const char* addr, int num, bool enable_cache)
254{

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…