Skip to content

Commit

Permalink
Simplify coordinator types names
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides committed Feb 21, 2024
1 parent cee76dd commit 3bacdf0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions src/coordinator/amoc_coordinator.erl
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@

-type name() :: atom().

-type coordination_data() :: {pid(), Data :: any()}.
-type data() :: {pid(), Data :: any()}.

-type maybe_coordination_data() :: coordination_data() | undefined.
-type maybe_coordination_data() :: data() | undefined.

-type event() :: coordinator_timeout | reset_coordinator | {coordinate, {pid(), term()}}.
-type coordination_event_type() :: coordinate | timeout | stop | reset.
-type event_type() :: coordinate | timeout | stop | reset.

-type coordination_event() :: {coordination_event_type(), non_neg_integer()}.
-type coordination_event() :: {event_type(), non_neg_integer()}.

-type coordination_action() ::
fun((coordination_event(), [coordination_data()]) -> any()) |
-type action() ::
fun((coordination_event(), [data()]) -> any()) |
fun((coordination_event(), maybe_coordination_data(), maybe_coordination_data()) -> any()) |
fun((coordination_event()) -> any()).

-type coordination_actions() :: [coordination_action()] | coordination_action().
-type coordination_actions() :: [action()] | action().

-type num_of_users() :: pos_integer() | {pos_integer(), pos_integer()} | all.

-type coordination_item() :: {num_of_users(), coordination_actions()}.

-type normalized_coordination_item() :: {NoOfUsers :: pos_integer() | all,
[coordination_action()]}.
[action()]}.

-type plan() :: [coordination_item()] | coordination_item().

Expand All @@ -52,11 +52,11 @@
-export_type([name/0,
event/0,
plan/0,
event_type/0,
action/0,
data/0,
num_of_users/0,
coordination_event_type/0,
coordination_event/0,
coordination_action/0,
coordination_data/0,
normalized_coordination_item/0]).

%%%===================================================================
Expand Down
6 changes: 3 additions & 3 deletions src/coordinator/amoc_coordinator_worker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
handle_call/3,
handle_cast/2]).

-type event_type() :: amoc_coordinator:coordination_event_type().
-type event_type() :: amoc_coordinator:event_type().
-type event() :: amoc_coordinator:coordination_event().
-type action() :: amoc_coordinator:coordination_action().
-type data() :: amoc_coordinator:coordination_data().
-type action() :: amoc_coordinator:action().
-type data() :: amoc_coordinator:data().

-record(state, {configured = all :: {pos_integer(), pos_integer()} | pos_integer() | all,
required_n = all :: pos_integer() | all,
Expand Down

0 comments on commit 3bacdf0

Please sign in to comment.