summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Davis <mcarsondavis@gmail.com>2023-02-28 14:58:09 -0600
committerDiana Parra Corbacho <dparracorbac@vmware.com>2023-05-12 11:31:16 +0200
commit117aa475ec69bd5a3ff520b386649a3a49b0a994 (patch)
treebb6f7cbe1128d44ad688027d121a1c188e5bade5
parent08c05f0d3d3f51311a42021adc46a72ca403f8a7 (diff)
downloadrabbitmq-server-git-117aa475ec69bd5a3ff520b386649a3a49b0a994.tar.gz
Fix dialyzer error for amqqueue ETS match patterns
-rw-r--r--deps/rabbit/src/amqqueue.erl106
1 files changed, 58 insertions, 48 deletions
diff --git a/deps/rabbit/src/amqqueue.erl b/deps/rabbit/src/amqqueue.erl
index e5bb5f4ff1..ede22b3051 100644
--- a/deps/rabbit/src/amqqueue.erl
+++ b/deps/rabbit/src/amqqueue.erl
@@ -88,33 +88,41 @@
(T =:= classic orelse T =:= ?amqqueue_v1_type)).
-record(amqqueue, {
- name :: rabbit_amqqueue:name() | '_', %% immutable
- durable :: boolean() | '_', %% immutable
- auto_delete :: boolean() | '_', %% immutable
- exclusive_owner = none :: pid() | none | '_', %% immutable
- arguments = [] :: rabbit_framing:amqp_table() | '_', %% immutable
- pid :: pid() | ra_server_id() | none | '_', %% durable (just so we
- %% know home node)
- slave_pids = [] :: [pid()] | none | '_', %% transient
- sync_slave_pids = [] :: [pid()] | none| '_',%% transient
- recoverable_slaves = [] :: [atom()] | none | '_', %% durable
- policy :: proplists:proplist() |
- none | undefined | '_', %% durable, implicit update as
- %% above
- operator_policy :: proplists:proplist() |
- none | undefined | '_', %% durable, implicit
- %% update as above
- gm_pids = [] :: [{pid(), pid()}] | none | '_', %% transient
- decorators :: [atom()] | none | undefined | '_', %% transient,
- %% recalculated
- %% as above
- state = live :: atom() | none | '_', %% durable (have we crashed?)
- policy_version = 0 :: non_neg_integer() | '_',
- slave_pids_pending_shutdown = [] :: [pid()] | '_',
- vhost :: rabbit_types:vhost() | undefined | '_', %% secondary index
- options = #{} :: map() | '_',
- type = ?amqqueue_v1_type :: module() | '_',
- type_state = #{} :: map() | '_'
+ %% immutable
+ name :: rabbit_amqqueue:name() | ets:match_pattern(),
+ %% immutable
+ durable :: boolean() | ets:match_pattern(),
+ %% immutable
+ auto_delete :: boolean() | ets:match_pattern(),
+ %% immutable
+ exclusive_owner = none :: pid() | none | ets:match_pattern(),
+ %% immutable
+ arguments = [] :: rabbit_framing:amqp_table() | ets:match_pattern(),
+ %% durable (just so we know home node)
+ pid :: pid() | ra_server_id() | none | ets:match_pattern(),
+ %% transient
+ slave_pids = [] :: [pid()] | none | ets:match_pattern(),
+ %% transient
+ sync_slave_pids = [] :: [pid()] | none| ets:match_pattern(),
+ %% durable
+ recoverable_slaves = [] :: [atom()] | none | ets:match_pattern(),
+ %% durable, implicit update as above
+ policy :: binary() | none | undefined | ets:match_pattern(),
+ %% durable, implicit update as above
+ operator_policy :: binary() | none | undefined | ets:match_pattern(),
+ %% transient
+ gm_pids = [] :: [{pid(), pid()}] | none | ets:match_pattern(),
+ %% transient, recalculated as above
+ decorators :: [atom()] | none | undefined | ets:match_pattern(),
+ %% durable (have we crashed?)
+ state = live :: atom() | none | ets:match_pattern(),
+ policy_version = 0 :: non_neg_integer() | ets:match_pattern(),
+ slave_pids_pending_shutdown = [] :: [pid()] | ets:match_pattern(),
+ %% secondary index
+ vhost :: rabbit_types:vhost() | undefined | ets:match_pattern(),
+ options = #{} :: map() | ets:match_pattern(),
+ type = ?amqqueue_v1_type :: module() | ets:match_pattern(),
+ type_state = #{} :: map() | ets:match_pattern()
}).
-type amqqueue() :: amqqueue_v2().
@@ -146,26 +154,26 @@
-type amqqueue_pattern() :: amqqueue_v2_pattern().
-type amqqueue_v2_pattern() :: #amqqueue{
- name :: rabbit_amqqueue:name() | '_',
- durable :: '_',
- auto_delete :: '_',
- exclusive_owner :: '_',
- arguments :: '_',
- pid :: '_',
- slave_pids :: '_',
- sync_slave_pids :: '_',
- recoverable_slaves :: '_',
- policy :: '_',
- operator_policy :: '_',
- gm_pids :: '_',
- decorators :: '_',
- state :: '_',
- policy_version :: '_',
- slave_pids_pending_shutdown :: '_',
- vhost :: '_',
- options :: '_',
- type :: atom() | '_',
- type_state :: '_'
+ name :: rabbit_amqqueue:name() | ets:match_pattern(),
+ durable :: ets:match_pattern(),
+ auto_delete :: ets:match_pattern(),
+ exclusive_owner :: ets:match_pattern(),
+ arguments :: ets:match_pattern(),
+ pid :: ets:match_pattern(),
+ slave_pids :: ets:match_pattern(),
+ sync_slave_pids :: ets:match_pattern(),
+ recoverable_slaves :: ets:match_pattern(),
+ policy :: ets:match_pattern(),
+ operator_policy :: ets:match_pattern(),
+ gm_pids :: ets:match_pattern(),
+ decorators :: ets:match_pattern(),
+ state :: ets:match_pattern(),
+ policy_version :: ets:match_pattern(),
+ slave_pids_pending_shutdown :: ets:match_pattern(),
+ vhost :: ets:match_pattern(),
+ options :: ets:match_pattern(),
+ type :: atom() | ets:match_pattern(),
+ type_state :: ets:match_pattern()
}.
-export_type([amqqueue/0,
@@ -570,7 +578,9 @@ field_vhost() ->
pattern_match_all() ->
#amqqueue{_ = '_'}.
--spec pattern_match_on_name(rabbit_amqqueue:name()) -> amqqueue_pattern().
+-spec pattern_match_on_name(Name) -> Pattern when
+ Name :: rabbit_amqqueue:name() | ets:match_pattern(),
+ Pattern :: amqqueue_pattern().
pattern_match_on_name(Name) ->
#amqqueue{name = Name, _ = '_'}.