From f6c7b25c981fbdff369752d0e6756b911608b421 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 3 Dec 2024 16:31:43 -0500 Subject: [PATCH] khepri_tx_adv: Allow calls to `khepri_path` in transactions Transactions might use functions like `khepri_path:combine_with_conditions/2` to modify a path from the env with extra conditions like checking the version. `khepri_path` functions are all pure - with the exception of `compile/1`, but compiling regexes within a transaction for example should be harmless - so we should allow these within transactions. --- src/khepri_tx_adv.erl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/khepri_tx_adv.erl b/src/khepri_tx_adv.erl index 730257b2..ccd4c050 100644 --- a/src/khepri_tx_adv.erl +++ b/src/khepri_tx_adv.erl @@ -707,6 +707,20 @@ ensure_bif_is_valid(Bif, Arity) -> is_remote_call_valid(khepri_payload, no_payload, 0) -> true; is_remote_call_valid(khepri_payload, data, 1) -> true; +is_remote_call_valid(khepri_path, compile, _) -> true; +is_remote_call_valid(khepri_path, from_string, _) -> true; +is_remote_call_valid(khepri_path, from_binary, _) -> true; +is_remote_call_valid(khepri_path, to_string, _) -> true; +is_remote_call_valid(khepri_path, to_binary, _) -> true; +is_remote_call_valid(khepri_path, combine_with_conditions, _) -> true; +is_remote_call_valid(khepri_path, targets_specific_node, _) -> true; +is_remote_call_valid(khepri_path, component_targets_specific_node, _) -> true; +is_remote_call_valid(khepri_path, is_valid, _) -> true; +is_remote_call_valid(khepri_path, ensure_is_valid, _) -> true; +is_remote_call_valid(khepri_path, abspath, _) -> true; +is_remote_call_valid(khepri_path, realpath, _) -> true; +is_remote_call_valid(khepri_path, pattern_includes_root_node, _) -> true; + is_remote_call_valid(khepri_tx, is_empty, _) -> true; is_remote_call_valid(khepri_tx, get, _) -> true; is_remote_call_valid(khepri_tx, get_or, _) -> true;