Draft: feature: picolib.once_exec
Implement a new function:
picolib.once_exec(timeout_millis, once_id, lua_code) -> Result<bool, LuaError>
Executes the following actions within the timeout:
- Checks if once_id is already registered in raft_state and returns if it is.
- "Validates" the lua code using
box.begin(); <lua_code> ; box.rollback ()
. This is supposed to catch lua syntax errors and errors related to box API like creating an already existing space. Assumes the side effects of thelua_code
can be rolled back. - Proposes a Raft entry with
lua_code
to the Raft leader. - Waits until the proposed Raft entry is committed in the cluster and the Raft
commit handler for this entry executes the
lua_code
and registers once_id in the same transaction.
Edited by Alexey Protsenko