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

Function dbconsumer_getargs

lua/sp.c:755–796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

753}
754
755static void dbconsumer_getargs(Lua L, dbconsumer_t *consumer)
756{
757 luaL_checktype(L, -1, LUA_TTABLE);
758 lua_pushnil(L);
759 while (lua_next(L, -2)) {
760 const char *key;
761 int type = luabb_type(L, -2);
762 if (type == DBTYPES_LSTRING || type == DBTYPES_CSTRING) {
763 key = luabb_tostring(L, -2);
764 if (strcasecmp(key, "with_tid") == 0) {
765 if (luabb_type(L, -1) == DBTYPES_LBOOLEAN) {
766 consumer->push_tid = lua_toboolean(L, -1);
767 } else {
768 luaL_error(L, "bad argument for 'with_tid'");
769 return;
770 }
771 } else if (strcasecmp(key, "with_sequence") == 0) {
772 if (luabb_type(L, -1) == DBTYPES_LBOOLEAN) {
773 consumer->push_seq = lua_toboolean(L, -1);
774 } else {
775 luaL_error(L, "bad argument for 'with_sequence'");
776 return;
777 }
778 } else if (strcasecmp(key, "with_epoch") == 0) {
779 if (luabb_type(L, -1) == DBTYPES_LBOOLEAN) {
780 consumer->push_epoch = lua_toboolean(L, -1);
781 } else {
782 luaL_error(L, "bad argument for 'with_epoch'");
783 return;
784 }
785 } else if (strcasecmp(key, "register_timeout") == 0) {
786 long long timeoutms = 0;
787 luabb_tointeger(L, -1, &timeoutms);
788 if (timeoutms > 0) {
789 consumer->register_timeoutms = timeoutms;
790 }
791 }
792 }
793 lua_pop(L, 1);
794 }
795 lua_pop(L, 1);
796}
797
798static int dbconsumer_get(Lua L)
799{

Callers 1

Calls 8

luaL_checktypeFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
luabb_typeFunction · 0.85
luabb_tostringFunction · 0.85
lua_tobooleanFunction · 0.85
luaL_errorFunction · 0.85
luabb_tointegerFunction · 0.85

Tested by

no test coverage detected