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

Function hspool_find

lib_acl_cpp/samples/hsclient/main.cpp:298–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298static void hspool_find(const char* addr, int num, bool enable_cache)
299{
300 const char* dbn = "test", *tbl = "user", *idx;
301 const char* flds = "user_id,user_name,user_email";
302 char buf[256];
303 const char* addr_rd = "192.168.1.232:9998";
304 acl::hspool pool(addr, addr_rd, enable_cache);
305 acl::hsclient* client;
306
307 idx = "PRIMARY";
308 for (int i = 0; i < 10; i++)
309 {
310 client = pool.peek(dbn, tbl, idx, flds);
311 if (client == NULL)
312 {
313 printf("peek error\n");
314 break;
315 }
316 printf(">>read addr: %s\n", client->get_addr());
317 pool.put(client);
318 }
319
320 printf("========================================================\n");
321
322 for (int i = 0; i < 10; i++)
323 {
324 client = pool.peek(dbn, tbl, idx, flds);
325 if (client == NULL)
326 {
327 printf("peek error\n");
328 break;
329 }
330 printf(">>read/write addr: %s\n", client->get_addr());
331 pool.put(client);
332 }
333
334 //////////////////////////////////////////////////////////////////////
335
336 printf("========================================================\n");
337 idx = "PRIMARY";
338 for (int i = 0; i < num; i++)
339 {
340 snprintf(buf, sizeof(buf), "%d", i);
341
342 client = pool.peek(dbn, tbl, idx, flds);
343 if (client == NULL)
344 {
345 printf("peek error\n");
346 break;
347 }
348
349 const std::vector<acl::hsrow*>& rows =
350 client->get(buf, NULL);
351 if (rows.empty())
352 {
353 printf("find(%s) error\n", buf);
354 pool.put(client);
355 break;

Callers

nothing calls this directly

Calls 7

hs_dumpFunction · 0.85
peekMethod · 0.45
get_addrMethod · 0.45
putMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45
get_idMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…