g_lua.registerFunction("isUp", &DownstreamState::isUp);
g_lua.registerFunction("setDown", &DownstreamState::setDown);
g_lua.registerFunction("setUp", &DownstreamState::setUp);
- g_lua.registerFunction("setAuto", &DownstreamState::setAuto);
+ g_lua.registerFunction<void(DownstreamState::*)(boost::optional<bool> newStatus)>("setAuto", [](DownstreamState& s, boost::optional<bool> newStatus) {
+ if (newStatus) {
+ s.upStatus = *newStatus;
+ }
+ s.setAuto();
+ });
+
g_lua.registerFunction("getName", &DownstreamState::getName);
g_lua.registerFunction("getNameWithAddr", &DownstreamState::getNameWithAddr);
g_lua.registerMember("upStatus", &DownstreamState::upStatus);
:param str pool: The pool to remove the server from
-.. classmethod:: Server:setAuto()
+.. classmethod:: Server:setAuto([status])
+
+.. versionchanged:: 1.3.0
+ ``status`` optional parameter added.
Set the server in the default auto state.
- This will enable health check queries that will set the server ``up`` and ``down`` appropriatly.
+ This will enable health check queries that will set the server ``up`` and ``down`` appropriately.
+
+ :param bool status: Set the initial status of the server to ``up`` (true) or ``down`` (false) instead of using the last known status
.. classmethod:: Server:setQPS(limit)