From 3bacdf098ab46306164b86d507ec19445a678662 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 21 Feb 2024 23:33:33 +0100 Subject: [PATCH] Simplify coordinator types names --- src/coordinator/amoc_coordinator.erl | 22 ++++++++++----------- src/coordinator/amoc_coordinator_worker.erl | 6 +++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/coordinator/amoc_coordinator.erl b/src/coordinator/amoc_coordinator.erl index 2aa53eb2..d6618d7c 100644 --- a/src/coordinator/amoc_coordinator.erl +++ b/src/coordinator/amoc_coordinator.erl @@ -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(). @@ -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]). %%%=================================================================== diff --git a/src/coordinator/amoc_coordinator_worker.erl b/src/coordinator/amoc_coordinator_worker.erl index 6080bb81..04af0c3d 100644 --- a/src/coordinator/amoc_coordinator_worker.erl +++ b/src/coordinator/amoc_coordinator_worker.erl @@ -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,