Skip to content
Snippets Groups Projects
Commit c990c16f authored by Georgy Moshkin's avatar Georgy Moshkin :speech_balloon: Committed by Georgy Moshkin
Browse files

feat: revise raft_propose_eval args

parent 815440be
No related branches found
No related tags found
1 merge request!194feat: revise raft_propose_eval args
Pipeline #9410 passed
......@@ -81,14 +81,21 @@ fn picolib_setup(args: &args::Run) {
Ok(())
}),
);
#[derive(::tarantool::tlua::LuaRead)]
struct ProposeEvalOpts {
timeout: Option<f64>,
}
luamod.set(
"raft_propose_eval",
tlua::function2(|timeout: f64, x: String| -> Result<(), Error> {
traft::node::global()?.propose(
traft::Op::EvalLua { code: x },
Duration::from_secs_f64(timeout),
)
}),
tlua::function2(
|x: String, opts: Option<ProposeEvalOpts>| -> Result<(), Error> {
let timeout = opts.and_then(|opts| opts.timeout).unwrap_or(10.0);
traft::node::global()?.propose(
traft::Op::EvalLua { code: x },
Duration::from_secs_f64(timeout),
)
},
),
);
luamod.set(
"raft_return_one",
......
......@@ -326,8 +326,8 @@ class Instance:
def raft_propose_eval(self, lua_code: str, timeout_seconds=2):
return self.call(
"picolib.raft_propose_eval",
timeout_seconds,
lua_code,
dict(timeout=timeout_seconds),
)
def assert_raft_status(self, state, leader_id=None):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment