Add API for get current transaction ID

This commit is contained in:
Eishun Kondoh 2018-01-31 02:31:56 +09:00
parent 7635272fbd
commit 4c517a8147
3 changed files with 20 additions and 3 deletions

View file

@ -251,6 +251,11 @@ defmodule Tres.SecureChannel do
:keep_state_and_data
end
defp handle_CONNECTED({:call, from}, :get_xid, state_data) do
xid = State.get_transaction_id(state_data.xid)
{:keep_state_and_data, [{:reply, from, {:ok, xid}}]}
end
defp handle_CONNECTED(:cast, {:send_message, message} = action, state_data) do
new_action_queue =
if XACT_KV.is_empty(state_data.xact_kv_ref) do