Returns the proxy unique identifier of the server.
+.. js:function:: Server.get_rid(sv)
+
+ Returns the rid (revision ID) of the server.
+ It is an unsigned integer that is set upon server creation. Value is derived
+ from a global counter that starts at 0 and is incremented each time one or
+ multiple server deletions are followed by a server addition (meaning that
+ old name/id reuse could occur).
+
+ Combining server name/id with server rid yields a process-wide unique
+ identifier.
+
.. js:function:: Server.is_draining(sv)
Return true if the server is currently draining sticky connections.
return 1;
}
+int hlua_server_get_rid(lua_State *L)
+{
+ struct server *srv;
+ char buffer[12];
+
+ srv = hlua_check_server(L, 1);
+ if (srv == NULL) {
+ lua_pushnil(L);
+ return 1;
+ }
+
+ snprintf(buffer, sizeof(buffer), "%d", srv->rid);
+ lua_pushstring(L, buffer);
+ return 1;
+}
+
int hlua_server_get_name(lua_State *L)
{
struct server *srv;
/* set public methods */
hlua_class_function(L, "get_name", hlua_server_get_name);
hlua_class_function(L, "get_puid", hlua_server_get_puid);
+ hlua_class_function(L, "get_rid", hlua_server_get_rid);
hlua_class_function(L, "is_draining", hlua_server_is_draining);
hlua_class_function(L, "set_maxconn", hlua_server_set_maxconn);
hlua_class_function(L, "get_maxconn", hlua_server_get_maxconn);