Skip to content
This repository was archived by the owner on Sep 28, 2021. It is now read-only.

Commit 1701c8a

Browse files
authored
Merge pull request #314 from egertak/return_pid_from_enforce_once
Changes from Leapsight project
2 parents 56f7c1d + 84703a9 commit 1701c8a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/lasp_distribution_backend.erl

+3-3
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ thread(Module, Function, Args) ->
243243

244244
%% @doc Enforce a invariant once over a monotonic condition.
245245
%%
246-
-spec enforce_once(id(), threshold(), function()) -> ok.
246+
-spec enforce_once(id(), threshold(), function()) -> {ok, pid()}.
247247
enforce_once(Id, Threshold, EnforceFun) ->
248248
gen_server:call(?MODULE, {enforce_once, Id, Threshold, EnforceFun}, infinity).
249249

@@ -627,9 +627,9 @@ handle_call({enforce_once, Id, Threshold, EnforceFun},
627627
#state{store=Store}=State) ->
628628
lasp_marathon_simulations:log_message_queue_size("enforce_once"),
629629

630-
{ok, _Pid} = ?CORE:enforce_once(Id, Threshold, EnforceFun, Store),
630+
{ok, Pid} = ?CORE:enforce_once(Id, Threshold, EnforceFun, Store),
631631

632-
{reply, ok, State};
632+
{reply, {ok, Pid}, State};
633633

634634
%% Spawn a function.
635635
handle_call({thread, Module, Function, Args},

test/lasp_SUITE.erl

+6-6
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ counter_enforce_once_test(Config) ->
852852
lager:info("Adding invariant on node: ~p!", [Node]),
853853

854854
case rpc:call(Node, lasp, enforce_once, [Id, Threshold, EnforceFun]) of
855-
ok ->
855+
{ok, _Pid} ->
856856
lager:info("Invariant configured!");
857857
Error ->
858858
lager:info("Invariant can't be configured: ~p", [Error]),
@@ -913,7 +913,7 @@ counter_strict_enforce_once_test(Config) ->
913913
lager:info("Adding invariant on node: ~p!", [Node]),
914914

915915
case rpc:call(Node, lasp, enforce_once, [Id, Threshold, EnforceFun]) of
916-
ok ->
916+
{ok, _Pid} ->
917917
lager:info("Invariant configured!");
918918
Error ->
919919
lager:info("Invariant can't be configured: ~p", [Error]),
@@ -973,7 +973,7 @@ awset_enforce_once_test(Config) ->
973973
lager:info("Adding invariant on node: ~p!", [Node]),
974974

975975
case rpc:call(Node, lasp, enforce_once, [Id, Threshold, EnforceFun]) of
976-
ok ->
976+
{ok, _Pid} ->
977977
lager:info("Invariant configured!");
978978
Error ->
979979
lager:info("Invariant can't be configured: ~p", [Error]),
@@ -1027,7 +1027,7 @@ awset_strict_enforce_once_test(Config) ->
10271027
lager:info("Adding invariant on node: ~p!", [Node]),
10281028

10291029
case rpc:call(Node, lasp, enforce_once, [Id, Threshold, EnforceFun]) of
1030-
ok ->
1030+
{ok, _Pid} ->
10311031
lager:info("Invariant configured!");
10321032
Error ->
10331033
lager:info("Invariant can't be configured: ~p", [Error]),
@@ -1081,7 +1081,7 @@ orset_enforce_once_test(Config) ->
10811081
lager:info("Adding invariant on node: ~p!", [Node]),
10821082

10831083
case rpc:call(Node, lasp, enforce_once, [Id, Threshold, EnforceFun]) of
1084-
ok ->
1084+
{ok, _Pid} ->
10851085
lager:info("Invariant configured!");
10861086
Error ->
10871087
lager:info("Invariant can't be configured: ~p", [Error]),
@@ -1135,7 +1135,7 @@ orset_strict_enforce_once_test(Config) ->
11351135
lager:info("Adding invariant on node: ~p!", [Node]),
11361136

11371137
case rpc:call(Node, lasp, enforce_once, [Id, Threshold, EnforceFun]) of
1138-
ok ->
1138+
{ok, _Pid} ->
11391139
lager:info("Invariant configured!");
11401140
Error ->
11411141
lager:info("Invariant can't be configured: ~p", [Error]),

0 commit comments

Comments
 (0)