return 0;
}
-int Mantle::balance(std::string_view script,
- mds_rank_t whoami,
- const std::vector<std::map<std::string, double>> &metrics,
- std::map<mds_rank_t, double> &my_targets)
+int
+Mantle::balance(
+ const std::string& script,
+ mds_rank_t whoami,
+ const std::vector<std::map<std::string, double>>& metrics,
+ std::map<mds_rank_t, double>& my_targets)
{
lua_settop(L, 0); /* clear the stack */
/* load the balancer */
- if (luaL_loadstring(L, script.data())) {
+ if (luaL_loadstring(L, script.c_str())) {
mantle_dout(0) << "WARNING: mantle could not load balancer: "
<< lua_tostring(L, -1) << mantle_dendl;
return -EINVAL;
class Mantle {
public:
Mantle();
- ~Mantle() { if (L) lua_close(L); }
- int balance(std::string_view script,
- mds_rank_t whoami,
- const std::vector <std::map<std::string, double>> &metrics,
- std::map<mds_rank_t,double> &my_targets);
+ ~Mantle() { if (L) lua_close(L);
+ }
+
+ int balance(
+ const std::string& script,
+ mds_rank_t whoami,
+ const std::vector<std::map<std::string, double>>& metrics,
+ std::map<mds_rank_t, double>& my_targets);
protected:
lua_State *L;