summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2016-06-28 15:26:41 +0200
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2016-06-28 16:02:00 +0200
commitfa20bbcc482e3bd09678351191ee9a296113b3dc (patch)
tree48f231deb1eb3d8a1396cf12c21821942b464382 /src
parentd27a16388d28e753120f30b047ab64077abb9f88 (diff)
downloadrabbitmq-server-git-fa20bbcc482e3bd09678351191ee9a296113b3dc.tar.gz
Use the new -spec format
The old format is removed in Erlang 19.0, leading to build errors. Also, get rid of the `use_specs` macro and thus always define -spec() & friends. While here, unnify the style of -type and -spec. References #860. [#118562897] [#122335241]
Diffstat (limited to 'src')
-rw-r--r--src/background_gc.erl10
-rw-r--r--src/delegate.erl30
-rw-r--r--src/delegate_sup.erl8
-rw-r--r--src/dtree.erl38
-rw-r--r--src/file_handle_cache.erl87
-rw-r--r--src/gatherer.erl18
-rw-r--r--src/gm.erl37
-rw-r--r--src/lqueue.erl40
-rw-r--r--src/mnesia_sync.erl6
-rw-r--r--src/pg_local.erl20
-rw-r--r--src/rabbit.erl82
-rw-r--r--src/rabbit_access_control.erl43
-rw-r--r--src/rabbit_alarm.erl36
-rw-r--r--src/rabbit_amqqueue_process.erl11
-rw-r--r--src/rabbit_amqqueue_sup.erl8
-rw-r--r--src/rabbit_amqqueue_sup_sup.erl11
-rw-r--r--src/rabbit_binding.erl103
-rw-r--r--src/rabbit_channel_sup.erl10
-rw-r--r--src/rabbit_channel_sup_sup.erl10
-rw-r--r--src/rabbit_cli.erl47
-rw-r--r--src/rabbit_client_sup.erl17
-rw-r--r--src/rabbit_connection_helper_sup.erl11
-rw-r--r--src/rabbit_connection_sup.erl9
-rw-r--r--src/rabbit_control_main.erl20
-rw-r--r--src/rabbit_dead_letter.erl4
-rw-r--r--src/rabbit_direct.erl36
-rw-r--r--src/rabbit_disk_monitor.erl24
-rw-r--r--src/rabbit_epmd_monitor.erl6
-rw-r--r--src/rabbit_error_logger.erl8
-rw-r--r--src/rabbit_exchange.erl102
-rw-r--r--src/rabbit_exchange_type_headers.erl7
-rw-r--r--src/rabbit_exchange_type_invalid.erl6
-rw-r--r--src/rabbit_file.erl55
-rw-r--r--src/rabbit_framing.erl6
-rw-r--r--src/rabbit_guid.erl18
-rw-r--r--src/rabbit_limiter.erl74
-rw-r--r--src/rabbit_log.erl30
-rw-r--r--src/rabbit_memory_monitor.erl16
-rw-r--r--src/rabbit_mirror_queue_coordinator.erl17
-rw-r--r--src/rabbit_mirror_queue_master.erl33
-rw-r--r--src/rabbit_mirror_queue_misc.erl40
-rw-r--r--src/rabbit_mirror_queue_mode.erl19
-rw-r--r--src/rabbit_mirror_queue_slave.erl5
-rw-r--r--src/rabbit_mirror_queue_sync.erl30
-rw-r--r--src/rabbit_mnesia.erl58
-rw-r--r--src/rabbit_mnesia_rename.erl8
-rw-r--r--src/rabbit_msg_file.erl32
-rw-r--r--src/rabbit_msg_store.erl80
-rw-r--r--src/rabbit_msg_store_gc.erl20
-rw-r--r--src/rabbit_node_monitor.erl54
-rw-r--r--src/rabbit_plugins.erl23
-rw-r--r--src/rabbit_plugins_main.erl8
-rw-r--r--src/rabbit_prelaunch.erl15
-rw-r--r--src/rabbit_prequeue.erl10
-rw-r--r--src/rabbit_queue_consumers.erl4
-rw-r--r--src/rabbit_queue_index.erl74
-rw-r--r--src/rabbit_recovery_terms.erl14
-rw-r--r--src/rabbit_registry.erl20
-rw-r--r--src/rabbit_resource_monitor_misc.erl8
-rw-r--r--src/rabbit_restartable_sup.erl8
-rw-r--r--src/rabbit_router.erl16
-rw-r--r--src/rabbit_runtime_parameters.erl60
-rw-r--r--src/rabbit_ssl.erl20
-rw-r--r--src/rabbit_sup.erl28
-rw-r--r--src/rabbit_table.erl26
-rw-r--r--src/rabbit_trace.erl22
-rw-r--r--src/rabbit_upgrade.erl13
-rw-r--r--src/rabbit_upgrade_functions.erl62
-rw-r--r--src/rabbit_variable_queue.erl24
-rw-r--r--src/rabbit_version.erl45
-rw-r--r--src/rabbit_vhost.erl32
-rw-r--r--src/rabbit_vm.erl38
-rw-r--r--src/supervised_lifecycle.erl8
-rw-r--r--src/tcp_listener.erl10
-rw-r--r--src/tcp_listener_sup.erl10
-rw-r--r--src/vm_memory_monitor.erl26
-rw-r--r--src/worker_pool.erl24
-rw-r--r--src/worker_pool_sup.erl12
-rw-r--r--src/worker_pool_worker.erl20
79 files changed, 931 insertions, 1249 deletions
diff --git a/src/background_gc.erl b/src/background_gc.erl
index 8388207d52..2986f356f5 100644
--- a/src/background_gc.erl
+++ b/src/background_gc.erl
@@ -32,13 +32,9 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/0 :: () -> {'ok', pid()} | {'error', any()}).
--spec(run/0 :: () -> 'ok').
--spec(gc/0 :: () -> 'ok').
-
--endif.
+-spec start_link() -> {'ok', pid()} | {'error', any()}.
+-spec run() -> 'ok'.
+-spec gc() -> 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/delegate.erl b/src/delegate.erl
index fc3bc2890f..778137c1c7 100644
--- a/src/delegate.erl
+++ b/src/delegate.erl
@@ -57,28 +57,24 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-export_type([monitor_ref/0]).
--type(monitor_ref() :: reference() | {atom(), pid()}).
--type(fun_or_mfa(A) :: fun ((pid()) -> A) | {atom(), atom(), [any()]}).
+-type monitor_ref() :: reference() | {atom(), pid()}.
+-type fun_or_mfa(A) :: fun ((pid()) -> A) | {atom(), atom(), [any()]}.
--spec(start_link/1 ::
- (non_neg_integer()) -> {'ok', pid()} | ignore | {'error', any()}).
--spec(invoke/2 :: ( pid(), fun_or_mfa(A)) -> A;
- ([pid()], fun_or_mfa(A)) -> {[{pid(), A}],
- [{pid(), term()}]}).
--spec(invoke_no_result/2 :: (pid() | [pid()], fun_or_mfa(any())) -> 'ok').
--spec(monitor/2 :: ('process', pid()) -> monitor_ref()).
--spec(demonitor/1 :: (monitor_ref()) -> 'true').
+-spec start_link
+ (non_neg_integer()) -> {'ok', pid()} | ignore | {'error', any()}.
+-spec invoke
+ ( pid(), fun_or_mfa(A)) -> A;
+ ([pid()], fun_or_mfa(A)) -> {[{pid(), A}], [{pid(), term()}]}.
+-spec invoke_no_result(pid() | [pid()], fun_or_mfa(any())) -> 'ok'.
+-spec monitor('process', pid()) -> monitor_ref().
+-spec demonitor(monitor_ref()) -> 'true'.
--spec(call/2 ::
+-spec call
( pid(), any()) -> any();
- ([pid()], any()) -> {[{pid(), any()}], [{pid(), term()}]}).
--spec(cast/2 :: (pid() | [pid()], any()) -> 'ok').
-
--endif.
+ ([pid()], any()) -> {[{pid(), any()}], [{pid(), term()}]}.
+-spec cast(pid() | [pid()], any()) -> 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/delegate_sup.erl b/src/delegate_sup.erl
index 84ca9553ec..ba0964f9dd 100644
--- a/src/delegate_sup.erl
+++ b/src/delegate_sup.erl
@@ -26,12 +26,8 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/1 :: (integer()) -> rabbit_types:ok_pid_or_error()).
--spec(count/1 :: ([node()]) -> integer()).
-
--endif.
+-spec start_link(integer()) -> rabbit_types:ok_pid_or_error().
+-spec count([node()]) -> integer().
%%----------------------------------------------------------------------------
diff --git a/src/dtree.erl b/src/dtree.erl
index 99133e75b6..a2232c0687 100644
--- a/src/dtree.erl
+++ b/src/dtree.erl
@@ -37,29 +37,25 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-export_type([?MODULE/0]).
--opaque(?MODULE() :: {gb_trees:tree(), gb_trees:tree()}).
-
--type(pk() :: any()).
--type(sk() :: any()).
--type(val() :: any()).
--type(kv() :: {pk(), val()}).
-
--spec(empty/0 :: () -> ?MODULE()).
--spec(insert/4 :: (pk(), [sk()], val(), ?MODULE()) -> ?MODULE()).
--spec(take/3 :: ([pk()], sk(), ?MODULE()) -> {[kv()], ?MODULE()}).
--spec(take/2 :: (sk(), ?MODULE()) -> {[kv()], ?MODULE()}).
--spec(take_all/2 :: (sk(), ?MODULE()) -> {[kv()], ?MODULE()}).
--spec(drop/2 :: (pk(), ?MODULE()) -> ?MODULE()).
--spec(is_defined/2 :: (sk(), ?MODULE()) -> boolean()).
--spec(is_empty/1 :: (?MODULE()) -> boolean()).
--spec(smallest/1 :: (?MODULE()) -> kv()).
--spec(size/1 :: (?MODULE()) -> non_neg_integer()).
-
--endif.
+-opaque ?MODULE() :: {gb_trees:tree(), gb_trees:tree()}.
+
+-type pk() :: any().
+-type sk() :: any().
+-type val() :: any().
+-type kv() :: {pk(), val()}.
+
+-spec empty() -> ?MODULE().
+-spec insert(pk(), [sk()], val(), ?MODULE()) -> ?MODULE().
+-spec take([pk()], sk(), ?MODULE()) -> {[kv()], ?MODULE()}.
+-spec take(sk(), ?MODULE()) -> {[kv()], ?MODULE()}.
+-spec take_all(sk(), ?MODULE()) -> {[kv()], ?MODULE()}.
+-spec drop(pk(), ?MODULE()) -> ?MODULE().
+-spec is_defined(sk(), ?MODULE()) -> boolean().
+-spec is_empty(?MODULE()) -> boolean().
+-spec smallest(?MODULE()) -> kv().
+-spec size(?MODULE()) -> non_neg_integer().
%%----------------------------------------------------------------------------
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl
index 78b0095036..ec2d82186a 100644
--- a/src/file_handle_cache.erl
+++ b/src/file_handle_cache.erl
@@ -234,58 +234,53 @@
%% Specs
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--type(ref() :: any()).
--type(ok_or_error() :: 'ok' | {'error', any()}).
--type(val_or_error(T) :: {'ok', T} | {'error', any()}).
--type(position() :: ('bof' | 'eof' | non_neg_integer() |
+-type ref() :: any().
+-type ok_or_error() :: 'ok' | {'error', any()}.
+-type val_or_error(T) :: {'ok', T} | {'error', any()}.
+-type position() :: ('bof' | 'eof' | non_neg_integer() |
{('bof' |'eof'), non_neg_integer()} |
- {'cur', integer()})).
--type(offset() :: non_neg_integer()).
+ {'cur', integer()}).
+-type offset() :: non_neg_integer().
--spec(register_callback/3 :: (atom(), atom(), [any()]) -> 'ok').
--spec(open/3 ::
+-spec register_callback(atom(), atom(), [any()]) -> 'ok'.
+-spec open
(file:filename(), [any()],
[{'write_buffer', (non_neg_integer() | 'infinity' | 'unbuffered')} |
- {'read_buffer', (non_neg_integer() | 'unbuffered')}])
- -> val_or_error(ref())).
--spec(open_with_absolute_path/3 ::
+ {'read_buffer', (non_neg_integer() | 'unbuffered')}]) ->
+ val_or_error(ref()).
+-spec open_with_absolute_path
(file:filename(), [any()],
[{'write_buffer', (non_neg_integer() | 'infinity' | 'unbuffered')} |
- {'read_buffer', (non_neg_integer() | 'unbuffered')}])
- -> val_or_error(ref())).
--spec(close/1 :: (ref()) -> ok_or_error()).
--spec(read/2 :: (ref(), non_neg_integer()) ->
- val_or_error([char()] | binary()) | 'eof').
--spec(append/2 :: (ref(), iodata()) -> ok_or_error()).
--spec(sync/1 :: (ref()) -> ok_or_error()).
--spec(position/2 :: (ref(), position()) -> val_or_error(offset())).
--spec(truncate/1 :: (ref()) -> ok_or_error()).
--spec(current_virtual_offset/1 :: (ref()) -> val_or_error(offset())).
--spec(current_raw_offset/1 :: (ref()) -> val_or_error(offset())).
--spec(flush/1 :: (ref()) -> ok_or_error()).
--spec(copy/3 :: (ref(), ref(), non_neg_integer()) ->
- val_or_error(non_neg_integer())).
--spec(delete/1 :: (ref()) -> ok_or_error()).
--spec(clear/1 :: (ref()) -> ok_or_error()).
--spec(set_maximum_since_use/1 :: (non_neg_integer()) -> 'ok').
--spec(obtain/0 :: () -> 'ok').
--spec(obtain/1 :: (non_neg_integer()) -> 'ok').
--spec(release/0 :: () -> 'ok').
--spec(release/1 :: (non_neg_integer()) -> 'ok').
--spec(transfer/1 :: (pid()) -> 'ok').
--spec(transfer/2 :: (pid(), non_neg_integer()) -> 'ok').
--spec(with_handle/1 :: (fun(() -> A)) -> A).
--spec(with_handle/2 :: (non_neg_integer(), fun(() -> A)) -> A).
--spec(set_limit/1 :: (non_neg_integer()) -> 'ok').
--spec(get_limit/0 :: () -> non_neg_integer()).
--spec(info_keys/0 :: () -> rabbit_types:info_keys()).
--spec(info/0 :: () -> rabbit_types:infos()).
--spec(info/1 :: ([atom()]) -> rabbit_types:infos()).
--spec(ulimit/0 :: () -> 'unknown' | non_neg_integer()).
-
--endif.
+ {'read_buffer', (non_neg_integer() | 'unbuffered')}]) ->
+ val_or_error(ref()).
+-spec close(ref()) -> ok_or_error().
+-spec read
+ (ref(), non_neg_integer()) -> val_or_error([char()] | binary()) | 'eof'.
+-spec append(ref(), iodata()) -> ok_or_error().
+-spec sync(ref()) -> ok_or_error().
+-spec position(ref(), position()) -> val_or_error(offset()).
+-spec truncate(ref()) -> ok_or_error().
+-spec current_virtual_offset(ref()) -> val_or_error(offset()).
+-spec current_raw_offset(ref()) -> val_or_error(offset()).
+-spec flush(ref()) -> ok_or_error().
+-spec copy(ref(), ref(), non_neg_integer()) -> val_or_error(non_neg_integer()).
+-spec delete(ref()) -> ok_or_error().
+-spec clear(ref()) -> ok_or_error().
+-spec set_maximum_since_use(non_neg_integer()) -> 'ok'.
+-spec obtain() -> 'ok'.
+-spec obtain(non_neg_integer()) -> 'ok'.
+-spec release() -> 'ok'.
+-spec release(non_neg_integer()) -> 'ok'.
+-spec transfer(pid()) -> 'ok'.
+-spec transfer(pid(), non_neg_integer()) -> 'ok'.
+-spec with_handle(fun(() -> A)) -> A.
+-spec with_handle(non_neg_integer(), fun(() -> A)) -> A.
+-spec set_limit(non_neg_integer()) -> 'ok'.
+-spec get_limit() -> non_neg_integer().
+-spec info_keys() -> rabbit_types:info_keys().
+-spec info() -> rabbit_types:infos().
+-spec info([atom()]) -> rabbit_types:infos().
+-spec ulimit() -> 'unknown' | non_neg_integer().
%%----------------------------------------------------------------------------
-define(INFO_KEYS, [total_limit, total_used, sockets_limit, sockets_used]).
diff --git a/src/gatherer.erl b/src/gatherer.erl
index d3e1a4e438..18302699a2 100644
--- a/src/gatherer.erl
+++ b/src/gatherer.erl
@@ -39,17 +39,13 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
--spec(stop/1 :: (pid()) -> 'ok').
--spec(fork/1 :: (pid()) -> 'ok').
--spec(finish/1 :: (pid()) -> 'ok').
--spec(in/2 :: (pid(), any()) -> 'ok').
--spec(sync_in/2 :: (pid(), any()) -> 'ok').
--spec(out/1 :: (pid()) -> {'value', any()} | 'empty').
-
--endif.
+-spec start_link() -> rabbit_types:ok_pid_or_error().
+-spec stop(pid()) -> 'ok'.
+-spec fork(pid()) -> 'ok'.
+-spec finish(pid()) -> 'ok'.
+-spec in(pid(), any()) -> 'ok'.
+-spec sync_in(pid(), any()) -> 'ok'.
+-spec out(pid()) -> {'value', any()} | 'empty'.
%%----------------------------------------------------------------------------
diff --git a/src/gm.erl b/src/gm.erl
index 1e4168c0e6..dc47b93a5b 100644
--- a/src/gm.erl
+++ b/src/gm.erl
@@ -391,10 +391,6 @@
%% For INSTR_MOD callbacks
-export([call/3, cast/2, monitor/1, demonitor/1]).
--ifndef(use_specs).
--export([behaviour_info/1]).
--endif.
-
-export([table_definitions/0]).
-define(GROUP_TABLE, gm_group).
@@ -436,22 +432,20 @@
-define(TAG, '$gm').
--ifdef(use_specs).
-
-export_type([group_name/0]).
--type(group_name() :: any()).
--type(txn_fun() :: fun((fun(() -> any())) -> any())).
+-type group_name() :: any().
+-type txn_fun() :: fun((fun(() -> any())) -> any()).
--spec(create_tables/0 :: () -> 'ok' | {'aborted', any()}).
--spec(start_link/4 :: (group_name(), atom(), any(), txn_fun()) ->
- rabbit_types:ok_pid_or_error()).
--spec(leave/1 :: (pid()) -> 'ok').
--spec(broadcast/2 :: (pid(), any()) -> 'ok').
--spec(confirmed_broadcast/2 :: (pid(), any()) -> 'ok').
--spec(info/1 :: (pid()) -> rabbit_types:infos()).
--spec(validate_members/2 :: (pid(), [pid()]) -> 'ok').
--spec(forget_group/1 :: (group_name()) -> 'ok').
+-spec create_tables() -> 'ok' | {'aborted', any()}.
+-spec start_link(group_name(), atom(), any(), txn_fun()) ->
+ rabbit_types:ok_pid_or_error().
+-spec leave(pid()) -> 'ok'.
+-spec broadcast(pid(), any()) -> 'ok'.
+-spec confirmed_broadcast(pid(), any()) -> 'ok'.
+-spec info(pid()) -> rabbit_types:infos().
+-spec validate_members(pid(), [pid()]) -> 'ok'.
+-spec forget_group(group_name()) -> 'ok'.
%% The joined, members_changed and handle_msg callbacks can all return
%% any of the following terms:
@@ -497,15 +491,6 @@
-callback handle_terminate(Args :: term(), Reason :: term()) ->
ok | term().
--else.
-
-behaviour_info(callbacks) ->
- [{joined, 2}, {members_changed, 3}, {handle_msg, 3}, {handle_terminate, 2}];
-behaviour_info(_Other) ->
- undefined.
-
--endif.
-
create_tables() ->
create_tables([?TABLE]).
diff --git a/src/lqueue.erl b/src/lqueue.erl
index 4e78346feb..1e24e9e75f 100644
--- a/src/lqueue.erl
+++ b/src/lqueue.erl
@@ -25,30 +25,26 @@
-define(QUEUE, queue).
--ifdef(use_specs).
-
-export_type([?MODULE/0]).
--opaque(?MODULE() :: {non_neg_integer(), ?QUEUE:?QUEUE()}).
--type(value() :: any()).
--type(result() :: 'empty' | {'value', value()}).
-
--spec(new/0 :: () -> ?MODULE()).
--spec(is_empty/1 :: (?MODULE()) -> boolean()).
--spec(len/1 :: (?MODULE()) -> non_neg_integer()).
--spec(in/2 :: (value(), ?MODULE()) -> ?MODULE()).
--spec(in_r/2 :: (value(), ?MODULE()) -> ?MODULE()).
--spec(out/1 :: (?MODULE()) -> {result(), ?MODULE()}).
--spec(out_r/1 :: (?MODULE()) -> {result(), ?MODULE()}).
--spec(join/2 :: (?MODULE(), ?MODULE()) -> ?MODULE()).
--spec(foldl/3 :: (fun ((value(), B) -> B), B, ?MODULE()) -> B).
--spec(foldr/3 :: (fun ((value(), B) -> B), B, ?MODULE()) -> B).
--spec(from_list/1 :: ([value()]) -> ?MODULE()).
--spec(to_list/1 :: (?MODULE()) -> [value()]).
--spec(peek/1 :: (?MODULE()) -> result()).
--spec(peek_r/1 :: (?MODULE()) -> result()).
-
--endif.
+-opaque ?MODULE() :: {non_neg_integer(), ?QUEUE:?QUEUE()}.
+-type value() :: any().
+-type result() :: 'empty' | {'value', value()}.
+
+-spec new() -> ?MODULE().
+-spec is_empty(?MODULE()) -> boolean().
+-spec len(?MODULE()) -> non_neg_integer().
+-spec in(value(), ?MODULE()) -> ?MODULE().
+-spec in_r(value(), ?MODULE()) -> ?MODULE().
+-spec out(?MODULE()) -> {result(), ?MODULE()}.
+-spec out_r(?MODULE()) -> {result(), ?MODULE()}.
+-spec join(?MODULE(), ?MODULE()) -> ?MODULE().
+-spec foldl(fun ((value(), B) -> B), B, ?MODULE()) -> B.
+-spec foldr(fun ((value(), B) -> B), B, ?MODULE()) -> B.
+-spec from_list([value()]) -> ?MODULE().
+-spec to_list(?MODULE()) -> [value()].
+-spec peek(?MODULE()) -> result().
+-spec peek_r(?MODULE()) -> result().
new() -> {0, ?QUEUE:new()}.
diff --git a/src/mnesia_sync.erl b/src/mnesia_sync.erl
index 0b1126eb12..8d5c946635 100644
--- a/src/mnesia_sync.erl
+++ b/src/mnesia_sync.erl
@@ -34,11 +34,7 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(sync/0 :: () -> 'ok').
-
--endif.
+-spec sync() -> 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/pg_local.erl b/src/pg_local.erl
index 62fae2b077..e1f5219dcb 100644
--- a/src/pg_local.erl
+++ b/src/pg_local.erl
@@ -41,20 +41,16 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
+-type name() :: term().
--type(name() :: term()).
+-spec start_link() -> {'ok', pid()} | {'error', any()}.
+-spec start() -> {'ok', pid()} | {'error', any()}.
+-spec join(name(), pid()) -> 'ok'.
+-spec leave(name(), pid()) -> 'ok'.
+-spec get_members(name()) -> [pid()].
+-spec in_group(name(), pid()) -> boolean().
--spec(start_link/0 :: () -> {'ok', pid()} | {'error', any()}).
--spec(start/0 :: () -> {'ok', pid()} | {'error', any()}).
--spec(join/2 :: (name(), pid()) -> 'ok').
--spec(leave/2 :: (name(), pid()) -> 'ok').
--spec(get_members/1 :: (name()) -> [pid()]).
--spec(in_group/2 :: (name(), pid()) -> boolean()).
-
--spec(sync/0 :: () -> 'ok').
-
--endif.
+-spec sync() -> 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 06c84b53b4..a86fd97925 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -198,48 +198,44 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--type(file_suffix() :: binary()).
+-type file_suffix() :: binary().
%% this really should be an abstract type
--type(log_location() :: 'tty' | 'undefined' | file:filename()).
--type(param() :: atom()).
--type(app_name() :: atom()).
-
--spec(start/0 :: () -> 'ok').
--spec(boot/0 :: () -> 'ok').
--spec(stop/0 :: () -> 'ok').
--spec(stop_and_halt/0 :: () -> no_return()).
--spec(await_startup/0 :: () -> 'ok').
--spec(status/0 ::
+-type log_location() :: 'tty' | 'undefined' | file:filename().
+-type param() :: atom().
+-type app_name() :: atom().
+
+-spec start() -> 'ok'.
+-spec boot() -> 'ok'.
+-spec stop() -> 'ok'.
+-spec stop_and_halt() -> no_return().
+-spec await_startup() -> 'ok'.
+-spec status
() -> [{pid, integer()} |
{running_applications, [{atom(), string(), string()}]} |
{os, {atom(), atom()}} |
{erlang_version, string()} |
- {memory, any()}]).
--spec(is_running/0 :: () -> boolean()).
--spec(is_running/1 :: (node()) -> boolean()).
--spec(environment/0 :: () -> [{param(), term()}]).
--spec(rotate_logs/1 :: (file_suffix()) -> rabbit_types:ok_or_error(any())).
--spec(force_event_refresh/1 :: (reference()) -> 'ok').
-
--spec(log_location/1 :: ('sasl' | 'kernel') -> log_location()).
-
--spec(start/2 :: ('normal',[]) ->
- {'error',
- {'erlang_version_too_old',
- {'found',string(),string()},
- {'required',string(),string()}}} |
- {'ok',pid()}).
--spec(stop/1 :: (_) -> 'ok').
-
--spec(maybe_insert_default_data/0 :: () -> 'ok').
--spec(boot_delegate/0 :: () -> 'ok').
--spec(recover/0 :: () -> 'ok').
--spec(start_apps/1 :: ([app_name()]) -> 'ok').
--spec(stop_apps/1 :: ([app_name()]) -> 'ok').
-
--endif.
+ {memory, any()}].
+-spec is_running() -> boolean().
+-spec is_running(node()) -> boolean().
+-spec environment() -> [{param(), term()}].
+-spec rotate_logs(file_suffix()) -> rabbit_types:ok_or_error(any()).
+-spec force_event_refresh(reference()) -> 'ok'.
+
+-spec log_location('sasl' | 'kernel') -> log_location().
+
+-spec start('normal',[]) ->
+ {'error',
+ {'erlang_version_too_old',
+ {'found',string(),string()},
+ {'required',string(),string()}}} |
+ {'ok',pid()}.
+-spec stop(_) -> 'ok'.
+
+-spec maybe_insert_default_data() -> 'ok'.
+-spec boot_delegate() -> 'ok'.
+-spec recover() -> 'ok'.
+-spec start_apps([app_name()]) -> 'ok'.
+-spec stop_apps([app_name()]) -> 'ok'.
%%----------------------------------------------------------------------------
@@ -600,9 +596,8 @@ prep_stop(_State) ->
stop(_) -> ok.
--ifdef(use_specs).
--spec(boot_error/2 :: (term(), not_available | [tuple()]) -> no_return()).
--endif.
+-spec boot_error(term(), not_available | [tuple()]) -> no_return().
+
boot_error({could_not_start, rabbit, {{timeout_waiting_for_tables, _}, _}},
_Stacktrace) ->
AllNodes = rabbit_mnesia:cluster_nodes(all),
@@ -630,10 +625,9 @@ boot_error(Reason, Stacktrace) ->
Args = [Reason, log_location(kernel), log_location(sasl)],
boot_error(Reason, Fmt, Args, Stacktrace).
--ifdef(use_specs).
--spec(boot_error/4 :: (term(), string(), [any()], not_available | [tuple()])
- -> no_return()).
--endif.
+-spec boot_error(term(), string(), [any()], not_available | [tuple()]) ->
+ no_return().
+
boot_error(Reason, Fmt, Args, not_available) ->
log_boot_error_and_exit(Reason, Fmt, Args);
boot_error(Reason, Fmt, Args, Stacktrace) ->
diff --git a/src/rabbit_access_control.erl b/src/rabbit_access_control.erl
index dae4d4732a..3ae7d7f690 100644
--- a/src/rabbit_access_control.erl
+++ b/src/rabbit_access_control.erl
@@ -23,31 +23,28 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-export_type([permission_atom/0]).
--type(permission_atom() :: 'configure' | 'read' | 'write').
-
--spec(check_user_pass_login/2 ::
- (rabbit_types:username(), rabbit_types:password())
- -> {'ok', rabbit_types:user()} |
- {'refused', rabbit_types:username(), string(), [any()]}).
--spec(check_user_login/2 ::
- (rabbit_types:username(), [{atom(), any()}])
- -> {'ok', rabbit_types:user()} |
- {'refused', rabbit_types:username(), string(), [any()]}).
--spec(check_user_loopback/2 :: (rabbit_types:username(),
- rabbit_net:socket() | inet:ip_address())
- -> 'ok' | 'not_allowed').
--spec(check_vhost_access/3 ::
- (rabbit_types:user(), rabbit_types:vhost(), rabbit_net:socket() | #authz_socket_info{})
- -> 'ok' | rabbit_types:channel_exit()).
--spec(check_resource_access/3 ::
- (rabbit_types:user(), rabbit_types:r(atom()), permission_atom())
- -> 'ok' | rabbit_types:channel_exit()).
-
--endif.
+-type permission_atom() :: 'configure' | 'read' | 'write'.
+
+-spec check_user_pass_login
+ (rabbit_types:username(), rabbit_types:password()) ->
+ {'ok', rabbit_types:user()} |
+ {'refused', rabbit_types:username(), string(), [any()]}.
+-spec check_user_login
+ (rabbit_types:username(), [{atom(), any()}]) ->
+ {'ok', rabbit_types:user()} |
+ {'refused', rabbit_types:username(), string(), [any()]}.
+-spec check_user_loopback
+ (rabbit_types:username(), rabbit_net:socket() | inet:ip_address()) ->
+ 'ok' | 'not_allowed'.
+-spec check_vhost_access
+ (rabbit_types:user(), rabbit_types:vhost(),
+ rabbit_net:socket() | #authz_socket_info{}) ->
+ 'ok' | rabbit_types:channel_exit().
+-spec check_resource_access
+ (rabbit_types:user(), rabbit_types:r(atom()), permission_atom()) ->
+ 'ok' | rabbit_types:channel_exit().
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_alarm.erl b/src/rabbit_alarm.erl
index 30743ea243..dd64c6f1c8 100644
--- a/src/rabbit_alarm.erl
+++ b/src/rabbit_alarm.erl
@@ -43,32 +43,24 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-record(alarms, {alertees :: dict:dict(pid(), rabbit_types:mfargs()),
alarmed_nodes :: dict:dict(node(), [resource_alarm_source()]),
alarms :: [alarm()]}).
--type(local_alarm() :: 'file_descriptor_limit').
--type(resource_alarm_source() :: 'disk' | 'memory').
--type(resource_alarm() :: {resource_limit, resource_alarm_source(), node()}).
--type(alarm() :: local_alarm() | resource_alarm()).
-
--spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
--spec(start/0 :: () -> 'ok').
--spec(stop/0 :: () -> 'ok').
--spec(register/2 :: (pid(), rabbit_types:mfargs()) -> [atom()]).
--spec(set_alarm/1 :: ({alarm(), []}) -> 'ok').
--spec(clear_alarm/1 :: (alarm()) -> 'ok').
--spec(on_node_up/1 :: (node()) -> 'ok').
--spec(on_node_down/1 :: (node()) -> 'ok').
--spec(get_alarms/0 :: () -> [{alarm(), []}]).
-
--else.
-
--record(alarms, {alertees, alarmed_nodes, alarms}).
-
--endif.
+-type local_alarm() :: 'file_descriptor_limit'.
+-type resource_alarm_source() :: 'disk' | 'memory'.
+-type resource_alarm() :: {resource_limit, resource_alarm_source(), node()}.
+-type alarm() :: local_alarm() | resource_alarm().
+
+-spec start_link() -> rabbit_types:ok_pid_or_error().
+-spec start() -> 'ok'.
+-spec stop() -> 'ok'.
+-spec register(pid(), rabbit_types:mfargs()) -> [atom()].
+-spec set_alarm({alarm(), []}) -> 'ok'.
+-spec clear_alarm(alarm()) -> 'ok'.
+-spec on_node_up(node()) -> 'ok'.
+-spec on_node_down(node()) -> 'ok'.
+-spec get_alarms() -> [{alarm(), []}].
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index cd21aa62b8..d3cc94bb0e 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -91,14 +91,11 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(info_keys/0 :: () -> rabbit_types:info_keys()).
--spec(init_with_backing_queue_state/7 ::
+-spec info_keys() -> rabbit_types:info_keys().
+-spec init_with_backing_queue_state
(rabbit_types:amqqueue(), atom(), tuple(), any(),
- [rabbit_types:delivery()], pmon:pmon(), dict:dict()) -> #q{}).
-
--endif.
+ [rabbit_types:delivery()], pmon:pmon(), dict:dict()) ->
+ #q{}.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_amqqueue_sup.erl b/src/rabbit_amqqueue_sup.erl
index e46ae0f508..f1e770aa45 100644
--- a/src/rabbit_amqqueue_sup.erl
+++ b/src/rabbit_amqqueue_sup.erl
@@ -26,12 +26,8 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/2 :: (rabbit_types:amqqueue(), rabbit_prequeue:start_mode()) ->
- {'ok', pid(), pid()}).
-
--endif.
+-spec start_link(rabbit_types:amqqueue(), rabbit_prequeue:start_mode()) ->
+ {'ok', pid(), pid()}.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_amqqueue_sup_sup.erl b/src/rabbit_amqqueue_sup_sup.erl
index 68aabbfe28..c57d9334e2 100644
--- a/src/rabbit_amqqueue_sup_sup.erl
+++ b/src/rabbit_amqqueue_sup_sup.erl
@@ -28,13 +28,10 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
--spec(start_queue_process/3 :: (node(), rabbit_types:amqqueue(),
- 'declare' | 'recovery' | 'slave') -> pid()).
-
--endif.
+-spec start_link() -> rabbit_types:ok_pid_or_error().
+-spec start_queue_process
+ (node(), rabbit_types:amqqueue(), 'declare' | 'recovery' | 'slave') ->
+ pid().
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl
index 8904c1dd74..7cebd194a6 100644
--- a/src/rabbit_binding.erl
+++ b/src/rabbit_binding.erl
@@ -29,78 +29,77 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-export_type([key/0, deletions/0]).
--type(key() :: binary()).
+-type key() :: binary().
--type(bind_errors() :: rabbit_types:error(
+-type bind_errors() :: rabbit_types:error(
{'resources_missing',
[{'not_found', (rabbit_types:binding_source() |
rabbit_types:binding_destination())} |
- {'absent', rabbit_types:amqqueue()}]})).
+ {'absent', rabbit_types:amqqueue()}]}).
--type(bind_ok_or_error() :: 'ok' | bind_errors() |
+-type bind_ok_or_error() :: 'ok' | bind_errors() |
rabbit_types:error(
'binding_not_found' |
- {'binding_invalid', string(), [any()]})).
--type(bind_res() :: bind_ok_or_error() | rabbit_misc:thunk(bind_ok_or_error())).
--type(inner_fun() ::
+ {'binding_invalid', string(), [any()]}).
+-type bind_res() :: bind_ok_or_error() | rabbit_misc:thunk(bind_ok_or_error()).
+-type inner_fun() ::
fun((rabbit_types:exchange(),
rabbit_types:exchange() | rabbit_types:amqqueue()) ->
- rabbit_types:ok_or_error(rabbit_types:amqp_error()))).
--type(bindings() :: [rabbit_types:binding()]).
+ rabbit_types:ok_or_error(rabbit_types:amqp_error())).
+-type bindings() :: [rabbit_types:binding()].
%% TODO this should really be opaque but that seems to confuse 17.1's
%% dialyzer into objecting to everything that uses it.
--type(deletions() :: dict:dict()).
-
--spec(recover/2 :: ([rabbit_exchange:name()], [rabbit_amqqueue:name()]) ->
- 'ok').
--spec(exists/1 :: (rabbit_types:binding()) -> boolean() | bind_errors()).
--spec(add/1 :: (rabbit_types:binding()) -> bind_res()).
--spec(add/2 :: (rabbit_types:binding(), inner_fun()) -> bind_res()).
--spec(remove/1 :: (rabbit_types:binding()) -> bind_res()).
--spec(remove/2 :: (rabbit_types:binding(), inner_fun()) -> bind_res()).
--spec(list/1 :: (rabbit_types:vhost()) -> bindings()).
--spec(list_for_source/1 ::
- (rabbit_types:binding_source()) -> bindings()).
--spec(list_for_destination/1 ::
- (rabbit_types:binding_destination()) -> bindings()).
--spec(list_for_source_and_destination/2 ::
+-type deletions() :: dict:dict().
+
+-spec recover([rabbit_exchange:name()], [rabbit_amqqueue:name()]) ->
+ 'ok'.
+-spec exists(rabbit_types:binding()) -> boolean() | bind_errors().
+-spec add(rabbit_types:binding()) -> bind_res().
+-spec add(rabbit_types:binding(), inner_fun()) -> bind_res().
+-spec remove(rabbit_types:binding()) -> bind_res().
+-spec remove(rabbit_types:binding(), inner_fun()) -> bind_res().
+-spec list(rabbit_types:vhost()) -> bindings().
+-spec list_for_source
+ (rabbit_types:binding_source()) -> bindings().
+-spec list_for_destination
+ (rabbit_types:binding_destination()) -> bindings().
+-spec list_for_source_and_destination
(rabbit_types:binding_source(), rabbit_types:binding_destination()) ->
- bindings()).
--spec(info_keys/0 :: () -> rabbit_types:info_keys()).
--spec(info/1 :: (rabbit_types:binding()) -> rabbit_types:infos()).
--spec(info/2 :: (rabbit_types:binding(), rabbit_types:info_keys()) ->
- rabbit_types:infos()).
--spec(info_all/1 :: (rabbit_types:vhost()) -> [rabbit_types:infos()]).
--spec(info_all/2 ::(rabbit_types:vhost(), rabbit_types:info_keys())
- -> [rabbit_types:infos()]).
--spec(info_all/4 ::(rabbit_types:vhost(), rabbit_types:info_keys(),
- reference(), pid()) -> 'ok').
--spec(has_for_source/1 :: (rabbit_types:binding_source()) -> boolean()).
--spec(remove_for_source/1 :: (rabbit_types:binding_source()) -> bindings()).
--spec(remove_for_destination/2 ::
- (rabbit_types:binding_destination(), boolean()) -> deletions()).
--spec(remove_transient_for_destination/1 ::
- (rabbit_types:binding_destination()) -> deletions()).
--spec(process_deletions/1 :: (deletions()) -> rabbit_misc:thunk('ok')).
--spec(combine_deletions/2 :: (deletions(), deletions()) -> deletions()).
--spec(add_deletion/3 :: (rabbit_exchange:name(),
- {'undefined' | rabbit_types:exchange(),
- 'deleted' | 'not_deleted',
- bindings()}, deletions()) -> deletions()).
--spec(new_deletions/0 :: () -> deletions()).
-
--endif.
+ bindings().
+-spec info_keys() -> rabbit_types:info_keys().
+-spec info(rabbit_types:binding()) -> rabbit_types:infos().
+-spec info(rabbit_types:binding(), rabbit_types:info_keys()) ->
+ rabbit_types:infos().
+-spec info_all(rabbit_types:vhost()) -> [rabbit_types:infos()].
+-spec info_all(rabbit_types:vhost(), rabbit_types:info_keys()) ->
+ [rabbit_types:infos()].
+-spec info_all(rabbit_types:vhost(), rabbit_types:info_keys(),
+ reference(), pid()) -> 'ok'.
+-spec has_for_source(rabbit_types:binding_source()) -> boolean().
+-spec remove_for_source(rabbit_types:binding_source()) -> bindings().
+-spec remove_for_destination
+ (rabbit_types:binding_destination(), boolean()) -> deletions().
+-spec remove_transient_for_destination
+ (rabbit_types:binding_destination()) -> deletions().
+-spec process_deletions(deletions()) -> rabbit_misc:thunk('ok').
+-spec combine_deletions(deletions(), deletions()) -> deletions().
+-spec add_deletion
+ (rabbit_exchange:name(),
+ {'undefined' | rabbit_types:exchange(),
+ 'deleted' | 'not_deleted',
+ bindings()},
+ deletions()) ->
+ deletions().
+-spec new_deletions() -> deletions().
%%----------------------------------------------------------------------------
-define(INFO_KEYS, [source_name, source_kind,
destination_name, destination_kind,
- routing_key, arguments,
+ routing_key, arguments,
vhost]).
recover(XNames, QNames) ->
diff --git a/src/rabbit_channel_sup.erl b/src/rabbit_channel_sup.erl
index 7aa369b6ca..48cc1e15c2 100644
--- a/src/rabbit_channel_sup.erl
+++ b/src/rabbit_channel_sup.erl
@@ -36,22 +36,18 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-export_type([start_link_args/0]).
--type(start_link_args() ::
+-type start_link_args() ::
{'tcp', rabbit_net:socket(), rabbit_channel:channel_number(),
non_neg_integer(), pid(), string(), rabbit_types:protocol(),
rabbit_types:user(), rabbit_types:vhost(), rabbit_framing:amqp_table(),
pid()} |
{'direct', rabbit_channel:channel_number(), pid(), string(),
rabbit_types:protocol(), rabbit_types:user(), rabbit_types:vhost(),
- rabbit_framing:amqp_table(), pid()}).
-
--spec(start_link/1 :: (start_link_args()) -> {'ok', pid(), {pid(), any()}}).
+ rabbit_framing:amqp_table(), pid()}.
--endif.
+-spec start_link(start_link_args()) -> {'ok', pid(), {pid(), any()}}.
-define(FAIR_WAIT, 70000).
diff --git a/src/rabbit_channel_sup_sup.erl b/src/rabbit_channel_sup_sup.erl
index bf483da713..885d34d0a7 100644
--- a/src/rabbit_channel_sup_sup.erl
+++ b/src/rabbit_channel_sup_sup.erl
@@ -29,13 +29,9 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
--spec(start_channel/2 :: (pid(), rabbit_channel_sup:start_link_args()) ->
- {'ok', pid(), {pid(), any()}}).
-
--endif.
+-spec start_link() -> rabbit_types:ok_pid_or_error().
+-spec start_channel(pid(), rabbit_channel_sup:start_link_args()) ->
+ {'ok', pid(), {pid(), any()}}.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_cli.erl b/src/rabbit_cli.erl
index 4151504956..d1229c32f9 100644
--- a/src/rabbit_cli.erl
+++ b/src/rabbit_cli.erl
@@ -23,32 +23,33 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--type(option_name() :: string()).
--type(option_value() :: string() | node() | boolean()).
--type(optdef() :: flag | {option, string()}).
--type(parse_result() :: {'ok', {atom(), [{option_name(), option_value()}], [string()]}} |
- 'no_command').
-
--spec(main/3 :: (fun (([string()], string()) -> parse_result()),
- fun ((atom(), atom(), [any()], [any()]) -> any()),
- atom()) -> no_return()).
--spec(start_distribution/0 :: () -> {'ok', pid()} | {'error', any()}).
--spec(start_distribution/1 :: (string()) -> {'ok', pid()} | {'error', any()}).
--spec(usage/1 :: (atom()) -> no_return()).
--spec(parse_arguments/4 ::
+-type option_name() :: string().
+-type option_value() :: string() | node() | boolean().
+-type optdef() :: flag | {option, string()}.
+-type parse_result() :: {'ok', {atom(), [{option_name(), option_value()}], [string()]}} |
+ 'no_command'.
+
+-spec main
+ (fun (([string()], string()) -> parse_result()),
+ fun ((atom(), atom(), [any()], [any()]) -> any()),
+ atom()) ->
+ no_return().
+-spec start_distribution() -> {'ok', pid()} | {'error', any()}.
+-spec start_distribution(string()) -> {'ok', pid()} | {'error', any()}.
+-spec usage(atom()) -> no_return().
+-spec parse_arguments
([{atom(), [{string(), optdef()}]} | atom()],
- [{string(), optdef()}], string(), [string()]) -> parse_result()).
-
--spec(filter_opts/2 :: ([{option_name(), option_value()}], [option_name()]) -> [boolean()]).
+ [{string(), optdef()}], string(), [string()]) ->
+ parse_result().
--spec(rpc_call/4 :: (node(), atom(), atom(), [any()]) -> any()).
--spec(rpc_call/5 :: (node(), atom(), atom(), [any()], number()) -> any()).
--spec(rpc_call/7 :: (node(), atom(), atom(), [any()], reference(), pid(),
- number()) -> any()).
+-spec filter_opts([{option_name(), option_value()}], [option_name()]) ->
+ [boolean()].
--endif.
+-spec rpc_call(node(), atom(), atom(), [any()]) -> any().
+-spec rpc_call(node(), atom(), atom(), [any()], number()) -> any().
+-spec rpc_call
+ (node(), atom(), atom(), [any()], reference(), pid(), number()) ->
+ any().
ensure_cli_distribution() ->
case start_distribution() of
diff --git a/src/rabbit_client_sup.erl b/src/rabbit_client_sup.erl
index 3779fd1dc4..77f0bcb993 100644
--- a/src/rabbit_client_sup.erl
+++ b/src/rabbit_client_sup.erl
@@ -26,16 +26,12 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/1 :: (rabbit_types:mfargs()) ->
- rabbit_types:ok_pid_or_error()).
--spec(start_link/2 :: ({'local', atom()}, rabbit_types:mfargs()) ->
- rabbit_types:ok_pid_or_error()).
--spec(start_link_worker/2 :: ({'local', atom()}, rabbit_types:mfargs()) ->
- rabbit_types:ok_pid_or_error()).
-
--endif.
+-spec start_link(rabbit_types:mfargs()) ->
+ rabbit_types:ok_pid_or_error().
+-spec start_link({'local', atom()}, rabbit_types:mfargs()) ->
+ rabbit_types:ok_pid_or_error().
+-spec start_link_worker({'local', atom()}, rabbit_types:mfargs()) ->
+ rabbit_types:ok_pid_or_error().
%%----------------------------------------------------------------------------
@@ -54,4 +50,3 @@ init({M,F,A}) ->
init({{M,F,A}, worker}) ->
{ok, {{simple_one_for_one, 0, 1},
[{client, {M,F,A}, temporary, ?WORKER_WAIT, worker, [M]}]}}.
-
diff --git a/src/rabbit_connection_helper_sup.erl b/src/rabbit_connection_helper_sup.erl
index 14374ac169..bde520b74b 100644
--- a/src/rabbit_connection_helper_sup.erl
+++ b/src/rabbit_connection_helper_sup.erl
@@ -37,12 +37,10 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
--spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
--spec(start_channel_sup_sup/1 :: (pid()) -> rabbit_types:ok_pid_or_error()).
--spec(start_queue_collector/2 :: (pid(), rabbit_types:proc_name()) ->
- rabbit_types:ok_pid_or_error()).
--endif.
+-spec start_link() -> rabbit_types:ok_pid_or_error().
+-spec start_channel_sup_sup(pid()) -> rabbit_types:ok_pid_or_error().
+-spec start_queue_collector(pid(), rabbit_types:proc_name()) ->
+ rabbit_types:ok_pid_or_error().
%%----------------------------------------------------------------------------
@@ -65,4 +63,3 @@ start_queue_collector(SupPid, Identity) ->
init([]) ->
{ok, {{one_for_one, 10, 10}, []}}.
-
diff --git a/src/rabbit_connection_sup.erl b/src/rabbit_connection_sup.erl
index 161f5bfe06..154bbb1922 100644
--- a/src/rabbit_connection_sup.erl
+++ b/src/rabbit_connection_sup.erl
@@ -36,12 +36,9 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/4 :: (any(), rabbit_net:socket(), module(), any()) -> {'ok', pid(), pid()}).
--spec(reader/1 :: (pid()) -> pid()).
-
--endif.
+-spec start_link(any(), rabbit_net:socket(), module(), any()) ->
+ {'ok', pid(), pid()}.
+-spec reader(pid()) -> pid().
%%--------------------------------------------------------------------------
diff --git a/src/rabbit_control_main.erl b/src/rabbit_control_main.erl
index 271ca4484e..fb3da21287 100644
--- a/src/rabbit_control_main.erl
+++ b/src/rabbit_control_main.erl
@@ -124,21 +124,17 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start/0 :: () -> no_return()).
--spec(stop/0 :: () -> 'ok').
--spec(action/5 ::
+-spec start() -> no_return().
+-spec stop() -> 'ok'.
+-spec action
(atom(), node(), [string()], [{string(), any()}],
- fun ((string(), [any()]) -> 'ok'))
- -> 'ok').
+ fun ((string(), [any()]) -> 'ok')) ->
+ 'ok'.
--spec(action/6 ::
+-spec action
(atom(), node(), [string()], [{string(), any()}],
- fun ((string(), [any()]) -> 'ok'), timeout())
- -> 'ok').
-
--endif.
+ fun ((string(), [any()]) -> 'ok'), timeout()) ->
+ 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_dead_letter.erl b/src/rabbit_dead_letter.erl
index 8d426f072a..91d23c83a4 100644
--- a/src/rabbit_dead_letter.erl
+++ b/src/rabbit_dead_letter.erl
@@ -23,15 +23,11 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-type reason() :: 'expired' | 'rejected' | 'maxlen'.
-spec publish(rabbit_types:message(), reason(), rabbit_types:exchange(),
'undefined' | binary(), rabbit_amqqueue:name()) -> 'ok'.
--endif.
-
%%----------------------------------------------------------------------------
publish(Msg, Reason, X, RK, QName) ->
diff --git a/src/rabbit_direct.erl b/src/rabbit_direct.erl
index b5970274d4..061105c150 100644
--- a/src/rabbit_direct.erl
+++ b/src/rabbit_direct.erl
@@ -25,27 +25,25 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(boot/0 :: () -> 'ok').
--spec(force_event_refresh/1 :: (reference()) -> 'ok').
--spec(list/0 :: () -> [pid()]).
--spec(list_local/0 :: () -> [pid()]).
--spec(connect/5 :: (({'none', 'none'} | {rabbit_types:username(), 'none'} |
- {rabbit_types:username(), rabbit_types:password()}),
- rabbit_types:vhost(), rabbit_types:protocol(), pid(),
- rabbit_event:event_props()) ->
- rabbit_types:ok_or_error2(
- {rabbit_types:user(), rabbit_framing:amqp_table()},
- 'broker_not_found_on_node' |
- {'auth_failure', string()} | 'access_refused')).
--spec(start_channel/9 ::
+-spec boot() -> 'ok'.
+-spec force_event_refresh(reference()) -> 'ok'.
+-spec list() -> [pid()].
+-spec list_local() -> [pid()].
+-spec connect
+ (({'none', 'none'} | {rabbit_types:username(), 'none'} |
+ {rabbit_types:username(), rabbit_types:password()}),
+ rabbit_types:vhost(), rabbit_types:protocol(), pid(),
+ rabbit_event:event_props()) ->
+ rabbit_types:ok_or_error2(
+ {rabbit_types:user(), rabbit_framing:amqp_table()},
+ 'broker_not_found_on_node' |
+ {'auth_failure', string()} | 'access_refused').
+-spec start_channel
(rabbit_channel:channel_number(), pid(), pid(), string(),
rabbit_types:protocol(), rabbit_types:user(), rabbit_types:vhost(),
- rabbit_framing:amqp_table(), pid()) -> {'ok', pid()}).
--spec(disconnect/2 :: (pid(), rabbit_event:event_props()) -> 'ok').
-
--endif.
+ rabbit_framing:amqp_table(), pid()) ->
+ {'ok', pid()}.
+-spec disconnect(pid(), rabbit_event:event_props()) -> 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_disk_monitor.erl b/src/rabbit_disk_monitor.erl
index a56b92b501..4c1ff02486 100644
--- a/src/rabbit_disk_monitor.erl
+++ b/src/rabbit_disk_monitor.erl
@@ -1,4 +1,4 @@
-%% The contents of this file are subject to the Mozilla Public License
+% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License
%% at http://www.mozilla.org/MPL/
@@ -70,19 +70,15 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--type(disk_free_limit() :: (integer() | string() | {'mem_relative', float()})).
--spec(start_link/1 :: (disk_free_limit()) -> rabbit_types:ok_pid_or_error()).
--spec(get_disk_free_limit/0 :: () -> integer()).
--spec(set_disk_free_limit/1 :: (disk_free_limit()) -> 'ok').
--spec(get_min_check_interval/0 :: () -> integer()).
--spec(set_min_check_interval/1 :: (integer()) -> 'ok').
--spec(get_max_check_interval/0 :: () -> integer()).
--spec(set_max_check_interval/1 :: (integer()) -> 'ok').
--spec(get_disk_free/0 :: () -> (integer() | 'unknown')).
-
--endif.
+-type disk_free_limit() :: (integer() | string() | {'mem_relative', float()}).
+-spec start_link(disk_free_limit()) -> rabbit_types:ok_pid_or_error().
+-spec get_disk_free_limit() -> integer().
+-spec set_disk_free_limit(disk_free_limit()) -> 'ok'.
+-spec get_min_check_interval() -> integer().
+-spec set_min_check_interval(integer()) -> 'ok'.
+-spec get_max_check_interval() -> integer().
+-spec set_max_check_interval(integer()) -> 'ok'.
+-spec get_disk_free() -> (integer() | 'unknown').
%%----------------------------------------------------------------------------
%% Public API
diff --git a/src/rabbit_epmd_monitor.erl b/src/rabbit_epmd_monitor.erl
index d95ec49140..7f01a71838 100644
--- a/src/rabbit_epmd_monitor.erl
+++ b/src/rabbit_epmd_monitor.erl
@@ -30,11 +30,7 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
-
--endif.
+-spec start_link() -> rabbit_types:ok_pid_or_error().
%%----------------------------------------------------------------------------
%% It's possible for epmd to be killed out from underneath us. If that
diff --git a/src/rabbit_error_logger.erl b/src/rabbit_error_logger.erl
index 20af0c21a1..5ba3ce7a4f 100644
--- a/src/rabbit_error_logger.erl
+++ b/src/rabbit_error_logger.erl
@@ -31,12 +31,8 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start/0 :: () -> 'ok').
--spec(stop/0 :: () -> 'ok').
-
--endif.
+-spec start() -> 'ok'.
+-spec stop() -> 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl
index 2e9afbfd2e..aaea27f91a 100644
--- a/src/rabbit_exchange.erl
+++ b/src/rabbit_exchange.erl
@@ -29,78 +29,74 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-export_type([name/0, type/0]).
--type(name() :: rabbit_types:r('exchange')).
--type(type() :: atom()).
--type(fun_name() :: atom()).
+-type name() :: rabbit_types:r('exchange').
+-type type() :: atom().
+-type fun_name() :: atom().
--spec(recover/0 :: () -> [name()]).
--spec(callback/4::
+-spec recover() -> [name()].
+-spec callback
(rabbit_types:exchange(), fun_name(),
- fun((boolean()) -> non_neg_integer()) | atom(), [any()]) -> 'ok').
--spec(policy_changed/2 ::
- (rabbit_types:exchange(), rabbit_types:exchange()) -> 'ok').
--spec(declare/6 ::
+ fun((boolean()) -> non_neg_integer()) | atom(), [any()]) -> 'ok'.
+-spec policy_changed
+ (rabbit_types:exchange(), rabbit_types:exchange()) -> 'ok'.
+-spec declare
(name(), type(), boolean(), boolean(), boolean(),
rabbit_framing:amqp_table())
- -> rabbit_types:exchange()).
--spec(check_type/1 ::
- (binary()) -> atom() | rabbit_types:connection_exit()).
--spec(assert_equivalence/6 ::
+ -> rabbit_types:exchange().
+-spec check_type
+ (binary()) -> atom() | rabbit_types:connection_exit().
+-spec assert_equivalence
(rabbit_types:exchange(), atom(), boolean(), boolean(), boolean(),
rabbit_framing:amqp_table())
- -> 'ok' | rabbit_types:connection_exit()).
--spec(assert_args_equivalence/2 ::
+ -> 'ok' | rabbit_types:connection_exit().
+-spec assert_args_equivalence
(rabbit_types:exchange(), rabbit_framing:amqp_table())
- -> 'ok' | rabbit_types:connection_exit()).
--spec(lookup/1 ::
+ -> 'ok' | rabbit_types:connection_exit().
+-spec lookup
(name()) -> rabbit_types:ok(rabbit_types:exchange()) |
- rabbit_types:error('not_found')).
--spec(lookup_or_die/1 ::
+ rabbit_types:error('not_found').
+-spec lookup_or_die
(name()) -> rabbit_types:exchange() |
- rabbit_types:channel_exit()).
--spec(list/0 :: () -> [rabbit_types:exchange()]).
--spec(list/1 :: (rabbit_types:vhost()) -> [rabbit_types:exchange()]).
--spec(lookup_scratch/2 :: (name(), atom()) ->
+ rabbit_types:channel_exit().
+-spec list() -> [rabbit_types:exchange()].
+-spec list(rabbit_types:vhost()) -> [rabbit_types:exchange()].
+-spec lookup_scratch(name(), atom()) ->
rabbit_types:ok(term()) |
- rabbit_types:error('not_found')).
--spec(update_scratch/3 :: (name(), atom(), fun((any()) -> any())) -> 'ok').
--spec(update/2 ::
+ rabbit_types:error('not_found').
+-spec update_scratch(name(), atom(), fun((any()) -> any())) -> 'ok'.
+-spec update
(name(),
fun((rabbit_types:exchange()) -> rabbit_types:exchange()))
- -> not_found | rabbit_types:exchange()).
--spec(update_decorators/1 :: (name()) -> 'ok').
--spec(immutable/1 :: (rabbit_types:exchange()) -> rabbit_types:exchange()).
--spec(info_keys/0 :: () -> rabbit_types:info_keys()).
--spec(info/1 :: (rabbit_types:exchange()) -> rabbit_types:infos()).
--spec(info/2 ::
+ -> not_found | rabbit_types:exchange().
+-spec update_decorators(name()) -> 'ok'.
+-spec immutable(rabbit_types:exchange()) -> rabbit_types:exchange().
+-spec info_keys() -> rabbit_types:info_keys().
+-spec info(rabbit_types:exchange()) -> rabbit_types:infos().
+-spec info
(rabbit_types:exchange(), rabbit_types:info_keys())
- -> rabbit_types:infos()).
--spec(info_all/1 :: (rabbit_types:vhost()) -> [rabbit_types:infos()]).
--spec(info_all/2 ::(rabbit_types:vhost(), rabbit_types:info_keys())
- -> [rabbit_types:infos()]).
--spec(info_all/4 ::(rabbit_types:vhost(), rabbit_types:info_keys(),
+ -> rabbit_types:infos().
+-spec info_all(rabbit_types:vhost()) -> [rabbit_types:infos()].
+-spec info_all(rabbit_types:vhost(), rabbit_types:info_keys())
+ -> [rabbit_types:infos()].
+-spec info_all(rabbit_types:vhost(), rabbit_types:info_keys(),
reference(), pid())
- -> 'ok').
--spec(route/2 :: (rabbit_types:exchange(), rabbit_types:delivery())
- -> [rabbit_amqqueue:name()]).
--spec(delete/2 ::
+ -> 'ok'.
+-spec route(rabbit_types:exchange(), rabbit_types:delivery())
+ -> [rabbit_amqqueue:name()].
+-spec delete
(name(), 'true') -> 'ok' | rabbit_types:error('not_found' | 'in_use');
- (name(), 'false') -> 'ok' | rabbit_types:error('not_found')).
--spec(validate_binding/2 ::
+ (name(), 'false') -> 'ok' | rabbit_types:error('not_found').
+-spec validate_binding
(rabbit_types:exchange(), rabbit_types:binding())
- -> rabbit_types:ok_or_error({'binding_invalid', string(), [any()]})).
--spec(maybe_auto_delete/2::
+ -> rabbit_types:ok_or_error({'binding_invalid', string(), [any()]}).
+-spec maybe_auto_delete
(rabbit_types:exchange(), boolean())
- -> 'not_deleted' | {'deleted', rabbit_binding:deletions()}).
--spec(serial/1 :: (rabbit_types:exchange()) ->
- fun((boolean()) -> 'none' | pos_integer())).
--spec(peek_serial/1 :: (name()) -> pos_integer() | 'undefined').
-
--endif.
+ -> 'not_deleted' | {'deleted', rabbit_binding:deletions()}.
+-spec serial(rabbit_types:exchange()) ->
+ fun((boolean()) -> 'none' | pos_integer()).
+-spec peek_serial(name()) -> pos_integer() | 'undefined'.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_exchange_type_headers.erl b/src/rabbit_exchange_type_headers.erl
index 444d507c7e..196873aa22 100644
--- a/src/rabbit_exchange_type_headers.erl
+++ b/src/rabbit_exchange_type_headers.erl
@@ -32,10 +32,9 @@
{requires, rabbit_registry},
{enables, kernel_ready}]}).
--ifdef(use_specs).
--spec(headers_match/2 :: (rabbit_framing:amqp_table(),
- rabbit_framing:amqp_table()) -> boolean()).
--endif.
+-spec headers_match
+ (rabbit_framing:amqp_table(), rabbit_framing:amqp_table()) ->
+ boolean().
description() ->
[{description, <<"AMQP headers exchange, as per the AMQP specification">>}].
diff --git a/src/rabbit_exchange_type_invalid.erl b/src/rabbit_exchange_type_invalid.erl
index c8ca7ecae4..2510c8a241 100644
--- a/src/rabbit_exchange_type_invalid.erl
+++ b/src/rabbit_exchange_type_invalid.erl
@@ -31,10 +31,8 @@ description() ->
serialise_events() -> false.
--ifdef(use_specs).
--spec(route/2 :: (rabbit_types:exchange(), rabbit_types:delivery())
- -> no_return()).
--endif.
+-spec route(rabbit_types:exchange(), rabbit_types:delivery()) -> no_return().
+
route(#exchange{name = Name, type = Type}, _) ->
rabbit_misc:protocol_error(
precondition_failed,
diff --git a/src/rabbit_file.erl b/src/rabbit_file.erl
index 1088f2c2dd..878b9da7a7 100644
--- a/src/rabbit_file.erl
+++ b/src/rabbit_file.erl
@@ -31,37 +31,30 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--type(ok_or_error() :: rabbit_types:ok_or_error(any())).
-
--spec(is_file/1 :: ((file:filename())) -> boolean()).
--spec(is_dir/1 :: ((file:filename())) -> boolean()).
--spec(file_size/1 :: ((file:filename())) -> non_neg_integer()).
--spec(ensure_dir/1 :: ((file:filename())) -> ok_or_error()).
--spec(wildcard/2 :: (string(), file:filename()) -> [file:filename()]).
--spec(list_dir/1 :: (file:filename()) -> rabbit_types:ok_or_error2(
- [file:filename()], any())).
--spec(read_term_file/1 ::
- (file:filename()) -> {'ok', [any()]} | rabbit_types:error(any())).
--spec(write_term_file/2 :: (file:filename(), [any()]) -> ok_or_error()).
--spec(write_file/2 :: (file:filename(), iodata()) -> ok_or_error()).
--spec(write_file/3 :: (file:filename(), iodata(), [any()]) -> ok_or_error()).
--spec(append_file/2 :: (file:filename(), string()) -> ok_or_error()).
--spec(ensure_parent_dirs_exist/1 :: (string()) -> 'ok').
--spec(rename/2 ::
- (file:filename(), file:filename()) -> ok_or_error()).
--spec(delete/1 :: ([file:filename()]) -> ok_or_error()).
--spec(recursive_delete/1 ::
- ([file:filename()])
- -> rabbit_types:ok_or_error({file:filename(), any()})).
--spec(recursive_copy/2 ::
- (file:filename(), file:filename())
- -> rabbit_types:ok_or_error({file:filename(), file:filename(), any()})).
--spec(lock_file/1 :: (file:filename()) -> rabbit_types:ok_or_error('eexist')).
--spec(filename_as_a_directory/1 :: (file:filename()) -> file:filename()).
-
--endif.
+-type ok_or_error() :: rabbit_types:ok_or_error(any()).
+
+-spec is_file((file:filename())) -> boolean().
+-spec is_dir((file:filename())) -> boolean().
+-spec file_size((file:filename())) -> non_neg_integer().
+-spec ensure_dir((file:filename())) -> ok_or_error().
+-spec wildcard(string(), file:filename()) -> [file:filename()].
+-spec list_dir(file:filename()) ->
+ rabbit_types:ok_or_error2([file:filename()], any()).
+-spec read_term_file
+ (file:filename()) -> {'ok', [any()]} | rabbit_types:error(any()).
+-spec write_term_file(file:filename(), [any()]) -> ok_or_error().
+-spec write_file(file:filename(), iodata()) -> ok_or_error().
+-spec write_file(file:filename(), iodata(), [any()]) -> ok_or_error().
+-spec append_file(file:filename(), string()) -> ok_or_error().
+-spec ensure_parent_dirs_exist(string()) -> 'ok'.
+-spec rename(file:filename(), file:filename()) -> ok_or_error().
+-spec delete([file:filename()]) -> ok_or_error().
+-spec recursive_delete([file:filename()]) ->
+ rabbit_types:ok_or_error({file:filename(), any()}).
+-spec recursive_copy(file:filename(), file:filename()) ->
+ rabbit_types:ok_or_error({file:filename(), file:filename(), any()}).
+-spec lock_file(file:filename()) -> rabbit_types:ok_or_error('eexist').
+-spec filename_as_a_directory(file:filename()) -> file:filename().
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_framing.erl b/src/rabbit_framing.erl
index e5b54dc4e0..e4a5013003 100644
--- a/src/rabbit_framing.erl
+++ b/src/rabbit_framing.erl
@@ -18,8 +18,6 @@
-module(rabbit_framing).
--ifdef(use_specs).
-
-export_type([protocol/0,
amqp_field_type/0, amqp_property_type/0,
amqp_table/0, amqp_array/0, amqp_value/0,
@@ -27,7 +25,7 @@
amqp_method_field_name/0, amqp_property_record/0,
amqp_exception/0, amqp_exception_code/0, amqp_class_id/0]).
--type(protocol() :: 'rabbit_framing_amqp_0_8' | 'rabbit_framing_amqp_0_9_1').
+-type protocol() :: 'rabbit_framing_amqp_0_8' | 'rabbit_framing_amqp_0_9_1'.
-define(protocol_type(T), type(T :: rabbit_framing_amqp_0_8:T |
rabbit_framing_amqp_0_9_1:T)).
@@ -45,5 +43,3 @@
-?protocol_type(amqp_exception()).
-?protocol_type(amqp_exception_code()).
-?protocol_type(amqp_class_id()).
-
--endif.
diff --git a/src/rabbit_guid.erl b/src/rabbit_guid.erl
index 4d2b450409..75f9df7b3f 100644
--- a/src/rabbit_guid.erl
+++ b/src/rabbit_guid.erl
@@ -32,20 +32,16 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-export_type([guid/0]).
--type(guid() :: binary()).
-
--spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
--spec(filename/0 :: () -> string()).
--spec(gen/0 :: () -> guid()).
--spec(gen_secure/0 :: () -> guid()).
--spec(string/2 :: (guid(), any()) -> string()).
--spec(binary/2 :: (guid(), any()) -> binary()).
+-type guid() :: binary().
--endif.
+-spec start_link() -> rabbit_types:ok_pid_or_error().
+-spec filename() -> string().
+-spec gen() -> guid().
+-spec gen_secure() -> guid().
+-spec string(guid(), any()) -> string().
+-spec binary(guid(), any()) -> binary().
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_limiter.erl b/src/rabbit_limiter.erl
index 0a2b8c5fc6..94620416d6 100644
--- a/src/rabbit_limiter.erl
+++ b/src/rabbit_limiter.erl
@@ -140,44 +140,42 @@
-record(lstate, {pid, prefetch_limited}).
-record(qstate, {pid, state, credits}).
--ifdef(use_specs).
-
--type(lstate() :: #lstate{pid :: pid(),
- prefetch_limited :: boolean()}).
--type(qstate() :: #qstate{pid :: pid(),
- state :: 'dormant' | 'active' | 'suspended'}).
-
--type(credit_mode() :: 'manual' | 'drain' | 'auto').
-
--spec(start_link/1 :: (rabbit_types:proc_name()) ->
- rabbit_types:ok_pid_or_error()).
--spec(new/1 :: (pid()) -> lstate()).
-
--spec(limit_prefetch/3 :: (lstate(), non_neg_integer(), non_neg_integer())
- -> lstate()).
--spec(unlimit_prefetch/1 :: (lstate()) -> lstate()).
--spec(is_active/1 :: (lstate()) -> boolean()).
--spec(get_prefetch_limit/1 :: (lstate()) -> non_neg_integer()).
--spec(ack/2 :: (lstate(), non_neg_integer()) -> 'ok').
--spec(pid/1 :: (lstate()) -> pid()).
-
--spec(client/1 :: (pid()) -> qstate()).
--spec(activate/1 :: (qstate()) -> qstate()).
--spec(can_send/3 :: (qstate(), boolean(), rabbit_types:ctag()) ->
- {'continue' | 'suspend', qstate()}).
--spec(resume/1 :: (qstate()) -> qstate()).
--spec(deactivate/1 :: (qstate()) -> qstate()).
--spec(is_suspended/1 :: (qstate()) -> boolean()).
--spec(is_consumer_blocked/2 :: (qstate(), rabbit_types:ctag()) -> boolean()).
--spec(credit/5 :: (qstate(), rabbit_types:ctag(), non_neg_integer(),
- credit_mode(), boolean()) -> {boolean(), qstate()}).
--spec(ack_from_queue/3 :: (qstate(), rabbit_types:ctag(), non_neg_integer())
- -> {boolean(), qstate()}).
--spec(drained/1 :: (qstate())
- -> {[{rabbit_types:ctag(), non_neg_integer()}], qstate()}).
--spec(forget_consumer/2 :: (qstate(), rabbit_types:ctag()) -> qstate()).
-
--endif.
+-type lstate() :: #lstate{pid :: pid(),
+ prefetch_limited :: boolean()}.
+-type qstate() :: #qstate{pid :: pid(),
+ state :: 'dormant' | 'active' | 'suspended'}.
+
+-type credit_mode() :: 'manual' | 'drain' | 'auto'.
+
+-spec start_link(rabbit_types:proc_name()) ->
+ rabbit_types:ok_pid_or_error().
+-spec new(pid()) -> lstate().
+
+-spec limit_prefetch(lstate(), non_neg_integer(), non_neg_integer()) ->
+ lstate().
+-spec unlimit_prefetch(lstate()) -> lstate().
+-spec is_active(lstate()) -> boolean().
+-spec get_prefetch_limit(lstate()) -> non_neg_integer().
+-spec ack(lstate(), non_neg_integer()) -> 'ok'.
+-spec pid(lstate()) -> pid().
+
+-spec client(pid()) -> qstate().
+-spec activate(qstate()) -> qstate().
+-spec can_send(qstate(), boolean(), rabbit_types:ctag()) ->
+ {'continue' | 'suspend', qstate()}.
+-spec resume(qstate()) -> qstate().
+-spec deactivate(qstate()) -> qstate().
+-spec is_suspended(qstate()) -> boolean().
+-spec is_consumer_blocked(qstate(), rabbit_types:ctag()) -> boolean().
+-spec credit
+ (qstate(), rabbit_types:ctag(), non_neg_integer(), credit_mode(),
+ boolean()) ->
+ {boolean(), qstate()}.
+-spec ack_from_queue(qstate(), rabbit_types:ctag(), non_neg_integer()) ->
+ {boolean(), qstate()}.
+-spec drained(qstate()) ->
+ {[{rabbit_types:ctag(), non_neg_integer()}], qstate()}.
+-spec forget_consumer(qstate(), rabbit_types:ctag()) -> qstate().
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_log.erl b/src/rabbit_log.erl
index 5b5468cab7..337fb23f84 100644
--- a/src/rabbit_log.erl
+++ b/src/rabbit_log.erl
@@ -22,28 +22,24 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-export_type([level/0]).
--type(category() :: atom()).
--type(level() :: 'debug' | 'info' | 'warning' | 'error').
-
--spec(log/3 :: (category(), level(), string()) -> 'ok').
--spec(log/4 :: (category(), level(), string(), [any()]) -> 'ok').
+-type category() :: atom().
+-type level() :: 'debug' | 'info' | 'warning' | 'error'.
--spec(debug/1 :: (string()) -> 'ok').
--spec(debug/2 :: (string(), [any()]) -> 'ok').
--spec(info/1 :: (string()) -> 'ok').
--spec(info/2 :: (string(), [any()]) -> 'ok').
--spec(warning/1 :: (string()) -> 'ok').
--spec(warning/2 :: (string(), [any()]) -> 'ok').
--spec(error/1 :: (string()) -> 'ok').
--spec(error/2 :: (string(), [any()]) -> 'ok').
+-spec log(category(), level(), string()) -> 'ok'.
+-spec log(category(), level(), string(), [any()]) -> 'ok'.
--spec(with_local_io/1 :: (fun (() -> A)) -> A).
+-spec debug(string()) -> 'ok'.
+-spec debug(string(), [any()]) -> 'ok'.
+-spec info(string()) -> 'ok'.
+-spec info(string(), [any()]) -> 'ok'.
+-spec warning(string()) -> 'ok'.
+-spec warning(string(), [any()]) -> 'ok'.
+-spec error(string()) -> 'ok'.
+-spec error(string(), [any()]) -> 'ok'.
--endif.
+-spec with_local_io(fun (() -> A)) -> A.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_memory_monitor.erl b/src/rabbit_memory_monitor.erl
index 5e515bfb03..6fd12b30ff 100644
--- a/src/rabbit_memory_monitor.erl
+++ b/src/rabbit_memory_monitor.erl
@@ -55,16 +55,12 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
--spec(register/2 :: (pid(), {atom(),atom(),[any()]}) -> 'ok').
--spec(deregister/1 :: (pid()) -> 'ok').
--spec(report_ram_duration/2 ::
- (pid(), float() | 'infinity') -> number() | 'infinity').
--spec(stop/0 :: () -> 'ok').
-
--endif.
+-spec start_link() -> rabbit_types:ok_pid_or_error().
+-spec register(pid(), {atom(),atom(),[any()]}) -> 'ok'.
+-spec deregister(pid()) -> 'ok'.
+-spec report_ram_duration
+ (pid(), float() | 'infinity') -> number() | 'infinity'.
+-spec stop() -> 'ok'.
%%----------------------------------------------------------------------------
%% Public API
diff --git a/src/rabbit_mirror_queue_coordinator.erl b/src/rabbit_mirror_queue_coordinator.erl
index 1679767286..221f11f18a 100644
--- a/src/rabbit_mirror_queue_coordinator.erl
+++ b/src/rabbit_mirror_queue_coordinator.erl
@@ -36,16 +36,13 @@
depth_fun
}).
--ifdef(use_specs).
-
--spec(start_link/4 :: (rabbit_types:amqqueue(), pid() | 'undefined',
- rabbit_mirror_queue_master:death_fun(),
- rabbit_mirror_queue_master:depth_fun()) ->
- rabbit_types:ok_pid_or_error()).
--spec(get_gm/1 :: (pid()) -> pid()).
--spec(ensure_monitoring/2 :: (pid(), [pid()]) -> 'ok').
-
--endif.
+-spec start_link
+ (rabbit_types:amqqueue(), pid() | 'undefined',
+ rabbit_mirror_queue_master:death_fun(),
+ rabbit_mirror_queue_master:depth_fun()) ->
+ rabbit_types:ok_pid_or_error().
+-spec get_gm(pid()) -> pid().
+-spec ensure_monitoring(pid(), [pid()]) -> 'ok'.
%%----------------------------------------------------------------------------
%%
diff --git a/src/rabbit_mirror_queue_master.erl b/src/rabbit_mirror_queue_master.erl
index 9674a4ef2c..d081b15bc7 100644
--- a/src/rabbit_mirror_queue_master.erl
+++ b/src/rabbit_mirror_queue_master.erl
@@ -47,14 +47,12 @@
wait_timeout
}).
--ifdef(use_specs).
-
-export_type([death_fun/0, depth_fun/0, stats_fun/0]).
--type(death_fun() :: fun ((pid()) -> 'ok')).
--type(depth_fun() :: fun (() -> 'ok')).
--type(stats_fun() :: fun ((any()) -> 'ok')).
--type(master_state() :: #state { name :: rabbit_amqqueue:name(),
+-type death_fun() :: fun ((pid()) -> 'ok').
+-type depth_fun() :: fun (() -> 'ok').
+-type stats_fun() :: fun ((any()) -> 'ok').
+-type master_state() :: #state { name :: rabbit_amqqueue:name(),
gm :: pid(),
coordinator :: pid(),
backing_queue :: atom(),
@@ -62,20 +60,19 @@
seen_status :: dict:dict(),
confirmed :: [rabbit_guid:guid()],
known_senders :: sets:set()
- }).
+ }.
--spec(promote_backing_queue_state/8 ::
+-spec promote_backing_queue_state
(rabbit_amqqueue:name(), pid(), atom(), any(), pid(), [any()],
- dict:dict(), [pid()]) -> master_state()).
--spec(sender_death_fun/0 :: () -> death_fun()).
--spec(depth_fun/0 :: () -> depth_fun()).
--spec(init_with_existing_bq/3 :: (rabbit_types:amqqueue(), atom(), any()) ->
- master_state()).
--spec(stop_mirroring/1 :: (master_state()) -> {atom(), any()}).
--spec(sync_mirrors/3 :: (stats_fun(), stats_fun(), master_state()) ->
- {'ok', master_state()} | {stop, any(), master_state()}).
-
--endif.
+ dict:dict(), [pid()]) ->
+ master_state().
+-spec sender_death_fun() -> death_fun().
+-spec depth_fun() -> depth_fun().
+-spec init_with_existing_bq(rabbit_types:amqqueue(), atom(), any()) ->
+ master_state().
+-spec stop_mirroring(master_state()) -> {atom(), any()}.
+-spec sync_mirrors(stats_fun(), stats_fun(), master_state()) ->
+ {'ok', master_state()} | {stop, any(), master_state()}.
%% For general documentation of HA design, see
%% rabbit_mirror_queue_coordinator
diff --git a/src/rabbit_mirror_queue_misc.erl b/src/rabbit_mirror_queue_misc.erl
index fad20711aa..83350920e6 100644
--- a/src/rabbit_mirror_queue_misc.erl
+++ b/src/rabbit_mirror_queue_misc.erl
@@ -50,28 +50,24 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(remove_from_queue/3 ::
- (rabbit_amqqueue:name(), pid(), [pid()])
- -> {'ok', pid(), [pid()], [node()]} | {'error', 'not_found'}).
--spec(on_node_up/0 :: () -> 'ok').
--spec(add_mirrors/3 :: (rabbit_amqqueue:name(), [node()], 'sync' | 'async')
- -> 'ok').
--spec(store_updated_slaves/1 :: (rabbit_types:amqqueue()) ->
- rabbit_types:amqqueue()).
--spec(initial_queue_node/2 :: (rabbit_types:amqqueue(), node()) -> node()).
--spec(suggested_queue_nodes/1 :: (rabbit_types:amqqueue()) ->
- {node(), [node()]}).
--spec(is_mirrored/1 :: (rabbit_types:amqqueue()) -> boolean()).
--spec(update_mirrors/2 ::
- (rabbit_types:amqqueue(), rabbit_types:amqqueue()) -> 'ok').
--spec(maybe_drop_master_after_sync/1 :: (rabbit_types:amqqueue()) -> 'ok').
--spec(maybe_auto_sync/1 :: (rabbit_types:amqqueue()) -> 'ok').
--spec(log_info/3 :: (rabbit_amqqueue:name(), string(), [any()]) -> 'ok').
--spec(log_warning/3 :: (rabbit_amqqueue:name(), string(), [any()]) -> 'ok').
-
--endif.
+-spec remove_from_queue
+ (rabbit_amqqueue:name(), pid(), [pid()]) ->
+ {'ok', pid(), [pid()], [node()]} | {'error', 'not_found'}.
+-spec on_node_up() -> 'ok'.
+-spec add_mirrors(rabbit_amqqueue:name(), [node()], 'sync' | 'async') ->
+ 'ok'.
+-spec store_updated_slaves(rabbit_types:amqqueue()) ->
+ rabbit_types:amqqueue().
+-spec initial_queue_node(rabbit_types:amqqueue(), node()) -> node().
+-spec suggested_queue_nodes(rabbit_types:amqqueue()) ->
+ {node(), [node()]}.
+-spec is_mirrored(rabbit_types:amqqueue()) -> boolean().
+-spec update_mirrors
+ (rabbit_types:amqqueue(), rabbit_types:amqqueue()) -> 'ok'.
+-spec maybe_drop_master_after_sync(rabbit_types:amqqueue()) -> 'ok'.
+-spec maybe_auto_sync(rabbit_types:amqqueue()) -> 'ok'.
+-spec log_info(rabbit_amqqueue:name(), string(), [any()]) -> 'ok'.
+-spec log_warning(rabbit_amqqueue:name(), string(), [any()]) -> 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_mirror_queue_mode.erl b/src/rabbit_mirror_queue_mode.erl
index 5bb243746a..3733c7f0f8 100644
--- a/src/rabbit_mirror_queue_mode.erl
+++ b/src/rabbit_mirror_queue_mode.erl
@@ -16,11 +16,9 @@
-module(rabbit_mirror_queue_mode).
--ifdef(use_specs).
-
--type(master() :: node()).
--type(slave() :: node()).
--type(params() :: any()).
+-type master() :: node().
+-type slave() :: node().
+-type params() :: any().
-callback description() -> [proplists:property()].
@@ -44,14 +42,3 @@
%% Are the parameters valid for this mode?
-callback validate_policy(params()) ->
rabbit_policy_validator:validate_results().
-
--else.
-
--export([behaviour_info/1]).
-
-behaviour_info(callbacks) ->
- [{description, 0}, {suggested_queue_nodes, 5}, {validate_policy, 1}];
-behaviour_info(_Other) ->
- undefined.
-
--endif.
diff --git a/src/rabbit_mirror_queue_slave.erl b/src/rabbit_mirror_queue_slave.erl
index c04c82f45e..6f46cdc698 100644
--- a/src/rabbit_mirror_queue_slave.erl
+++ b/src/rabbit_mirror_queue_slave.erl
@@ -542,9 +542,8 @@ confirm_messages(MsgIds, State = #state { msg_id_status = MS }) ->
handle_process_result({ok, State}) -> noreply(State);
handle_process_result({stop, State}) -> {stop, normal, State}.
--ifdef(use_specs).
--spec(promote_me/2 :: ({pid(), term()}, #state{}) -> no_return()).
--endif.
+-spec promote_me({pid(), term()}, #state{}) -> no_return().
+
promote_me(From, #state { q = Q = #amqqueue { name = QName },
gm = GM,
backing_queue = BQ,
diff --git a/src/rabbit_mirror_queue_sync.erl b/src/rabbit_mirror_queue_sync.erl
index a97a9b50c8..54f0855fce 100644
--- a/src/rabbit_mirror_queue_sync.erl
+++ b/src/rabbit_mirror_queue_sync.erl
@@ -52,32 +52,28 @@
%% || || -- sync_complete --> ||
%% || (Dies) ||
--ifdef(use_specs).
-
--type(log_fun() :: fun ((string(), [any()]) -> 'ok')).
--type(bq() :: atom()).
--type(bqs() :: any()).
--type(ack() :: any()).
--type(slave_sync_state() :: {[{rabbit_types:msg_id(), ack()}], timer:tref(),
- bqs()}).
-
--spec(master_prepare/4 :: (reference(), rabbit_amqqueue:name(),
- log_fun(), [pid()]) -> pid()).
--spec(master_go/8 :: (pid(), reference(), log_fun(),
+-type log_fun() :: fun ((string(), [any()]) -> 'ok').
+-type bq() :: atom().
+-type bqs() :: any().
+-type ack() :: any().
+-type slave_sync_state() :: {[{rabbit_types:msg_id(), ack()}], timer:tref(),
+ bqs()}.
+
+-spec master_prepare(reference(), rabbit_amqqueue:name(),
+ log_fun(), [pid()]) -> pid().
+-spec master_go(pid(), reference(), log_fun(),
rabbit_mirror_queue_master:stats_fun(),
rabbit_mirror_queue_master:stats_fun(),
non_neg_integer(),
bq(), bqs()) ->
{'already_synced', bqs()} | {'ok', bqs()} |
{'shutdown', any(), bqs()} |
- {'sync_died', any(), bqs()}).
--spec(slave/7 :: (non_neg_integer(), reference(), timer:tref(), pid(),
+ {'sync_died', any(), bqs()}.
+-spec slave(non_neg_integer(), reference(), timer:tref(), pid(),
bq(), bqs(), fun((bq(), bqs()) -> {timer:tref(), bqs()})) ->
'denied' |
{'ok' | 'failed', slave_sync_state()} |
- {'stop', any(), slave_sync_state()}).
-
--endif.
+ {'stop', any(), slave_sync_state()}.
%% ---------------------------------------------------------------------------
%% Master
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index 6a57f6bb2c..c327b33e5d 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -50,48 +50,44 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-export_type([node_type/0, cluster_status/0]).
--type(node_type() :: disc | ram).
--type(cluster_status() :: {[node()], [node()], [node()]}).
+-type node_type() :: disc | ram.
+-type cluster_status() :: {[node()], [node()], [node()]}.
%% Main interface
--spec(init/0 :: () -> 'ok').
--spec(join_cluster/2 :: (node(), node_type())
- -> 'ok' | {'ok', 'already_member'}).
--spec(reset/0 :: () -> 'ok').
--spec(force_reset/0 :: () -> 'ok').
--spec(update_cluster_nodes/1 :: (node()) -> 'ok').
--spec(change_cluster_node_type/1 :: (node_type()) -> 'ok').
--spec(forget_cluster_node/2 :: (node(), boolean()) -> 'ok').
--spec(force_load_next_boot/0 :: () -> 'ok').
+-spec init() -> 'ok'.
+-spec join_cluster(node(), node_type())
+ -> 'ok' | {'ok', 'already_member'}.
+-spec reset() -> 'ok'.
+-spec force_reset() -> 'ok'.
+-spec update_cluster_nodes(node()) -> 'ok'.
+-spec change_cluster_node_type(node_type()) -> 'ok'.
+-spec forget_cluster_node(node(), boolean()) -> 'ok'.
+-spec force_load_next_boot() -> 'ok'.
%% Various queries to get the status of the db
--spec(status/0 :: () -> [{'nodes', [{node_type(), [node()]}]} |
+-spec status() -> [{'nodes', [{node_type(), [node()]}]} |
{'running_nodes', [node()]} |
- {'partitions', [{node(), [node()]}]}]).
--spec(is_clustered/0 :: () -> boolean()).
--spec(on_running_node/1 :: (pid()) -> boolean()).
--spec(is_process_alive/1 :: (pid()) -> boolean()).
--spec(cluster_nodes/1 :: ('all' | 'disc' | 'ram' | 'running') -> [node()]).
--spec(node_type/0 :: () -> node_type()).
--spec(dir/0 :: () -> file:filename()).
--spec(cluster_status_from_mnesia/0 :: () -> rabbit_types:ok_or_error2(
- cluster_status(), any())).
+ {'partitions', [{node(), [node()]}]}].
+-spec is_clustered() -> boolean().
+-spec on_running_node(pid()) -> boolean().
+-spec is_process_alive(pid()) -> boolean().
+-spec cluster_nodes('all' | 'disc' | 'ram' | 'running') -> [node()].
+-spec node_type() -> node_type().
+-spec dir() -> file:filename().
+-spec cluster_status_from_mnesia() -> rabbit_types:ok_or_error2(
+ cluster_status(), any()).
%% Operations on the db and utils, mainly used in `rabbit_upgrade' and `rabbit'
--spec(init_db_unchecked/2 :: ([node()], node_type()) -> 'ok').
--spec(copy_db/1 :: (file:filename()) -> rabbit_types:ok_or_error(any())).
--spec(check_cluster_consistency/0 :: () -> 'ok').
--spec(ensure_mnesia_dir/0 :: () -> 'ok').
+-spec init_db_unchecked([node()], node_type()) -> 'ok'.
+-spec copy_db(file:filename()) -> rabbit_types:ok_or_error(any()).
+-spec check_cluster_consistency() -> 'ok'.
+-spec ensure_mnesia_dir() -> 'ok'.
%% Hooks used in `rabbit_node_monitor'
--spec(on_node_up/1 :: (node()) -> 'ok').
--spec(on_node_down/1 :: (node()) -> 'ok').
-
--endif.
+-spec on_node_up(node()) -> 'ok'.
+-spec on_node_down(node()) -> 'ok'.
%%----------------------------------------------------------------------------
%% Main interface
diff --git a/src/rabbit_mnesia_rename.erl b/src/rabbit_mnesia_rename.erl
index 1ece103cec..0945e31522 100644
--- a/src/rabbit_mnesia_rename.erl
+++ b/src/rabbit_mnesia_rename.erl
@@ -43,12 +43,8 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(rename/2 :: (node(), [{node(), node()}]) -> 'ok').
--spec(maybe_finish/1 :: ([node()]) -> 'ok').
-
--endif.
+-spec rename(node(), [{node(), node()}]) -> 'ok'.
+-spec maybe_finish([node()]) -> 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_msg_file.erl b/src/rabbit_msg_file.erl
index 09a2407bec..5c0acc5ffd 100644
--- a/src/rabbit_msg_file.erl
+++ b/src/rabbit_msg_file.erl
@@ -33,25 +33,21 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--type(io_device() :: any()).
--type(position() :: non_neg_integer()).
--type(msg_size() :: non_neg_integer()).
--type(file_size() :: non_neg_integer()).
--type(message_accumulator(A) ::
+-type io_device() :: any().
+-type position() :: non_neg_integer().
+-type msg_size() :: non_neg_integer().
+-type file_size() :: non_neg_integer().
+-type message_accumulator(A) ::
fun (({rabbit_types:msg_id(), msg_size(), position(), binary()}, A) ->
- A)).
-
--spec(append/3 :: (io_device(), rabbit_types:msg_id(), msg()) ->
- rabbit_types:ok_or_error2(msg_size(), any())).
--spec(read/2 :: (io_device(), msg_size()) ->
- rabbit_types:ok_or_error2({rabbit_types:msg_id(), msg()},
- any())).
--spec(scan/4 :: (io_device(), file_size(), message_accumulator(A), A) ->
- {'ok', A, position()}).
-
--endif.
+ A).
+
+-spec append(io_device(), rabbit_types:msg_id(), msg()) ->
+ rabbit_types:ok_or_error2(msg_size(), any()).
+-spec read(io_device(), msg_size()) ->
+ rabbit_types:ok_or_error2({rabbit_types:msg_id(), msg()},
+ any()).
+-spec scan(io_device(), file_size(), message_accumulator(A), A) ->
+ {'ok', A, position()}.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl
index 2300664687..2a6e2cd103 100644
--- a/src/rabbit_msg_store.erl
+++ b/src/rabbit_msg_store.erl
@@ -133,22 +133,20 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-export_type([gc_state/0, file_num/0]).
--type(gc_state() :: #gc_state { dir :: file:filename(),
+-type gc_state() :: #gc_state { dir :: file:filename(),
index_module :: atom(),
index_state :: any(),
file_summary_ets :: ets:tid(),
file_handles_ets :: ets:tid(),
msg_store :: server()
- }).
+ }.
--type(server() :: pid() | atom()).
--type(client_ref() :: binary()).
--type(file_num() :: non_neg_integer()).
--type(client_msstate() :: #client_msstate {
+-type server() :: pid() | atom().
+-type client_ref() :: binary().
+-type file_num() :: non_neg_integer().
+-type client_msstate() :: #client_msstate {
server :: server(),
client_ref :: client_ref(),
file_handle_cache :: dict:dict(),
@@ -160,43 +158,41 @@
file_summary_ets :: ets:tid(),
cur_file_cache_ets :: ets:tid(),
flying_ets :: ets:tid(),
- credit_disc_bound :: {pos_integer(), pos_integer()}}).
--type(msg_ref_delta_gen(A) ::
+ credit_disc_bound :: {pos_integer(), pos_integer()}}.
+-type msg_ref_delta_gen(A) ::
fun ((A) -> 'finished' |
- {rabbit_types:msg_id(), non_neg_integer(), A})).
--type(maybe_msg_id_fun() ::
- 'undefined' | fun ((gb_sets:set(), 'written' | 'ignored') -> any())).
--type(maybe_close_fds_fun() :: 'undefined' | fun (() -> 'ok')).
--type(deletion_thunk() :: fun (() -> boolean())).
+ {rabbit_types:msg_id(), non_neg_integer(), A}).
+-type maybe_msg_id_fun() ::
+ 'undefined' | fun ((gb_sets:set(), 'written' | 'ignored') -> any()).
+-type maybe_close_fds_fun() :: 'undefined' | fun (() -> 'ok').
+-type deletion_thunk() :: fun (() -> boolean()).
--spec(start_link/4 ::
+-spec start_link
(atom(), file:filename(), [binary()] | 'undefined',
- {msg_ref_delta_gen(A), A}) -> rabbit_types:ok_pid_or_error()).
--spec(successfully_recovered_state/1 :: (server()) -> boolean()).
--spec(client_init/4 :: (server(), client_ref(), maybe_msg_id_fun(),
- maybe_close_fds_fun()) -> client_msstate()).
--spec(client_terminate/1 :: (client_msstate()) -> 'ok').
--spec(client_delete_and_terminate/1 :: (client_msstate()) -> 'ok').
--spec(client_ref/1 :: (client_msstate()) -> client_ref()).
--spec(close_all_indicated/1 ::
- (client_msstate()) -> rabbit_types:ok(client_msstate())).
--spec(write/3 :: (rabbit_types:msg_id(), msg(), client_msstate()) -> 'ok').
--spec(write_flow/3 :: (rabbit_types:msg_id(), msg(), client_msstate()) -> 'ok').
--spec(read/2 :: (rabbit_types:msg_id(), client_msstate()) ->
- {rabbit_types:ok(msg()) | 'not_found', client_msstate()}).
--spec(contains/2 :: (rabbit_types:msg_id(), client_msstate()) -> boolean()).
--spec(remove/2 :: ([rabbit_types:msg_id()], client_msstate()) -> 'ok').
-
--spec(set_maximum_since_use/2 :: (server(), non_neg_integer()) -> 'ok').
--spec(has_readers/2 :: (non_neg_integer(), gc_state()) -> boolean()).
--spec(combine_files/3 :: (non_neg_integer(), non_neg_integer(), gc_state()) ->
- deletion_thunk()).
--spec(delete_file/2 :: (non_neg_integer(), gc_state()) -> deletion_thunk()).
--spec(force_recovery/2 :: (file:filename(), server()) -> 'ok').
--spec(transform_dir/3 :: (file:filename(), server(),
- fun ((any()) -> (rabbit_types:ok_or_error2(msg(), any())))) -> 'ok').
-
--endif.
+ {msg_ref_delta_gen(A), A}) -> rabbit_types:ok_pid_or_error().
+-spec successfully_recovered_state(server()) -> boolean().
+-spec client_init(server(), client_ref(), maybe_msg_id_fun(),
+ maybe_close_fds_fun()) -> client_msstate().
+-spec client_terminate(client_msstate()) -> 'ok'.
+-spec client_delete_and_terminate(client_msstate()) -> 'ok'.
+-spec client_ref(client_msstate()) -> client_ref().
+-spec close_all_indicated
+ (client_msstate()) -> rabbit_types:ok(client_msstate()).
+-spec write(rabbit_types:msg_id(), msg(), client_msstate()) -> 'ok'.
+-spec write_flow(rabbit_types:msg_id(), msg(), client_msstate()) -> 'ok'.
+-spec read(rabbit_types:msg_id(), client_msstate()) ->
+ {rabbit_types:ok(msg()) | 'not_found', client_msstate()}.
+-spec contains(rabbit_types:msg_id(), client_msstate()) -> boolean().
+-spec remove([rabbit_types:msg_id()], client_msstate()) -> 'ok'.
+
+-spec set_maximum_since_use(server(), non_neg_integer()) -> 'ok'.
+-spec has_readers(non_neg_integer(), gc_state()) -> boolean().
+-spec combine_files(non_neg_integer(), non_neg_integer(), gc_state()) ->
+ deletion_thunk().
+-spec delete_file(non_neg_integer(), gc_state()) -> deletion_thunk().
+-spec force_recovery(file:filename(), server()) -> 'ok'.
+-spec transform_dir(file:filename(), server(),
+ fun ((any()) -> (rabbit_types:ok_or_error2(msg(), any())))) -> 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_msg_store_gc.erl b/src/rabbit_msg_store_gc.erl
index b27aaf4c84..9cfdba8a8d 100644
--- a/src/rabbit_msg_store_gc.erl
+++ b/src/rabbit_msg_store_gc.erl
@@ -35,18 +35,14 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/1 :: (rabbit_msg_store:gc_state()) ->
- rabbit_types:ok_pid_or_error()).
--spec(combine/3 :: (pid(), rabbit_msg_store:file_num(),
- rabbit_msg_store:file_num()) -> 'ok').
--spec(delete/2 :: (pid(), rabbit_msg_store:file_num()) -> 'ok').
--spec(no_readers/2 :: (pid(), rabbit_msg_store:file_num()) -> 'ok').
--spec(stop/1 :: (pid()) -> 'ok').
--spec(set_maximum_since_use/2 :: (pid(), non_neg_integer()) -> 'ok').
-
--endif.
+-spec start_link(rabbit_msg_store:gc_state()) ->
+ rabbit_types:ok_pid_or_error().
+-spec combine(pid(), rabbit_msg_store:file_num(),
+ rabbit_msg_store:file_num()) -> 'ok'.
+-spec delete(pid(), rabbit_msg_store:file_num()) -> 'ok'.
+-spec no_readers(pid(), rabbit_msg_store:file_num()) -> 'ok'.
+-spec stop(pid()) -> 'ok'.
+-spec set_maximum_since_use(pid(), non_neg_integer()) -> 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl
index 976f4a4b2f..0322aacfd1 100644
--- a/src/rabbit_node_monitor.erl
+++ b/src/rabbit_node_monitor.erl
@@ -45,35 +45,31 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
-
--spec(running_nodes_filename/0 :: () -> string()).
--spec(cluster_status_filename/0 :: () -> string()).
--spec(prepare_cluster_status_files/0 :: () -> 'ok').
--spec(write_cluster_status/1 :: (rabbit_mnesia:cluster_status()) -> 'ok').
--spec(read_cluster_status/0 :: () -> rabbit_mnesia:cluster_status()).
--spec(update_cluster_status/0 :: () -> 'ok').
--spec(reset_cluster_status/0 :: () -> 'ok').
-
--spec(notify_node_up/0 :: () -> 'ok').
--spec(notify_joined_cluster/0 :: () -> 'ok').
--spec(notify_left_cluster/1 :: (node()) -> 'ok').
-
--spec(partitions/0 :: () -> [node()]).
--spec(partitions/1 :: ([node()]) -> [{node(), [node()]}]).
--spec(status/1 :: ([node()]) -> {[{node(), [node()]}], [node()]}).
--spec(subscribe/1 :: (pid()) -> 'ok').
--spec(pause_partition_guard/0 :: () -> 'ok' | 'pausing').
-
--spec(all_rabbit_nodes_up/0 :: () -> boolean()).
--spec(run_outside_applications/2 :: (fun (() -> any()), boolean()) -> pid()).
--spec(ping_all/0 :: () -> 'ok').
--spec(alive_nodes/1 :: ([node()]) -> [node()]).
--spec(alive_rabbit_nodes/1 :: ([node()]) -> [node()]).
-
--endif.
+-spec start_link() -> rabbit_types:ok_pid_or_error().
+
+-spec running_nodes_filename() -> string().
+-spec cluster_status_filename() -> string().
+-spec prepare_cluster_status_files() -> 'ok'.
+-spec write_cluster_status(rabbit_mnesia:cluster_status()) -> 'ok'.
+-spec read_cluster_status() -> rabbit_mnesia:cluster_status().
+-spec update_cluster_status() -> 'ok'.
+-spec reset_cluster_status() -> 'ok'.
+
+-spec notify_node_up() -> 'ok'.
+-spec notify_joined_cluster() -> 'ok'.
+-spec notify_left_cluster(node()) -> 'ok'.
+
+-spec partitions() -> [node()].
+-spec partitions([node()]) -> [{node(), [node()]}].
+-spec status([node()]) -> {[{node(), [node()]}], [node()]}.
+-spec subscribe(pid()) -> 'ok'.
+-spec pause_partition_guard() -> 'ok' | 'pausing'.
+
+-spec all_rabbit_nodes_up() -> boolean().
+-spec run_outside_applications(fun (() -> any()), boolean()) -> pid().
+-spec ping_all() -> 'ok'.
+-spec alive_nodes([node()]) -> [node()].
+-spec alive_rabbit_nodes([node()]) -> [node()].
%%----------------------------------------------------------------------------
%% Start
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl
index c7f5d501bf..4d8966f7e2 100644
--- a/src/rabbit_plugins.erl
+++ b/src/rabbit_plugins.erl
@@ -22,19 +22,16 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--type(plugin_name() :: atom()).
-
--spec(setup/0 :: () -> [plugin_name()]).
--spec(active/0 :: () -> [plugin_name()]).
--spec(list/1 :: (string()) -> [#plugin{}]).
--spec(list/2 :: (string(), boolean()) -> [#plugin{}]).
--spec(read_enabled/1 :: (file:filename()) -> [plugin_name()]).
--spec(dependencies/3 :: (boolean(), [plugin_name()], [#plugin{}]) ->
- [plugin_name()]).
--spec(ensure/1 :: (string()) -> {'ok', [atom()], [atom()]} | {error, any()}).
--endif.
+-type plugin_name() :: atom().
+
+-spec setup() -> [plugin_name()].
+-spec active() -> [plugin_name()].
+-spec list(string()) -> [#plugin{}].
+-spec list(string(), boolean()) -> [#plugin{}].
+-spec read_enabled(file:filename()) -> [plugin_name()].
+-spec dependencies(boolean(), [plugin_name()], [#plugin{}]) ->
+ [plugin_name()].
+-spec ensure(string()) -> {'ok', [atom()], [atom()]} | {error, any()}.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_plugins_main.erl b/src/rabbit_plugins_main.erl
index e248989a7a..ff516268c6 100644
--- a/src/rabbit_plugins_main.erl
+++ b/src/rabbit_plugins_main.erl
@@ -32,12 +32,8 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start/0 :: () -> no_return()).
--spec(stop/0 :: () -> 'ok').
-
--endif.
+-spec start() -> no_return().
+-spec stop() -> 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_prelaunch.erl b/src/rabbit_prelaunch.erl
index 5ecdd75acc..569a8d6c5a 100644
--- a/src/rabbit_prelaunch.erl
+++ b/src/rabbit_prelaunch.erl
@@ -30,12 +30,8 @@
%% Specs
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start/0 :: () -> no_return()).
--spec(stop/0 :: () -> 'ok').
-
--endif.
+-spec start() -> no_return().
+-spec stop() -> 'ok'.
%%----------------------------------------------------------------------------
@@ -129,10 +125,9 @@ dist_port_use_check_ipv6(NodeHost, Port) ->
{error, _} -> dist_port_use_check_fail(Port, NodeHost)
end.
--ifdef(use_specs).
--spec(dist_port_use_check_fail/2 :: (non_neg_integer(), string()) ->
- no_return()).
--endif.
+-spec dist_port_use_check_fail(non_neg_integer(), string()) ->
+ no_return().
+
dist_port_use_check_fail(Port, Host) ->
{ok, Names} = rabbit_nodes:names(Host),
case [N || {N, P} <- Names, P =:= Port] of
diff --git a/src/rabbit_prequeue.erl b/src/rabbit_prequeue.erl
index af96ea9f6f..5b2c24acab 100644
--- a/src/rabbit_prequeue.erl
+++ b/src/rabbit_prequeue.erl
@@ -33,16 +33,12 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-export_type([start_mode/0]).
--type(start_mode() :: 'declare' | 'recovery' | 'slave').
-
--spec(start_link/3 :: (rabbit_types:amqqueue(), start_mode(), pid())
- -> rabbit_types:ok_pid_or_error()).
+-type start_mode() :: 'declare' | 'recovery' | 'slave'.
--endif.
+-spec start_link(rabbit_types:amqqueue(), start_mode(), pid())
+ -> rabbit_types:ok_pid_or_error().
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_queue_consumers.erl b/src/rabbit_queue_consumers.erl
index 5b5c9b3074..a8002398e7 100644
--- a/src/rabbit_queue_consumers.erl
+++ b/src/rabbit_queue_consumers.erl
@@ -49,8 +49,6 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-type time_micros() :: non_neg_integer().
-type ratio() :: float().
-type state() :: #state{consumers ::priority_queue:q(),
@@ -94,8 +92,6 @@
state()) -> 'unchanged' | {'unblocked', state()}.
-spec utilisation(state()) -> ratio().
--endif.
-
%%----------------------------------------------------------------------------
new() -> #state{consumers = priority_queue:new(),
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl
index 06b6961edb..8b96bbffbd 100644
--- a/src/rabbit_queue_index.erl
+++ b/src/rabbit_queue_index.erl
@@ -193,20 +193,18 @@
-rabbit_upgrade({store_msg_size, local, [avoid_zeroes]}).
-rabbit_upgrade({store_msg, local, [store_msg_size]}).
--ifdef(use_specs).
-
--type(hdl() :: ('undefined' | any())).
--type(segment() :: ('undefined' |
+-type hdl() :: ('undefined' | any()).
+-type segment() :: ('undefined' |
#segment { num :: non_neg_integer(),
path :: file:filename(),
journal_entries :: array:array(),
entries_to_segment :: array:array(),
unacked :: non_neg_integer()
- })).
--type(seq_id() :: integer()).
--type(seg_dict() :: {dict:dict(), [segment()]}).
--type(on_sync_fun() :: fun ((gb_sets:set()) -> ok)).
--type(qistate() :: #qistate { dir :: file:filename(),
+ }).
+-type seq_id() :: integer().
+-type seg_dict() :: {dict:dict(), [segment()]}.
+-type on_sync_fun() :: fun ((gb_sets:set()) -> ok).
+-type qistate() :: #qistate { dir :: file:filename(),
segments :: 'undefined' | seg_dict(),
journal_handle :: hdl(),
dirty_count :: integer(),
@@ -217,43 +215,41 @@
unconfirmed_msg :: gb_sets:set(),
pre_publish_cache :: list(),
delivered_cache :: list()
- }).
--type(contains_predicate() :: fun ((rabbit_types:msg_id()) -> boolean())).
--type(walker(A) :: fun ((A) -> 'finished' |
- {rabbit_types:msg_id(), non_neg_integer(), A})).
--type(shutdown_terms() :: [term()] | 'non_clean_shutdown').
-
--spec(erase/1 :: (rabbit_amqqueue:name()) -> 'ok').
--spec(reset_state/1 :: (qistate()) -> qistate()).
--spec(init/3 :: (rabbit_amqqueue:name(),
- on_sync_fun(), on_sync_fun()) -> qistate()).
--spec(recover/6 :: (rabbit_amqqueue:name(), shutdown_terms(), boolean(),
+ }.
+-type contains_predicate() :: fun ((rabbit_types:msg_id()) -> boolean()).
+-type walker(A) :: fun ((A) -> 'finished' |
+ {rabbit_types:msg_id(), non_neg_integer(), A}).
+-type shutdown_terms() :: [term()] | 'non_clean_shutdown'.
+
+-spec erase(rabbit_amqqueue:name()) -> 'ok'.
+-spec reset_state(qistate()) -> qistate().
+-spec init(rabbit_amqqueue:name(),
+ on_sync_fun(), on_sync_fun()) -> qistate().
+-spec recover(rabbit_amqqueue:name(), shutdown_terms(), boolean(),
contains_predicate(),
on_sync_fun(), on_sync_fun()) ->
{'undefined' | non_neg_integer(),
- 'undefined' | non_neg_integer(), qistate()}).
--spec(terminate/2 :: ([any()], qistate()) -> qistate()).
--spec(delete_and_terminate/1 :: (qistate()) -> qistate()).
--spec(publish/6 :: (rabbit_types:msg_id(), seq_id(),
+ 'undefined' | non_neg_integer(), qistate()}.
+-spec terminate([any()], qistate()) -> qistate().
+-spec delete_and_terminate(qistate()) -> qistate().
+-spec publish(rabbit_types:msg_id(), seq_id(),
rabbit_types:message_properties(), boolean(),
- non_neg_integer(), qistate()) -> qistate()).
--spec(deliver/2 :: ([seq_id()], qistate()) -> qistate()).
--spec(ack/2 :: ([seq_id()], qistate()) -> qistate()).
--spec(sync/1 :: (qistate()) -> qistate()).
--spec(needs_sync/1 :: (qistate()) -> 'confirms' | 'other' | 'false').
--spec(flush/1 :: (qistate()) -> qistate()).
--spec(read/3 :: (seq_id(), seq_id(), qistate()) ->
+ non_neg_integer(), qistate()) -> qistate().
+-spec deliver([seq_id()], qistate()) -> qistate().
+-spec ack([seq_id()], qistate()) -> qistate().
+-spec sync(qistate()) -> qistate().
+-spec needs_sync(qistate()) -> 'confirms' | 'other' | 'false'.
+-spec flush(qistate()) -> qistate().
+-spec read(seq_id(), seq_id(), qistate()) ->
{[{rabbit_types:msg_id(), seq_id(),
rabbit_types:message_properties(),
- boolean(), boolean()}], qistate()}).
--spec(next_segment_boundary/1 :: (seq_id()) -> seq_id()).
--spec(bounds/1 :: (qistate()) ->
- {non_neg_integer(), non_neg_integer(), qistate()}).
--spec(start/1 :: ([rabbit_amqqueue:name()]) -> {[[any()]], {walker(A), A}}).
-
--spec(add_queue_ttl/0 :: () -> 'ok').
+ boolean(), boolean()}], qistate()}.
+-spec next_segment_boundary(seq_id()) -> seq_id().
+-spec bounds(qistate()) ->
+ {non_neg_integer(), non_neg_integer(), qistate()}.
+-spec start([rabbit_amqqueue:name()]) -> {[[any()]], {walker(A), A}}.
--endif.
+-spec add_queue_ttl() -> 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_recovery_terms.erl b/src/rabbit_recovery_terms.erl
index e47ae67bfb..f6f94eca45 100644
--- a/src/rabbit_recovery_terms.erl
+++ b/src/rabbit_recovery_terms.erl
@@ -34,15 +34,11 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start() -> rabbit_types:ok_or_error(term())).
--spec(stop() -> rabbit_types:ok_or_error(term())).
--spec(store(file:filename(), term()) -> rabbit_types:ok_or_error(term())).
--spec(read(file:filename()) -> rabbit_types:ok_or_error2(term(), not_found)).
--spec(clear() -> 'ok').
-
--endif. % use_specs
+-spec start() -> rabbit_types:ok_or_error(term()).
+-spec stop() -> rabbit_types:ok_or_error(term()).
+-spec store(file:filename(), term()) -> rabbit_types:ok_or_error(term()).
+-spec read(file:filename()) -> rabbit_types:ok_or_error2(term(), not_found).
+-spec clear() -> 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_registry.erl b/src/rabbit_registry.erl
index db61c958ec..0428c3533f 100644
--- a/src/rabbit_registry.erl
+++ b/src/rabbit_registry.erl
@@ -29,18 +29,14 @@
-define(SERVER, ?MODULE).
-define(ETS_NAME, ?MODULE).
--ifdef(use_specs).
-
--spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
--spec(register/3 :: (atom(), binary(), atom()) -> 'ok').
--spec(unregister/2 :: (atom(), binary()) -> 'ok').
--spec(binary_to_type/1 ::
- (binary()) -> atom() | rabbit_types:error('not_found')).
--spec(lookup_module/2 ::
- (atom(), atom()) -> rabbit_types:ok_or_error2(atom(), 'not_found')).
--spec(lookup_all/1 :: (atom()) -> [{atom(), atom()}]).
-
--endif.
+-spec start_link() -> rabbit_types:ok_pid_or_error().
+-spec register(atom(), binary(), atom()) -> 'ok'.
+-spec unregister(atom(), binary()) -> 'ok'.
+-spec binary_to_type
+ (binary()) -> atom() | rabbit_types:error('not_found').
+-spec lookup_module
+ (atom(), atom()) -> rabbit_types:ok_or_error2(atom(), 'not_found').
+-spec lookup_all(atom()) -> [{atom(), atom()}].
%%---------------------------------------------------------------------------
diff --git a/src/rabbit_resource_monitor_misc.erl b/src/rabbit_resource_monitor_misc.erl
index 80db6e87e1..56faefe536 100644
--- a/src/rabbit_resource_monitor_misc.erl
+++ b/src/rabbit_resource_monitor_misc.erl
@@ -19,12 +19,8 @@
-export([parse_information_unit/1]).
--ifdef(use_spec).
-
--spec(parse_information_unit/1 :: (integer() | string()) ->
- {ok, integer()} | {error, parse_error}).
-
--endif.
+-spec parse_information_unit(integer() | string()) ->
+ {ok, integer()} | {error, parse_error}.
parse_information_unit(Value) when is_integer(Value) -> {ok, Value};
parse_information_unit(Value) when is_list(Value) ->
diff --git a/src/rabbit_restartable_sup.erl b/src/rabbit_restartable_sup.erl
index 8517718add..1960259188 100644
--- a/src/rabbit_restartable_sup.erl
+++ b/src/rabbit_restartable_sup.erl
@@ -28,12 +28,8 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/3 :: (atom(), rabbit_types:mfargs(), boolean()) ->
- rabbit_types:ok_pid_or_error()).
-
--endif.
+-spec start_link(atom(), rabbit_types:mfargs(), boolean()) ->
+ rabbit_types:ok_pid_or_error().
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_router.erl b/src/rabbit_router.erl
index 42b67d6681..d4390ac4d8 100644
--- a/src/rabbit_router.erl
+++ b/src/rabbit_router.erl
@@ -22,21 +22,17 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
-export_type([routing_key/0, match_result/0]).
--type(routing_key() :: binary()).
--type(match_result() :: [rabbit_types:binding_destination()]).
+-type routing_key() :: binary().
+-type match_result() :: [rabbit_types:binding_destination()].
--spec(match_bindings/2 :: (rabbit_types:binding_source(),
+-spec match_bindings(rabbit_types:binding_source(),
fun ((rabbit_types:binding()) -> boolean())) ->
- match_result()).
--spec(match_routing_key/2 :: (rabbit_types:binding_source(),
+ match_result().
+-spec match_routing_key(rabbit_types:binding_source(),
[routing_key()] | ['_']) ->
- match_result()).
-
--endif.
+ match_result().
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_runtime_parameters.erl b/src/rabbit_runtime_parameters.erl
index ba1a830df1..97f78da8ba 100644
--- a/src/rabbit_runtime_parameters.erl
+++ b/src/rabbit_runtime_parameters.erl
@@ -57,38 +57,34 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--type(ok_or_error_string() :: 'ok' | {'error_string', string()}).
--type(ok_thunk_or_error_string() :: ok_or_error_string() | fun(() -> 'ok')).
-
--spec(parse_set/5 :: (rabbit_types:vhost(), binary(), binary(), string(),
- rabbit_types:user() | 'none') -> ok_or_error_string()).
--spec(set/5 :: (rabbit_types:vhost(), binary(), binary(), term(),
- rabbit_types:user() | 'none') -> ok_or_error_string()).
--spec(set_any/5 :: (rabbit_types:vhost(), binary(), binary(), term(),
- rabbit_types:user() | 'none') -> ok_or_error_string()).
--spec(set_global/2 :: (atom(), term()) -> 'ok').
--spec(clear/3 :: (rabbit_types:vhost(), binary(), binary())
- -> ok_thunk_or_error_string()).
--spec(clear_any/3 :: (rabbit_types:vhost(), binary(), binary())
- -> ok_thunk_or_error_string()).
--spec(list/0 :: () -> [rabbit_types:infos()]).
--spec(list/1 :: (rabbit_types:vhost() | '_') -> [rabbit_types:infos()]).
--spec(list_component/1 :: (binary()) -> [rabbit_types:infos()]).
--spec(list/2 :: (rabbit_types:vhost() | '_', binary() | '_')
- -> [rabbit_types:infos()]).
--spec(list_formatted/1 :: (rabbit_types:vhost()) -> [rabbit_types:infos()]).
--spec(list_formatted/3 :: (rabbit_types:vhost(), reference(), pid()) -> 'ok').
--spec(lookup/3 :: (rabbit_types:vhost(), binary(), binary())
- -> rabbit_types:infos() | 'not_found').
--spec(value/3 :: (rabbit_types:vhost(), binary(), binary()) -> term()).
--spec(value/4 :: (rabbit_types:vhost(), binary(), binary(), term()) -> term()).
--spec(value_global/1 :: (atom()) -> term() | 'not_found').
--spec(value_global/2 :: (atom(), term()) -> term()).
--spec(info_keys/0 :: () -> rabbit_types:info_keys()).
-
--endif.
+-type ok_or_error_string() :: 'ok' | {'error_string', string()}.
+-type ok_thunk_or_error_string() :: ok_or_error_string() | fun(() -> 'ok').
+
+-spec parse_set(rabbit_types:vhost(), binary(), binary(), string(),
+ rabbit_types:user() | 'none') -> ok_or_error_string().
+-spec set(rabbit_types:vhost(), binary(), binary(), term(),
+ rabbit_types:user() | 'none') -> ok_or_error_string().
+-spec set_any(rabbit_types:vhost(), binary(), binary(), term(),
+ rabbit_types:user() | 'none') -> ok_or_error_string().
+-spec set_global(atom(), term()) -> 'ok'.
+-spec clear(rabbit_types:vhost(), binary(), binary())
+ -> ok_thunk_or_error_string().
+-spec clear_any(rabbit_types:vhost(), binary(), binary())
+ -> ok_thunk_or_error_string().
+-spec list() -> [rabbit_types:infos()].
+-spec list(rabbit_types:vhost() | '_') -> [rabbit_types:infos()].
+-spec list_component(binary()) -> [rabbit_types:infos()].
+-spec list(rabbit_types:vhost() | '_', binary() | '_')
+ -> [rabbit_types:infos()].
+-spec list_formatted(rabbit_types:vhost()) -> [rabbit_types:infos()].
+-spec list_formatted(rabbit_types:vhost(), reference(), pid()) -> 'ok'.
+-spec lookup(rabbit_types:vhost(), binary(), binary())
+ -> rabbit_types:infos() | 'not_found'.
+-spec value(rabbit_types:vhost(), binary(), binary()) -> term().
+-spec value(rabbit_types:vhost(), binary(), binary(), term()) -> term().
+-spec value_global(atom()) -> term() | 'not_found'.
+-spec value_global(atom(), term()) -> term().
+-spec info_keys() -> rabbit_types:info_keys().
%%---------------------------------------------------------------------------
diff --git a/src/rabbit_ssl.erl b/src/rabbit_ssl.erl
index 38769e1835..ac9fb204d0 100644
--- a/src/rabbit_ssl.erl
+++ b/src/rabbit_ssl.erl
@@ -25,21 +25,17 @@
%%--------------------------------------------------------------------------
--ifdef(use_specs).
-
-export_type([certificate/0]).
--type(certificate() :: binary()).
-
--spec(peer_cert_issuer/1 :: (certificate()) -> string()).
--spec(peer_cert_subject/1 :: (certificate()) -> string()).
--spec(peer_cert_validity/1 :: (certificate()) -> string()).
--spec(peer_cert_subject_items/2 ::
- (certificate(), tuple()) -> [string()] | 'not_found').
--spec(peer_cert_auth_name/1 ::
- (certificate()) -> binary() | 'not_found' | 'unsafe').
+-type certificate() :: binary().
--endif.
+-spec peer_cert_issuer(certificate()) -> string().
+-spec peer_cert_subject(certificate()) -> string().
+-spec peer_cert_validity(certificate()) -> string().
+-spec peer_cert_subject_items
+ (certificate(), tuple()) -> [string()] | 'not_found'.
+-spec peer_cert_auth_name
+ (certificate()) -> binary() | 'not_found' | 'unsafe'.
%%--------------------------------------------------------------------------
%% High-level functions used by reader
diff --git a/src/rabbit_sup.erl b/src/rabbit_sup.erl
index b33b35c790..ad70540e5b 100644
--- a/src/rabbit_sup.erl
+++ b/src/rabbit_sup.erl
@@ -33,22 +33,18 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
--spec(start_child/1 :: (atom()) -> 'ok').
--spec(start_child/2 :: (atom(), [any()]) -> 'ok').
--spec(start_child/3 :: (atom(), atom(), [any()]) -> 'ok').
--spec(start_supervisor_child/1 :: (atom()) -> 'ok').
--spec(start_supervisor_child/2 :: (atom(), [any()]) -> 'ok').
--spec(start_supervisor_child/3 :: (atom(), atom(), [any()]) -> 'ok').
--spec(start_restartable_child/1 :: (atom()) -> 'ok').
--spec(start_restartable_child/2 :: (atom(), [any()]) -> 'ok').
--spec(start_delayed_restartable_child/1 :: (atom()) -> 'ok').
--spec(start_delayed_restartable_child/2 :: (atom(), [any()]) -> 'ok').
--spec(stop_child/1 :: (atom()) -> rabbit_types:ok_or_error(any())).
-
--endif.
+-spec start_link() -> rabbit_types:ok_pid_or_error().
+-spec start_child(atom()) -> 'ok'.
+-spec start_child(atom(), [any()]) -> 'ok'.
+-spec start_child(atom(), atom(), [any()]) -> 'ok'.
+-spec start_supervisor_child(atom()) -> 'ok'.
+-spec start_supervisor_child(atom(), [any()]) -> 'ok'.
+-spec start_supervisor_child(atom(), atom(), [any()]) -> 'ok'.
+-spec start_restartable_child(atom()) -> 'ok'.
+-spec start_restartable_child(atom(), [any()]) -> 'ok'.
+-spec start_delayed_restartable_child(atom()) -> 'ok'.
+-spec start_delayed_restartable_child(atom(), [any()]) -> 'ok'.
+-spec stop_child(atom()) -> rabbit_types:ok_or_error(any()).
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_table.erl b/src/rabbit_table.erl
index aed49bbe74..3909096964 100644
--- a/src/rabbit_table.erl
+++ b/src/rabbit_table.erl
@@ -24,21 +24,17 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(create/0 :: () -> 'ok').
--spec(create_local_copy/1 :: ('disc' | 'ram') -> 'ok').
--spec(wait_for_replicated/0 :: () -> 'ok').
--spec(wait/1 :: ([atom()]) -> 'ok').
--spec(wait_timeout/0 :: () -> non_neg_integer() | infinity).
--spec(force_load/0 :: () -> 'ok').
--spec(is_present/0 :: () -> boolean()).
--spec(is_empty/0 :: () -> boolean()).
--spec(needs_default_data/0 :: () -> boolean()).
--spec(check_schema_integrity/0 :: () -> rabbit_types:ok_or_error(any())).
--spec(clear_ram_only_tables/0 :: () -> 'ok').
-
--endif.
+-spec create() -> 'ok'.
+-spec create_local_copy('disc' | 'ram') -> 'ok'.
+-spec wait_for_replicated() -> 'ok'.
+-spec wait([atom()]) -> 'ok'.
+-spec wait_timeout() -> non_neg_integer() | infinity.
+-spec force_load() -> 'ok'.
+-spec is_present() -> boolean().
+-spec is_empty() -> boolean().
+-spec needs_default_data() -> boolean().
+-spec check_schema_integrity() -> rabbit_types:ok_or_error(any()).
+-spec clear_ram_only_tables() -> 'ok'.
%%----------------------------------------------------------------------------
%% Main interface
diff --git a/src/rabbit_trace.erl b/src/rabbit_trace.erl
index cd4ecf9c38..4bfd94e1e0 100644
--- a/src/rabbit_trace.erl
+++ b/src/rabbit_trace.erl
@@ -26,23 +26,19 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
+-type state() :: rabbit_types:exchange() | 'none'.
--type(state() :: rabbit_types:exchange() | 'none').
-
--spec(init/1 :: (rabbit_types:vhost()) -> state()).
--spec(enabled/1 :: (rabbit_types:vhost()) -> boolean()).
--spec(tap_in/6 :: (rabbit_types:basic_message(), [rabbit_amqqueue:name()],
+-spec init(rabbit_types:vhost()) -> state().
+-spec enabled(rabbit_types:vhost()) -> boolean().
+-spec tap_in(rabbit_types:basic_message(), [rabbit_amqqueue:name()],
binary(), rabbit_channel:channel_number(),
- rabbit_types:username(), state()) -> 'ok').
--spec(tap_out/5 :: (rabbit_amqqueue:qmsg(), binary(),
+ rabbit_types:username(), state()) -> 'ok'.
+-spec tap_out(rabbit_amqqueue:qmsg(), binary(),
rabbit_channel:channel_number(),
- rabbit_types:username(), state()) -> 'ok').
-
--spec(start/1 :: (rabbit_types:vhost()) -> 'ok').
--spec(stop/1 :: (rabbit_types:vhost()) -> 'ok').
+ rabbit_types:username(), state()) -> 'ok'.
--endif.
+-spec start(rabbit_types:vhost()) -> 'ok'.
+-spec stop(rabbit_types:vhost()) -> 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_upgrade.erl b/src/rabbit_upgrade.erl
index 2f59554d3c..f88b7cc73f 100644
--- a/src/rabbit_upgrade.erl
+++ b/src/rabbit_upgrade.erl
@@ -26,14 +26,11 @@
%% -------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(maybe_upgrade_mnesia/0 :: () -> 'ok').
--spec(maybe_upgrade_local/0 :: () -> 'ok' |
- 'version_not_available' |
- 'starting_from_scratch').
-
--endif.
+-spec maybe_upgrade_mnesia() -> 'ok'.
+-spec maybe_upgrade_local() ->
+ 'ok' |
+ 'version_not_available' |
+ 'starting_from_scratch'.
%% -------------------------------------------------------------------
diff --git a/src/rabbit_upgrade_functions.erl b/src/rabbit_upgrade_functions.erl
index f9ed62b4b2..67c2a84a0e 100644
--- a/src/rabbit_upgrade_functions.erl
+++ b/src/rabbit_upgrade_functions.erl
@@ -55,39 +55,35 @@
%% -------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(remove_user_scope/0 :: () -> 'ok').
--spec(hash_passwords/0 :: () -> 'ok').
--spec(add_ip_to_listener/0 :: () -> 'ok').
--spec(internal_exchanges/0 :: () -> 'ok').
--spec(user_to_internal_user/0 :: () -> 'ok').
--spec(topic_trie/0 :: () -> 'ok').
--spec(semi_durable_route/0 :: () -> 'ok').
--spec(exchange_event_serial/0 :: () -> 'ok').
--spec(trace_exchanges/0 :: () -> 'ok').
--spec(user_admin_to_tags/0 :: () -> 'ok').
--spec(ha_mirrors/0 :: () -> 'ok').
--spec(gm/0 :: () -> 'ok').
--spec(exchange_scratch/0 :: () -> 'ok').
--spec(mirrored_supervisor/0 :: () -> 'ok').
--spec(topic_trie_node/0 :: () -> 'ok').
--spec(runtime_parameters/0 :: () -> 'ok').
--spec(policy/0 :: () -> 'ok').
--spec(sync_slave_pids/0 :: () -> 'ok').
--spec(no_mirror_nodes/0 :: () -> 'ok').
--spec(gm_pids/0 :: () -> 'ok').
--spec(exchange_decorators/0 :: () -> 'ok').
--spec(policy_apply_to/0 :: () -> 'ok').
--spec(queue_decorators/0 :: () -> 'ok').
--spec(internal_system_x/0 :: () -> 'ok').
--spec(cluster_name/0 :: () -> 'ok').
--spec(down_slave_nodes/0 :: () -> 'ok').
--spec(queue_state/0 :: () -> 'ok').
--spec(recoverable_slaves/0 :: () -> 'ok').
--spec(user_password_hashing/0 :: () -> 'ok').
-
--endif.
+-spec remove_user_scope() -> 'ok'.
+-spec hash_passwords() -> 'ok'.
+-spec add_ip_to_listener() -> 'ok'.
+-spec internal_exchanges() -> 'ok'.
+-spec user_to_internal_user() -> 'ok'.
+-spec topic_trie() -> 'ok'.
+-spec semi_durable_route() -> 'ok'.
+-spec exchange_event_serial() -> 'ok'.
+-spec trace_exchanges() -> 'ok'.
+-spec user_admin_to_tags() -> 'ok'.
+-spec ha_mirrors() -> 'ok'.
+-spec gm() -> 'ok'.
+-spec exchange_scratch() -> 'ok'.
+-spec mirrored_supervisor() -> 'ok'.
+-spec topic_trie_node() -> 'ok'.
+-spec runtime_parameters() -> 'ok'.
+-spec policy() -> 'ok'.
+-spec sync_slave_pids() -> 'ok'.
+-spec no_mirror_nodes() -> 'ok'.
+-spec gm_pids() -> 'ok'.
+-spec exchange_decorators() -> 'ok'.
+-spec policy_apply_to() -> 'ok'.
+-spec queue_decorators() -> 'ok'.
+-spec internal_system_x() -> 'ok'.
+-spec cluster_name() -> 'ok'.
+-spec down_slave_nodes() -> 'ok'.
+-spec queue_state() -> 'ok'.
+-spec recoverable_slaves() -> 'ok'.
+-spec user_password_hashing() -> 'ok'.
%%--------------------------------------------------------------------
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index 7bf7f2ec54..9af88ea532 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -341,19 +341,17 @@
-rabbit_upgrade({multiple_routing_keys, local, []}).
--ifdef(use_specs).
+-type seq_id() :: non_neg_integer().
--type(seq_id() :: non_neg_integer()).
-
--type(rates() :: #rates { in :: float(),
+-type rates() :: #rates { in :: float(),
out :: float(),
ack_in :: float(),
ack_out :: float(),
- timestamp :: rabbit_types:timestamp()}).
+ timestamp :: rabbit_types:timestamp()}.
--type(delta() :: #delta { start_seq_id :: non_neg_integer(),
+-type delta() :: #delta { start_seq_id :: non_neg_integer(),
count :: non_neg_integer(),
- end_seq_id :: non_neg_integer() }).
+ end_seq_id :: non_neg_integer() }.
%% The compiler (rightfully) complains that ack() and state() are
%% unused. For this reason we duplicate a -spec from
@@ -361,8 +359,8 @@
%% warnings. The problem here is that we can't parameterise the BQ
%% behaviour by these two types as we would like to. We still leave
%% these here for documentation purposes.
--type(ack() :: seq_id()).
--type(state() :: #vqstate {
+-type ack() :: seq_id().
+-type state() :: #vqstate {
q1 :: ?QUEUE:?QUEUE(),
q2 :: ?QUEUE:?QUEUE(),
delta :: delta(),
@@ -404,13 +402,11 @@
disk_write_count :: non_neg_integer(),
io_batch_size :: pos_integer(),
- mode :: 'default' | 'lazy' }).
+ mode :: 'default' | 'lazy' }.
%% Duplicated from rabbit_backing_queue
--spec(ack/2 :: ([ack()], state()) -> {[rabbit_guid:guid()], state()}).
-
--spec(multiple_routing_keys/0 :: () -> 'ok').
+-spec ack([ack()], state()) -> {[rabbit_guid:guid()], state()}.
--endif.
+-spec multiple_routing_keys() -> 'ok'.
-define(BLANK_DELTA, #delta { start_seq_id = undefined,
count = 0,
diff --git a/src/rabbit_version.erl b/src/rabbit_version.erl
index 8167c8622a..a27f0aca00 100644
--- a/src/rabbit_version.erl
+++ b/src/rabbit_version.erl
@@ -23,33 +23,32 @@
version_error/3]).
%% -------------------------------------------------------------------
--ifdef(use_specs).
-export_type([scope/0, step/0]).
--type(scope() :: atom()).
--type(scope_version() :: [atom()]).
--type(step() :: {atom(), atom()}).
-
--type(version() :: [atom()]).
-
--spec(recorded/0 :: () -> rabbit_types:ok_or_error2(version(), any())).
--spec(matches/2 :: ([A], [A]) -> boolean()).
--spec(desired/0 :: () -> version()).
--spec(desired_for_scope/1 :: (scope()) -> scope_version()).
--spec(record_desired/0 :: () -> 'ok').
--spec(record_desired_for_scope/1 ::
- (scope()) -> rabbit_types:ok_or_error(any())).
--spec(upgrades_required/1 ::
- (scope()) -> rabbit_types:ok_or_error2([step()], any())).
--spec(check_version_consistency/3 ::
- (string(), string(), string()) -> rabbit_types:ok_or_error(any())).
--spec(check_version_consistency/4 ::
+-type scope() :: atom().
+-type scope_version() :: [atom()].
+-type step() :: {atom(), atom()}.
+
+-type version() :: [atom()].
+
+-spec recorded() -> rabbit_types:ok_or_error2(version(), any()).
+-spec matches([A], [A]) -> boolean().
+-spec desired() -> version().
+-spec desired_for_scope(scope()) -> scope_version().
+-spec record_desired() -> 'ok'.
+-spec record_desired_for_scope
+ (scope()) -> rabbit_types:ok_or_error(any()).
+-spec upgrades_required
+ (scope()) -> rabbit_types:ok_or_error2([step()], any()).
+-spec check_version_consistency
+ (string(), string(), string()) -> rabbit_types:ok_or_error(any()).
+-spec check_version_consistency
(string(), string(), string(), string()) ->
- rabbit_types:ok_or_error(any())).
--spec(check_otp_consistency/1 ::
- (string()) -> rabbit_types:ok_or_error(any())).
--endif.
+ rabbit_types:ok_or_error(any()).
+-spec check_otp_consistency
+ (string()) -> rabbit_types:ok_or_error(any()).
+
%% -------------------------------------------------------------------
-define(VERSION_FILENAME, "schema_version").
diff --git a/src/rabbit_vhost.erl b/src/rabbit_vhost.erl
index f362ef930f..df2f8423b4 100644
--- a/src/rabbit_vhost.erl
+++ b/src/rabbit_vhost.erl
@@ -23,24 +23,20 @@
-export([add/1, delete/1, exists/1, list/0, with/2, assert/1]).
-export([info/1, info/2, info_all/0, info_all/1, info_all/2, info_all/3]).
--ifdef(use_specs).
-
--spec(add/1 :: (rabbit_types:vhost()) -> 'ok').
--spec(delete/1 :: (rabbit_types:vhost()) -> 'ok').
--spec(exists/1 :: (rabbit_types:vhost()) -> boolean()).
--spec(list/0 :: () -> [rabbit_types:vhost()]).
--spec(with/2 :: (rabbit_types:vhost(), rabbit_misc:thunk(A)) -> A).
--spec(assert/1 :: (rabbit_types:vhost()) -> 'ok').
-
--spec(info/1 :: (rabbit_types:vhost()) -> rabbit_types:infos()).
--spec(info/2 :: (rabbit_types:vhost(), rabbit_types:info_keys())
- -> rabbit_types:infos()).
--spec(info_all/0 :: () -> [rabbit_types:infos()]).
--spec(info_all/1 :: (rabbit_types:info_keys()) -> [rabbit_types:infos()]).
--spec(info_all/3 :: (rabbit_types:info_keys(), reference(), pid()) ->
- 'ok').
-
--endif.
+-spec add(rabbit_types:vhost()) -> 'ok'.
+-spec delete(rabbit_types:vhost()) -> 'ok'.
+-spec exists(rabbit_types:vhost()) -> boolean().
+-spec list() -> [rabbit_types:vhost()].
+-spec with(rabbit_types:vhost(), rabbit_misc:thunk(A)) -> A.
+-spec assert(rabbit_types:vhost()) -> 'ok'.
+
+-spec info(rabbit_types:vhost()) -> rabbit_types:infos().
+-spec info(rabbit_types:vhost(), rabbit_types:info_keys())
+ -> rabbit_types:infos().
+-spec info_all() -> [rabbit_types:infos()].
+-spec info_all(rabbit_types:info_keys()) -> [rabbit_types:infos()].
+-spec info_all(rabbit_types:info_keys(), reference(), pid()) ->
+ 'ok'.
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_vm.erl b/src/rabbit_vm.erl
index d67331aec7..9c8732bb6b 100644
--- a/src/rabbit_vm.erl
+++ b/src/rabbit_vm.erl
@@ -23,15 +23,11 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(memory/0 :: () -> rabbit_types:infos()).
--spec(binary/0 :: () -> rabbit_types:infos()).
--spec(ets_tables_memory/1 :: (Owners) -> rabbit_types:infos()
+-spec memory() -> rabbit_types:infos().
+-spec binary() -> rabbit_types:infos().
+-spec ets_tables_memory(Owners) -> rabbit_types:infos()
when Owners :: all | OwnerProcessName | [OwnerProcessName],
- OwnerProcessName :: atom()).
-
--endif.
+ OwnerProcessName :: atom().
%%----------------------------------------------------------------------------
@@ -230,21 +226,19 @@ conn_type(PDict) ->
%% NB: this code is non-rabbit specific.
--ifdef(use_specs).
--type(process() :: pid() | atom()).
--type(info_key() :: atom()).
--type(info_value() :: any()).
--type(info_item() :: {info_key(), info_value()}).
--type(accumulate() :: fun ((info_key(), info_value(), info_value()) ->
- info_value())).
--type(distinguisher() :: fun (([{term(), term()}]) -> atom())).
--type(distinguishers() :: [{info_key(), distinguisher()}]).
--spec(sum_processes/3 :: ([process()], distinguishers(), [info_key()]) ->
- {[{process(), [info_item()]}], [info_item()]}).
--spec(sum_processes/4 :: ([process()], accumulate(), distinguishers(),
+-type process() :: pid() | atom().
+-type info_key() :: atom().
+-type info_value() :: any().
+-type info_item() :: {info_key(), info_value()}.
+-type accumulate() :: fun ((info_key(), info_value(), info_value()) ->
+ info_value()).
+-type distinguisher() :: fun (([{term(), term()}]) -> atom()).
+-type distinguishers() :: [{info_key(), distinguisher()}].
+-spec sum_processes([process()], distinguishers(), [info_key()]) ->
+ {[{process(), [info_item()]}], [info_item()]}.
+-spec sum_processes([process()], accumulate(), distinguishers(),
[info_item()]) ->
- {[{process(), [info_item()]}], [info_item()]}).
--endif.
+ {[{process(), [info_item()]}], [info_item()]}.
sum_processes(Names, Distinguishers, Items) ->
sum_processes(Names, fun (_, X, Y) -> X + Y end, Distinguishers,
diff --git a/src/supervised_lifecycle.erl b/src/supervised_lifecycle.erl
index 981956a071..5b0f56dc26 100644
--- a/src/supervised_lifecycle.erl
+++ b/src/supervised_lifecycle.erl
@@ -36,12 +36,8 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/3 :: (atom(), rabbit_types:mfargs(), rabbit_types:mfargs()) ->
- rabbit_types:ok_pid_or_error()).
-
--endif.
+-spec start_link(atom(), rabbit_types:mfargs(), rabbit_types:mfargs()) ->
+ rabbit_types:ok_pid_or_error().
%%----------------------------------------------------------------------------
diff --git a/src/tcp_listener.erl b/src/tcp_listener.erl
index 36b04a4593..5f15592455 100644
--- a/src/tcp_listener.erl
+++ b/src/tcp_listener.erl
@@ -57,16 +57,12 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
+-type mfargs() :: {atom(), atom(), [any()]}.
--type(mfargs() :: {atom(), atom(), [any()]}).
-
--spec(start_link/5 ::
+-spec start_link
(inet:ip_address(), inet:port_number(),
mfargs(), mfargs(), string()) ->
- rabbit_types:ok_pid_or_error()).
-
--endif.
+ rabbit_types:ok_pid_or_error().
%%--------------------------------------------------------------------
diff --git a/src/tcp_listener_sup.erl b/src/tcp_listener_sup.erl
index 98a7c890d9..5ef652ad60 100644
--- a/src/tcp_listener_sup.erl
+++ b/src/tcp_listener_sup.erl
@@ -31,16 +31,12 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
+-type mfargs() :: {atom(), atom(), [any()]}.
--type(mfargs() :: {atom(), atom(), [any()]}).
-
--spec(start_link/10 ::
+-spec start_link
(inet:ip_address(), inet:port_number(), module(), [gen_tcp:listen_option()],
module(), any(), mfargs(), mfargs(), integer(), string()) ->
- rabbit_types:ok_pid_or_error()).
-
--endif.
+ rabbit_types:ok_pid_or_error().
%%----------------------------------------------------------------------------
diff --git a/src/vm_memory_monitor.erl b/src/vm_memory_monitor.erl
index 68926962b0..6b043685bd 100644
--- a/src/vm_memory_monitor.erl
+++ b/src/vm_memory_monitor.erl
@@ -62,21 +62,17 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--type(vm_memory_high_watermark() :: (float() | {'absolute', integer() | string()})).
--spec(start_link/1 :: (float()) -> rabbit_types:ok_pid_or_error()).
--spec(start_link/3 :: (float(), fun ((any()) -> 'ok'),
- fun ((any()) -> 'ok')) -> rabbit_types:ok_pid_or_error()).
--spec(get_total_memory/0 :: () -> (non_neg_integer() | 'unknown')).
--spec(get_vm_limit/0 :: () -> non_neg_integer()).
--spec(get_check_interval/0 :: () -> non_neg_integer()).
--spec(set_check_interval/1 :: (non_neg_integer()) -> 'ok').
--spec(get_vm_memory_high_watermark/0 :: () -> vm_memory_high_watermark()).
--spec(set_vm_memory_high_watermark/1 :: (vm_memory_high_watermark()) -> 'ok').
--spec(get_memory_limit/0 :: () -> non_neg_integer()).
-
--endif.
+-type vm_memory_high_watermark() :: (float() | {'absolute', integer() | string()}).
+-spec start_link(float()) -> rabbit_types:ok_pid_or_error().
+-spec start_link(float(), fun ((any()) -> 'ok'),
+ fun ((any()) -> 'ok')) -> rabbit_types:ok_pid_or_error().
+-spec get_total_memory() -> (non_neg_integer() | 'unknown').
+-spec get_vm_limit() -> non_neg_integer().
+-spec get_check_interval() -> non_neg_integer().
+-spec set_check_interval(non_neg_integer()) -> 'ok'.
+-spec get_vm_memory_high_watermark() -> vm_memory_high_watermark().
+-spec set_vm_memory_high_watermark(vm_memory_high_watermark()) -> 'ok'.
+-spec get_memory_limit() -> non_neg_integer().
%%----------------------------------------------------------------------------
%% Public API
diff --git a/src/worker_pool.erl b/src/worker_pool.erl
index 6bacd43d27..c0be486f5f 100644
--- a/src/worker_pool.erl
+++ b/src/worker_pool.erl
@@ -61,20 +61,16 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--type(mfargs() :: {atom(), atom(), [any()]}).
-
--spec(start_link/1 :: (atom()) -> {'ok', pid()} | {'error', any()}).
--spec(submit/1 :: (fun (() -> A) | mfargs()) -> A).
--spec(submit/2 :: (fun (() -> A) | mfargs(), 'reuse' | 'single') -> A).
--spec(submit/3 :: (atom(), fun (() -> A) | mfargs(), 'reuse' | 'single') -> A).
--spec(submit_async/1 :: (fun (() -> any()) | mfargs()) -> 'ok').
--spec(ready/2 :: (atom(), pid()) -> 'ok').
--spec(idle/2 :: (atom(), pid()) -> 'ok').
--spec(default_pool/0 :: () -> atom()).
-
--endif.
+-type mfargs() :: {atom(), atom(), [any()]}.
+
+-spec start_link(atom()) -> {'ok', pid()} | {'error', any()}.
+-spec submit(fun (() -> A) | mfargs()) -> A.
+-spec submit(fun (() -> A) | mfargs(), 'reuse' | 'single') -> A.
+-spec submit(atom(), fun (() -> A) | mfargs(), 'reuse' | 'single') -> A.
+-spec submit_async(fun (() -> any()) | mfargs()) -> 'ok'.
+-spec ready(atom(), pid()) -> 'ok'.
+-spec idle(atom(), pid()) -> 'ok'.
+-spec default_pool() -> atom().
%%----------------------------------------------------------------------------
diff --git a/src/worker_pool_sup.erl b/src/worker_pool_sup.erl
index 3b2c3476c2..f4ed4d70c2 100644
--- a/src/worker_pool_sup.erl
+++ b/src/worker_pool_sup.erl
@@ -24,14 +24,10 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
--spec(start_link/1 :: (non_neg_integer()) -> rabbit_types:ok_pid_or_error()).
--spec(start_link/2 :: (non_neg_integer(), atom())
- -> rabbit_types:ok_pid_or_error()).
-
--endif.
+-spec start_link() -> rabbit_types:ok_pid_or_error().
+-spec start_link(non_neg_integer()) -> rabbit_types:ok_pid_or_error().
+-spec start_link(non_neg_integer(), atom())
+ -> rabbit_types:ok_pid_or_error().
%%----------------------------------------------------------------------------
diff --git a/src/worker_pool_worker.erl b/src/worker_pool_worker.erl
index 259af5e4a2..bd07f0d782 100644
--- a/src/worker_pool_worker.erl
+++ b/src/worker_pool_worker.erl
@@ -33,18 +33,14 @@
%%----------------------------------------------------------------------------
--ifdef(use_specs).
-
--type(mfargs() :: {atom(), atom(), [any()]}).
-
--spec(start_link/1 :: (atom) -> {'ok', pid()} | {'error', any()}).
--spec(next_job_from/2 :: (pid(), pid()) -> 'ok').
--spec(submit/3 :: (pid(), fun (() -> A) | mfargs(), 'reuse' | 'single') -> A).
--spec(submit_async/2 :: (pid(), fun (() -> any()) | mfargs()) -> 'ok').
--spec(run/1 :: (fun (() -> A)) -> A; (mfargs()) -> any()).
--spec(set_maximum_since_use/2 :: (pid(), non_neg_integer()) -> 'ok').
-
--endif.
+-type mfargs() :: {atom(), atom(), [any()]}.
+
+-spec start_link(atom) -> {'ok', pid()} | {'error', any()}.
+-spec next_job_from(pid(), pid()) -> 'ok'.
+-spec submit(pid(), fun (() -> A) | mfargs(), 'reuse' | 'single') -> A.
+-spec submit_async(pid(), fun (() -> any()) | mfargs()) -> 'ok'.
+-spec run(fun (() -> A)) -> A; (mfargs()) -> any().
+-spec set_maximum_since_use(pid(), non_neg_integer()) -> 'ok'.
%%----------------------------------------------------------------------------