MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / process_events

Function process_events

tools/cdb2_sqlreplay/cdb2_sqlreplay.cpp:992–1025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

990};
991
992void process_events(cdb2_hndl_tp *db, event_queue &queue) {
993 std::string line;
994 int linenum = 0;
995 int64_t numevents = 0;
996
997 while (!queue.empty()) {
998 int rc;
999 linenum++;
1000 cson_value *event_val = queue.get();
1001 const char *type = get_strprop(event_val, "type");
1002 if (type != nullptr) {
1003 handle(cdb2h, type, event_val);
1004 if (had_errors) {
1005 had_errors = 0;
1006 cdb2_close(cdb2h);
1007 char *conf = getenv("CDB2_CONFIG");
1008 if (conf) {
1009 cdb2_set_comdb2db_config(conf);
1010 rc = cdb2_open(&cdb2h, dbname, "default", 0);
1011 } else {
1012 rc = cdb2_open(&cdb2h, dbname, "local", 0);
1013 }
1014 db = cdb2h;
1015 }
1016 numevents++;
1017 if (maxevents && numevents >= maxevents)
1018 break;
1019 }
1020 else
1021 cson_free_value(event_val);
1022 }
1023 if (verbose)
1024 std::cout << "got " << linenum << " lines" << std::endl;
1025}
1026
1027int main(int argc, char **argv) {
1028 char *filename = nullptr;

Callers 1

mainFunction · 0.85

Calls 8

get_strpropFunction · 0.85
handleFunction · 0.85
cdb2_closeFunction · 0.85
cdb2_set_comdb2db_configFunction · 0.85
cdb2_openFunction · 0.85
cson_free_valueFunction · 0.85
emptyMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected