_site/cover/msc_mm_sync.COVER.html

1 %% Copyright (c) 2023 Peter Morgan <peter.james.morgan@gmail.com>
2 %%
3 %% Licensed under the Apache License, Version 2.0 (the "License");
4 %% you may not use this file except in compliance with the License.
5 %% You may obtain a copy of the License at
6 %%
7 %% http://www.apache.org/licenses/LICENSE-2.0
8 %%
9 %% Unless required by applicable law or agreed to in writing, software
10 %% distributed under the License is distributed on an "AS IS" BASIS,
11 %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 %% See the License for the specific language governing permissions and
13 %% limitations under the License.
14
15
16 %% @doc Synchronous middleman.
17
18 -module(msc_mm_sync).
19
20
21 -export([binlog_dump/1]).
22 -export([execute/1]).
23 -export([operator/1]).
24 -export([prepare/1]).
25 -export([query/1]).
26 -export([register_replica/1]).
27 -export([stmt_close/1]).
28 -export([stmt_reset/1]).
29
30
31 binlog_dump(Arg) ->
32
:-(
receive_response(?FUNCTION_NAME, Arg).
33
34
35 execute(Arg) ->
36 2 receive_response(?FUNCTION_NAME, Arg).
37
38
39 operator(Arg) ->
40
:-(
receive_response(?FUNCTION_NAME, Arg).
41
42
43 prepare(Arg) ->
44 2 receive_response(?FUNCTION_NAME, Arg).
45
46
47 query(Arg) ->
48 3 receive_response(?FUNCTION_NAME, Arg).
49
50
51 register_replica(Arg) ->
52
:-(
receive_response(?FUNCTION_NAME, Arg).
53
54
55 stmt_close(Arg) ->
56 2 receive_response(?FUNCTION_NAME, Arg).
57
58
59 stmt_reset(Arg) ->
60
:-(
receive_response(?FUNCTION_NAME, Arg).
61
62
63 receive_response(Function, Arg) ->
64 9 case gen_statem:receive_response(msc_mm:Function(Arg)) of
65 {reply, Reply} ->
66 9 Reply;
67
68 {error, _} = Error ->
69
:-(
Error
70 end.
Line Hits Source