static int rdb_restore(lua_State *L){ TCRDB *rdb = rdb_getrdb(L, 1); const char *path = luaL_checkstring(L, 2); uint64_t tstamp = (uint64_t)luaL_checkinteger(L, 3); // x_x int opts = luaL_optint(L, 4, 0); lua_pushboolean(L, tcrdbrestore(rdb, path, tstamp, opts)); return 1; }
static VALUE mTokyoMessenger_restore(VALUE vself, VALUE vpath, VALUE vts, VALUE vopts){ uint64_t ts; int opts; TCRDB *db = mTokyoMessenger_getdb(vself); Check_Type(vpath, T_STRING); ts = (uint64_t) FIX2INT(vts); opts = FIX2INT(vopts); return tcrdbrestore(db, RSTRING_PTR(vpath), ts, opts) ? Qtrue : Qfalse; }