Browse Source

Add update callbacks with previous meta info.

Roberto Ostinelli 3 years ago
parent
commit
06279bdd26

+ 21 - 3
src/syn_event_handler.erl

@@ -146,6 +146,15 @@
     Reason :: atom()
 ) -> any().
 
+-callback on_registry_process_updated(
+    Scope :: atom(),
+    Name :: term(),
+    Pid :: pid(),
+    PreviousMeta :: term(),
+    Meta :: term(),
+    Reason :: atom()
+) -> any().
+
 -callback on_process_unregistered(
     Scope :: atom(),
     Name :: term(),
@@ -170,6 +179,15 @@
     Reason :: atom()
 ) -> any().
 
+-callback on_group_process_updated(
+    Scope :: atom(),
+    GroupName :: term(),
+    Pid :: pid(),
+    PreviousMeta :: term(),
+    Meta :: term(),
+    Reason :: atom()
+) -> any().
+
 -callback on_process_left(
     Scope :: atom(),
     GroupName :: term(),
@@ -185,8 +203,8 @@
     {Pid2 :: pid(), Meta2 :: term(), Time2 :: non_neg_integer()}
 ) -> PidToKeep :: pid().
 
--optional_callbacks([on_process_registered/5, on_registry_process_updated/5, on_process_unregistered/5]).
--optional_callbacks([on_process_joined/5, on_group_process_updated/5, on_process_left/5]).
+-optional_callbacks([on_process_registered/5, on_registry_process_updated/5, on_registry_process_updated/6, on_process_unregistered/5]).
+-optional_callbacks([on_process_joined/5, on_group_process_updated/5, on_group_process_updated/6, on_process_left/5]).
 -optional_callbacks([resolve_registry_conflict/4]).
 
 %% ===================================================================
@@ -208,7 +226,7 @@ ensure_event_handler_loaded() ->
 ) -> any().
 call_event_handler(CallbackMethod, Args) ->
     CustomEventHandler = get_custom_event_handler(),
-    case erlang:function_exported(CustomEventHandler, CallbackMethod, 5) of
+    case erlang:function_exported(CustomEventHandler, CallbackMethod, length(Args)) of
         true ->
             try apply(CustomEventHandler, CallbackMethod, Args)
             catch Class:Reason:Stacktrace ->

+ 14 - 9
src/syn_pg.erl

@@ -188,15 +188,16 @@ join_or_update(Scope, GroupName, Pid, MetaOrFun) ->
         _ ->
             Node = node(Pid),
             case syn_gen_scope:call(?MODULE, Node, Scope, {'3.0', join_or_update_on_node, node(), GroupName, Pid, MetaOrFun}) of
-                {ok, {CallbackMethod, Meta, Time, TableByName, TableByPid}} when Node =/= node() ->
+                {ok, {CallbackMethod, PreviousMeta, Meta, Time, TableByName, TableByPid}} when Node =/= node() ->
                     %% update table on caller node immediately so that subsequent calls have an updated pg
                     add_to_local_table(GroupName, Pid, Meta, Time, undefined, TableByName, TableByPid),
                     %% callback
                     syn_event_handler:call_event_handler(CallbackMethod, [Scope, GroupName, Pid, Meta, normal]),
+                    syn_event_handler:call_event_handler(CallbackMethod, [Scope, GroupName, Pid, PreviousMeta, Meta, normal]),
                     %% return
                     {ok, {Pid, Meta}};
 
-                {ok, {_, Meta, _, _, _}} ->
+                {ok, {_, _, Meta, _, _, _}} ->
                     {ok, {Pid, Meta}};
 
                 {noop, Meta} ->
@@ -351,7 +352,7 @@ handle_call({'3.0', join_or_update_on_node, RequesterNode, GroupName, Pid, MetaO
                         undefined -> erlang:monitor(process, Pid);  %% process is not monitored yet, create
                         MRef0 -> MRef0
                     end,
-                    do_join_on_node(GroupName, Pid, MetaOrFun, MRef, normal, RequesterNode, on_process_joined, State);
+                    do_join_on_node(GroupName, Pid, undefined, MetaOrFun, MRef, normal, RequesterNode, on_process_joined, State);
 
                 {{_, _}, TableMeta, _, MRef, _} when is_function(MetaOrFun) ->
                     %% update with fun
@@ -360,7 +361,7 @@ handle_call({'3.0', join_or_update_on_node, RequesterNode, GroupName, Pid, MetaO
                             {reply, {noop, TableMeta}, State};
 
                         Meta ->
-                            do_join_on_node(GroupName, Pid, Meta, MRef, normal, RequesterNode, on_group_process_updated, State)
+                            do_join_on_node(GroupName, Pid, TableMeta, Meta, MRef, normal, RequesterNode, on_group_process_updated, State)
 
                     catch Class:Reason:Stacktrace ->
                         error_logger:error_msg(
@@ -374,9 +375,9 @@ handle_call({'3.0', join_or_update_on_node, RequesterNode, GroupName, Pid, MetaO
                     %% re-joined with same meta
                     {reply, {noop, MetaOrFun}, State};
 
-                {{_, _}, _, _, MRef, _} ->
+                {{_, _}, TableMeta, _, MRef, _} ->
                     %% re-joined with different meta
-                    do_join_on_node(GroupName, Pid, MetaOrFun, MRef, normal, RequesterNode, on_group_process_updated, State)
+                    do_join_on_node(GroupName, Pid, TableMeta, MetaOrFun, MRef, normal, RequesterNode, on_group_process_updated, State)
             end;
 
         false ->
@@ -541,6 +542,7 @@ do_rebuild_monitors([{GroupName, Pid, Meta, Time} | T], NewMRefs, Scope, TableBy
 -spec do_join_on_node(
     GroupName :: term(),
     Pid :: pid(),
+    PreviousMeta :: term(),
     Meta :: term(),
     MRef :: reference() | undefined,
     Reason :: term(),
@@ -552,6 +554,7 @@ do_rebuild_monitors([{GroupName, Pid, Meta, Time} | T], NewMRefs, Scope, TableBy
         reply,
         {ok, {
             CallbackMethod :: atom(),
+            PreviousMeta :: term(),
             Meta :: term(),
             Time :: non_neg_integer(),
             TableByName :: atom(),
@@ -559,7 +562,7 @@ do_rebuild_monitors([{GroupName, Pid, Meta, Time} | T], NewMRefs, Scope, TableBy
         }},
         #state{}
     }.
-do_join_on_node(GroupName, Pid, Meta, MRef, Reason, RequesterNode, CallbackMethod, #state{
+do_join_on_node(GroupName, Pid, PreviousMeta, Meta, MRef, Reason, RequesterNode, CallbackMethod, #state{
     scope = Scope,
     table_by_name = TableByName,
     table_by_pid = TableByPid
@@ -569,10 +572,11 @@ do_join_on_node(GroupName, Pid, Meta, MRef, Reason, RequesterNode, CallbackMetho
     add_to_local_table(GroupName, Pid, Meta, Time, MRef, TableByName, TableByPid),
     %% callback
     syn_event_handler:call_event_handler(CallbackMethod, [Scope, GroupName, Pid, Meta, Reason]),
+    syn_event_handler:call_event_handler(CallbackMethod, [Scope, GroupName, Pid, PreviousMeta, Meta, normal]),
     %% broadcast
     syn_gen_scope:broadcast({'3.0', sync_join, GroupName, Pid, Meta, Time, Reason}, [RequesterNode], State),
     %% return
-    {reply, {ok, {CallbackMethod, Meta, Time, TableByName, TableByPid}}, State}.
+    {reply, {ok, {CallbackMethod, PreviousMeta, Meta, Time, TableByName, TableByPid}}, State}.
 
 -spec get_pg_tuples_for_node(Node :: node(), TableByName :: atom()) -> [syn_pg_tuple()].
 get_pg_tuples_for_node(Node, TableByName) ->
@@ -705,7 +709,8 @@ handle_pg_sync(GroupName, Pid, Meta, Time, Reason, #state{
             %% callback (call only if meta update)
             case TableMeta =/= Meta of
                 true ->
-                    syn_event_handler:call_event_handler(on_group_process_updated, [Scope, GroupName, Pid, Meta, Reason]);
+                    syn_event_handler:call_event_handler(on_group_process_updated, [Scope, GroupName, Pid, Meta, Reason]),
+                    syn_event_handler:call_event_handler(on_group_process_updated, [Scope, GroupName, Pid, TableMeta, Meta, Reason]);
                 _ -> ok
             end;
 

+ 14 - 9
src/syn_registry.erl

@@ -117,15 +117,16 @@ register_or_update(Scope, Name, Pid, MetaOrFun) ->
         _ ->
             Node = node(Pid),
             case syn_gen_scope:call(?MODULE, Node, Scope, {'3.0', register_or_update_on_node, node(), Name, Pid, MetaOrFun}) of
-                {ok, {CallbackMethod, Meta, Time, TableByName, TableByPid}} when Node =/= node() ->
+                {ok, {CallbackMethod, PreviousMeta, Meta, Time, TableByName, TableByPid}} when Node =/= node() ->
                     %% update table on caller node immediately so that subsequent calls have an updated registry
                     add_to_local_table(Name, Pid, Meta, Time, undefined, TableByName, TableByPid),
                     %% callback
                     syn_event_handler:call_event_handler(CallbackMethod, [Scope, Name, Pid, Meta, normal]),
+                    syn_event_handler:call_event_handler(CallbackMethod, [Scope, Name, Pid, PreviousMeta, Meta, normal]),
                     %% return
                     {ok, {Pid, Meta}};
 
-                {ok, {_, Meta, _, _, _}} ->
+                {ok, {_, _, Meta, _, _, _}} ->
                     {ok, {Pid, Meta}};
 
                 {noop, Meta} ->
@@ -239,7 +240,7 @@ handle_call({'3.0', register_or_update_on_node, RequesterNode, Name, Pid, MetaOr
                         undefined -> erlang:monitor(process, Pid);  %% process is not monitored yet, add
                         MRef0 -> MRef0
                     end,
-                    do_register_on_node(Name, Pid, MetaOrFun, MRef, normal, RequesterNode, on_process_registered, State);
+                    do_register_on_node(Name, Pid, undefined, MetaOrFun, MRef, normal, RequesterNode, on_process_registered, State);
 
                 {Name, Pid, TableMeta, _, MRef, _} when is_function(MetaOrFun) ->
                     %% update with fun
@@ -248,7 +249,7 @@ handle_call({'3.0', register_or_update_on_node, RequesterNode, Name, Pid, MetaOr
                             {reply, {noop, TableMeta}, State};
 
                         Meta ->
-                            do_register_on_node(Name, Pid, Meta, MRef, normal, RequesterNode, on_registry_process_updated, State)
+                            do_register_on_node(Name, Pid, TableMeta, Meta, MRef, normal, RequesterNode, on_registry_process_updated, State)
 
                     catch Class:Reason:Stacktrace ->
                         error_logger:error_msg(
@@ -262,9 +263,9 @@ handle_call({'3.0', register_or_update_on_node, RequesterNode, Name, Pid, MetaOr
                     %% same pid, same meta
                     {reply, {noop, MetaOrFun}, State};
 
-                {Name, Pid, _, _, MRef, _} ->
+                {Name, Pid, TableMeta, _, MRef, _} ->
                     %% same pid, different meta
-                    do_register_on_node(Name, Pid, MetaOrFun, MRef, normal, RequesterNode, on_registry_process_updated, State);
+                    do_register_on_node(Name, Pid, TableMeta, MetaOrFun, MRef, normal, RequesterNode, on_registry_process_updated, State);
 
                 _ ->
                     {reply, {error, taken}, State}
@@ -435,6 +436,7 @@ do_rebuild_monitors([{Name, Pid, Meta, Time} | T], NewMRefs, Scope, TableByName,
 -spec do_register_on_node(
     Name :: term(),
     Pid :: pid(),
+    PreviousMeta :: term(),
     Meta :: term(),
     MRef :: reference() | undefined,
     Reason :: term(),
@@ -446,6 +448,7 @@ do_rebuild_monitors([{Name, Pid, Meta, Time} | T], NewMRefs, Scope, TableByName,
         reply,
         {ok, {
             CallbackMethod :: atom(),
+            PreviousMeta :: term(),
             Meta :: term(),
             Time :: non_neg_integer(),
             TableByName :: atom(),
@@ -453,7 +456,7 @@ do_rebuild_monitors([{Name, Pid, Meta, Time} | T], NewMRefs, Scope, TableByName,
         }},
         #state{}
     }.
-do_register_on_node(Name, Pid, Meta, MRef, Reason, RequesterNode, CallbackMethod, #state{
+do_register_on_node(Name, Pid, PreviousMeta, Meta, MRef, Reason, RequesterNode, CallbackMethod, #state{
     scope = Scope,
     table_by_name = TableByName,
     table_by_pid = TableByPid
@@ -463,10 +466,11 @@ do_register_on_node(Name, Pid, Meta, MRef, Reason, RequesterNode, CallbackMethod
     add_to_local_table(Name, Pid, Meta, Time, MRef, TableByName, TableByPid),
     %% callback
     syn_event_handler:call_event_handler(CallbackMethod, [Scope, Name, Pid, Meta, Reason]),
+    syn_event_handler:call_event_handler(CallbackMethod, [Scope, Name, Pid, PreviousMeta, Meta, normal]),
     %% broadcast
     syn_gen_scope:broadcast({'3.0', sync_register, Name, Pid, Meta, Time, Reason}, [RequesterNode], State),
     %% return
-    {reply, {ok, {CallbackMethod, Meta, Time, TableByName, TableByPid}}, State}.
+    {reply, {ok, {CallbackMethod, PreviousMeta, Meta, Time, TableByName, TableByPid}}, State}.
 
 -spec get_registry_tuples_for_node(Node :: node(), TableByName :: atom()) -> [syn_registry_tuple()].
 get_registry_tuples_for_node(Node, TableByName) ->
@@ -616,7 +620,8 @@ handle_registry_sync(Name, Pid, Meta, Time, Reason, #state{
             %% callback (call only if meta update)
             case TableMeta =/= Meta of
                 true ->
-                    syn_event_handler:call_event_handler(on_registry_process_updated, [Scope, Name, Pid, Meta, Reason]);
+                    syn_event_handler:call_event_handler(on_registry_process_updated, [Scope, Name, Pid, Meta, Reason]),
+                    syn_event_handler:call_event_handler(on_registry_process_updated, [Scope, Name, Pid, TableMeta, Meta, Reason]);
                 _ -> ok
             end;
 

+ 16 - 4
test/syn_pg_SUITE.erl

@@ -1207,7 +1207,10 @@ three_nodes_custom_event_handler_joined_left(Config) ->
     syn_test_suite_helper:assert_received_messages([
         {on_group_process_updated, LocalNode, scope_all, "my-group", Pid, <<"new-meta-0">>, normal},
         {on_group_process_updated, SlaveNode1, scope_all, "my-group", Pid, <<"new-meta-0">>, normal},
-        {on_group_process_updated, SlaveNode2, scope_all, "my-group", Pid, <<"new-meta-0">>, normal}
+        {on_group_process_updated, SlaveNode2, scope_all, "my-group", Pid, <<"new-meta-0">>, normal},
+        {on_group_process_updated, LocalNode, scope_all, "my-group", Pid, <<"meta">>, <<"new-meta-0">>, normal},
+        {on_group_process_updated, SlaveNode1, scope_all, "my-group", Pid, <<"meta">>, <<"new-meta-0">>, normal},
+        {on_group_process_updated, SlaveNode2, scope_all, "my-group", Pid, <<"meta">>, <<"new-meta-0">>, normal}
     ]),
 
     %% update meta from another node
@@ -1217,7 +1220,10 @@ three_nodes_custom_event_handler_joined_left(Config) ->
     syn_test_suite_helper:assert_received_messages([
         {on_group_process_updated, LocalNode, scope_all, "my-group", Pid, <<"new-meta">>, normal},
         {on_group_process_updated, SlaveNode1, scope_all, "my-group", Pid, <<"new-meta">>, normal},
-        {on_group_process_updated, SlaveNode2, scope_all, "my-group", Pid, <<"new-meta">>, normal}
+        {on_group_process_updated, SlaveNode2, scope_all, "my-group", Pid, <<"new-meta">>, normal},
+        {on_group_process_updated, LocalNode, scope_all, "my-group", Pid, <<"new-meta-0">>, <<"new-meta">>, normal},
+        {on_group_process_updated, SlaveNode1, scope_all, "my-group", Pid, <<"new-meta-0">>, <<"new-meta">>, normal},
+        {on_group_process_updated, SlaveNode2, scope_all, "my-group", Pid, <<"new-meta-0">>, <<"new-meta">>, normal}
     ]),
 
     %% ---> on left
@@ -1769,7 +1775,10 @@ three_nodes_member_and_update(Config) ->
     syn_test_suite_helper:assert_received_messages([
         {on_group_process_updated, LocalNode, scope_all, "my-group", Pid, 20, normal},
         {on_group_process_updated, SlaveNode1, scope_all, "my-group", Pid, 20, normal},
-        {on_group_process_updated, SlaveNode2, scope_all, "my-group", Pid, 20, normal}
+        {on_group_process_updated, SlaveNode2, scope_all, "my-group", Pid, 20, normal},
+        {on_group_process_updated, LocalNode, scope_all, "my-group", Pid, 10, 20, normal},
+        {on_group_process_updated, SlaveNode1, scope_all, "my-group", Pid, 10, 20, normal},
+        {on_group_process_updated, SlaveNode2, scope_all, "my-group", Pid, 10, 20, normal}
     ]),
 
     %% update with same data
@@ -1828,7 +1837,10 @@ three_nodes_member_and_update(Config) ->
     syn_test_suite_helper:assert_received_messages([
         {on_group_process_updated, LocalNode, scope_all, "my-group", PidOn1, 1001, normal},
         {on_group_process_updated, SlaveNode1, scope_all, "my-group", PidOn1, 1001, normal},
-        {on_group_process_updated, SlaveNode2, scope_all, "my-group", PidOn1, 1001, normal}
+        {on_group_process_updated, SlaveNode2, scope_all, "my-group", PidOn1, 1001, normal},
+        {on_group_process_updated, LocalNode, scope_all, "my-group", PidOn1, 1000, 1001, normal},
+        {on_group_process_updated, SlaveNode1, scope_all, "my-group", PidOn1, 1000, 1001, normal},
+        {on_group_process_updated, SlaveNode2, scope_all, "my-group", PidOn1, 1000, 1001, normal}
     ]).
 
 four_nodes_concurrency(Config) ->

+ 16 - 4
test/syn_registry_SUITE.erl

@@ -1042,7 +1042,10 @@ three_nodes_custom_event_handler_reg_unreg(Config) ->
     syn_test_suite_helper:assert_received_messages([
         {on_registry_process_updated, LocalNode, scope_all, "proc-handler", Pid, <<"new-meta">>, normal},
         {on_registry_process_updated, SlaveNode1, scope_all, "proc-handler", Pid, <<"new-meta">>, normal},
-        {on_registry_process_updated, SlaveNode2, scope_all, "proc-handler", Pid, <<"new-meta">>, normal}
+        {on_registry_process_updated, SlaveNode2, scope_all, "proc-handler", Pid, <<"new-meta">>, normal},
+        {on_registry_process_updated, LocalNode, scope_all, "proc-handler", Pid, <<"meta">>, <<"new-meta">>, normal},
+        {on_registry_process_updated, SlaveNode1, scope_all, "proc-handler", Pid, <<"meta">>, <<"new-meta">>, normal},
+        {on_registry_process_updated, SlaveNode2, scope_all, "proc-handler", Pid, <<"meta">>, <<"new-meta">>, normal}
     ]),
 
     %% meta update from another node
@@ -1052,7 +1055,10 @@ three_nodes_custom_event_handler_reg_unreg(Config) ->
     syn_test_suite_helper:assert_received_messages([
         {on_registry_process_updated, LocalNode, scope_all, "proc-handler-2", Pid2, <<"meta-for-2-update">>, normal},
         {on_registry_process_updated, SlaveNode1, scope_all, "proc-handler-2", Pid2, <<"meta-for-2-update">>, normal},
-        {on_registry_process_updated, SlaveNode2, scope_all, "proc-handler-2", Pid2, <<"meta-for-2-update">>, normal}
+        {on_registry_process_updated, SlaveNode2, scope_all, "proc-handler-2", Pid2, <<"meta-for-2-update">>, normal},
+        {on_registry_process_updated, LocalNode, scope_all, "proc-handler-2", Pid2, <<"meta-for-2">>, <<"meta-for-2-update">>, normal},
+        {on_registry_process_updated, SlaveNode1, scope_all, "proc-handler-2", Pid2, <<"meta-for-2">>, <<"meta-for-2-update">>, normal},
+        {on_registry_process_updated, SlaveNode2, scope_all, "proc-handler-2", Pid2, <<"meta-for-2">>, <<"meta-for-2-update">>, normal}
     ]),
 
     %% ---> on unregister
@@ -1582,7 +1588,10 @@ three_nodes_update(Config) ->
     syn_test_suite_helper:assert_received_messages([
         {on_registry_process_updated, LocalNode, scope_all, "my-proc", Pid, 20, normal},
         {on_registry_process_updated, SlaveNode1, scope_all, "my-proc", Pid, 20, normal},
-        {on_registry_process_updated, SlaveNode2, scope_all, "my-proc", Pid, 20, normal}
+        {on_registry_process_updated, SlaveNode2, scope_all, "my-proc", Pid, 20, normal},
+        {on_registry_process_updated, LocalNode, scope_all, "my-proc", Pid, 10, 20, normal},
+        {on_registry_process_updated, SlaveNode1, scope_all, "my-proc", Pid, 10, 20, normal},
+        {on_registry_process_updated, SlaveNode2, scope_all, "my-proc", Pid, 10, 20, normal}
     ]),
 
     %% update with same data
@@ -1642,7 +1651,10 @@ three_nodes_update(Config) ->
     syn_test_suite_helper:assert_received_messages([
         {on_registry_process_updated, LocalNode, scope_all, "my-proc-on-1", PidOn1, 1001, normal},
         {on_registry_process_updated, SlaveNode1, scope_all, "my-proc-on-1", PidOn1, 1001, normal},
-        {on_registry_process_updated, SlaveNode2, scope_all, "my-proc-on-1", PidOn1, 1001, normal}
+        {on_registry_process_updated, SlaveNode2, scope_all, "my-proc-on-1", PidOn1, 1001, normal},
+        {on_registry_process_updated, LocalNode, scope_all, "my-proc-on-1", PidOn1, 1000, 1001, normal},
+        {on_registry_process_updated, SlaveNode1, scope_all, "my-proc-on-1", PidOn1, 1000, 1001, normal},
+        {on_registry_process_updated, SlaveNode2, scope_all, "my-proc-on-1", PidOn1, 1000, 1001, normal}
     ]).
 
 four_nodes_concurrency(Config) ->

+ 22 - 0
test/syn_test_event_handler_callbacks.erl

@@ -29,9 +29,11 @@
 -export([on_process_registered/5]).
 -export([on_process_unregistered/5]).
 -export([on_registry_process_updated/5]).
+-export([on_registry_process_updated/6]).
 -export([on_process_joined/5]).
 -export([on_process_left/5]).
 -export([on_group_process_updated/5]).
+-export([on_group_process_updated/6]).
 
 on_process_registered(Scope, Name, Pid, {recipient, RecipientPid, AdditionalMeta}, Reason) ->
     RecipientPid ! {on_process_registered, node(), Scope, Name, Pid, AdditionalMeta, Reason}.
@@ -42,6 +44,16 @@ on_process_unregistered(Scope, Name, Pid, {recipient, RecipientPid, AdditionalMe
 on_registry_process_updated(Scope, Name, Pid, {recipient, RecipientPid, AdditionalMeta}, Reason) ->
     RecipientPid ! {on_registry_process_updated, node(), Scope, Name, Pid, AdditionalMeta, Reason}.
 
+on_registry_process_updated(
+    Scope,
+    Name,
+    Pid,
+    {recipient, RecipientPid, PreviousAdditionalMeta},
+    {recipient, RecipientPid, AdditionalMeta},
+    Reason
+) ->
+    RecipientPid ! {on_registry_process_updated, node(), Scope, Name, Pid, PreviousAdditionalMeta, AdditionalMeta, Reason}.
+
 on_process_joined(Scope, GroupName, Pid, {recipient, RecipientPid, AdditionalMeta}, Reason) ->
     RecipientPid ! {on_process_joined, node(), Scope, GroupName, Pid, AdditionalMeta, Reason}.
 
@@ -50,3 +62,13 @@ on_process_left(Scope, GroupName, Pid, {recipient, RecipientPid, AdditionalMeta}
 
 on_group_process_updated(Scope, GroupName, Pid, {recipient, RecipientPid, AdditionalMeta}, Reason) ->
     RecipientPid ! {on_group_process_updated, node(), Scope, GroupName, Pid, AdditionalMeta, Reason}.
+
+on_group_process_updated(
+    Scope,
+    GroupName,
+    Pid,
+    {recipient, RecipientPid, PreviousAdditionalMeta},
+    {recipient, RecipientPid, AdditionalMeta},
+    Reason
+) ->
+    RecipientPid ! {on_group_process_updated, node(), Scope, GroupName, Pid, PreviousAdditionalMeta, AdditionalMeta, Reason}.