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

Function hspool_update

lib_acl_cpp/samples/hsclient/main.cpp:449–496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447}
448
449static void hspool_update(const char* addr, int num, bool enable_cache)
450{
451 const char* dbn = "test", *tbl = "user", *idx;
452 const char* flds = "user_name,user_email";
453 const char* bufs[2], *bufs_to[2];
454 char buf[256], buf_to1[256], buf_to2[256];
455 const char* addr_rd = "192.168.1.232:9998";
456 acl::hspool pool(addr, addr_rd, enable_cache);
457 acl::hsclient* client;
458
459 idx = "PRIMARY";
460 for (int i = 0; i < num; i++)
461 {
462 snprintf(buf, sizeof(buf), "%d", i);
463
464 client = pool.peek(dbn, tbl, idx, flds);
465 if (client == NULL)
466 {
467 printf("peek error\n");
468 break;
469 }
470
471 snprintf(buf, sizeof(buf), "%d", i);
472 bufs[0] = buf;
473
474 snprintf(buf_to1, sizeof(buf_to1), "zsxxsz_%d", i);
475 snprintf(buf_to2, sizeof(buf_to2), "zsxxsz_%d@test.com", i);
476 bufs_to[0] = buf_to1;
477 bufs_to[1] = buf_to2;
478
479 if (client->mod(bufs, 1, bufs_to, 2) == false)
480 {
481 printf("update error: %s(%d)\n",
482 client->get_last_serror(), client->get_error());
483 break;
484 }
485
486 if (i > 0 && i % 10000 == 0)
487 {
488 snprintf(buf, sizeof(buf), "update, num: %d\n", i);
489 ACL_METER_TIME(buf);
490 }
491 if (i <= 10)
492 printf(">>update, num: %d, hs_id: %d, key: %s\n",
493 i, client->get_id(), buf);
494 pool.put(client);
495 }
496}
497
498int main(int argc, char *argv[])
499{

Callers

nothing calls this directly

Calls 6

modMethod · 0.80
get_last_serrorMethod · 0.80
peekMethod · 0.45
get_errorMethod · 0.45
get_idMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…