Lines Matching refs:L

243 static int ketama_new(lua_State *L) {  in ketama_new()  argument
250 luaL_checktype(L, 1, LUA_TTABLE); in ketama_new()
253 lua_Unsigned total = lua_rawlen(L, 1); in ketama_new()
256 int argc = lua_gettop(L); in ketama_new()
258 luaL_checktype(L, 2, LUA_TTABLE); in ketama_new()
259 if (lua_getfield(L, 2, "omode") != LUA_TNIL) { in ketama_new()
260 luaL_checktype(L, -1, LUA_TSTRING); in ketama_new()
261 const char *mode = lua_tostring(L, -1); in ketama_new()
271 lua_pushstring(L, "ring_hash: bad omode argument"); in ketama_new()
272 lua_error(L); in ketama_new()
275 lua_pop(L, 1); // pops the nil or mode in ketama_new()
277 if (lua_getfield(L, 2, "obuckets") != LUA_TNIL) { in ketama_new()
279 bucket_size = lua_tointegerx(L, -1, &success); in ketama_new()
281 lua_pushstring(L, "ring_hash: option argument must be a positive integer"); in ketama_new()
282 lua_error(L); in ketama_new()
285 lua_pop(L, 1); in ketama_new()
290 ketama_t *kt = lua_newuserdatauv(L, size, 0); in ketama_new()
296 lua_pushnil(L); // start the pool iterator in ketama_new()
297 while (lua_next(L, 1) != 0) { in ketama_new()
303 lua_getfield(L, -1, "id"); in ketama_new()
304 lua_Integer id = lua_tointeger(L, -1); in ketama_new()
305 lua_pop(L, 1); in ketama_new()
308 lua_getfield(L, -1, "addr"); in ketama_new()
309 parts[0] = lua_tolstring(L, -1, &partlens[0]); in ketama_new()
310 lua_pop(L, 1); in ketama_new()
311 lua_getfield(L, -1, "port"); in ketama_new()
312 parts[1] = lua_tolstring(L, -1, &partlens[1]); in ketama_new()
313 lua_pop(L, 1); in ketama_new()
342 lua_pop(L, 1); // remove value, leave key for next iteration. in ketama_new()
353 lua_pushlightuserdata(L, &kt->phc); in ketama_new()
358 int mcplib_open_dist_ring_hash(lua_State *L) { in mcplib_open_dist_ring_hash() argument
364 luaL_newlib(L, ketama_f); in mcplib_open_dist_ring_hash()
365 lua_pushlightuserdata(L, &ketama_key_hash); in mcplib_open_dist_ring_hash()
366 lua_setfield(L, -2, "hash"); in mcplib_open_dist_ring_hash()