diff options
author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-07-02 11:51:10 +0100 |
---|---|---|
committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-07-02 11:51:10 +0100 |
commit | fd2dda1d51ee7862d1f66dbeaf57fbb42240f674 (patch) | |
tree | 8d17da41f11c3ae20291af836b43fc11851d88a3 | |
parent | c61a2425626f80c16eedc53ef5ad638e2ba50c3e (diff) | |
download | rabbitmq-server-fd2dda1d51ee7862d1f66dbeaf57fbb42240f674.tar.gz |
redistributed all types from rabbit_framing_spec.hrl and rabbit.hrl
-rw-r--r-- | codegen.py | 15 | ||||
-rw-r--r-- | include/rabbit_exchange_type_spec.hrl | 10 | ||||
-rw-r--r-- | src/rabbit.erl | 27 | ||||
-rw-r--r-- | src/rabbit_access_control.erl | 23 | ||||
-rw-r--r-- | src/rabbit_amqqueue.erl | 39 | ||||
-rw-r--r-- | src/rabbit_basic.erl | 14 | ||||
-rw-r--r-- | src/rabbit_channel.erl | 7 | ||||
-rw-r--r-- | src/rabbit_exchange.erl | 56 | ||||
-rw-r--r-- | src/rabbit_misc.erl | 28 | ||||
-rw-r--r-- | src/rabbit_networking.erl | 3 | ||||
-rw-r--r-- | src/rabbit_router.erl | 1 |
11 files changed, 115 insertions, 108 deletions
@@ -333,7 +333,8 @@ def genErl(spec): -export([amqp_exception/1]). -export_type([amqp_table/0, amqp_property_type/0, amqp_method_record/0, - amqp_method_name/0, amqp_method/0]). + amqp_method_name/0, amqp_method/0, vhost/0, ctag/0, + resource_name/0, amqp_properties/0, amqp_class_id/0]). bitvalue(true) -> 1; bitvalue(false) -> 0; @@ -371,7 +372,6 @@ bitvalue(undefined) -> 0. -type(resource_name() :: binary()). -type(vhost() :: binary()). -type(ctag() :: binary()). --type(binding_key() :: binary()). -endif. % use_specs """ @@ -477,24 +477,13 @@ def genHrl(spec): print "-record('P_%s', {%s})." % (erlangize(c.name), fieldNameList(c.fields)) -def genSpec(spec): - methods = spec.allMethods() - - printFileHeader() - print """% Hard-coded types -""" - def generateErl(specPath): genErl(AmqpSpec(specPath)) def generateHrl(specPath): genHrl(AmqpSpec(specPath)) -def generateSpec(specPath): - genSpec(AmqpSpec(specPath)) - if __name__ == "__main__": do_main_dict({"header": generateHrl, - "spec": generateSpec, "body": generateErl}) diff --git a/include/rabbit_exchange_type_spec.hrl b/include/rabbit_exchange_type_spec.hrl index 00de0d41..dbbe74f0 100644 --- a/include/rabbit_exchange_type_spec.hrl +++ b/include/rabbit_exchange_type_spec.hrl @@ -32,17 +32,17 @@ -spec(description/0 :: () -> [{atom(), any()}]). -spec(publish/2 :: (rabbit_exchange:exchange(), rabbit:delivery()) - -> {rabbit:routing_result(), [pid()]}). + -> {rabbit_router:routing_result(), [pid()]}). -spec(validate/1 :: (rabbit_exchange:exchange()) -> 'ok'). -spec(create/1 :: (rabbit_exchange:exchange()) -> 'ok'). -spec(recover/2 :: (rabbit_exchange:exchange(), - list(rabbit:binding())) -> 'ok'). + [rabbit_exchange:binding()]) -> 'ok'). -spec(delete/2 :: (rabbit_exchange:exchange(), - list(rabbit:binding())) -> 'ok'). + [rabbit_exchange:binding()]) -> 'ok'). -spec(add_binding/2 :: (rabbit_exchange:exchange(), - rabbit:binding()) -> 'ok'). + rabbit_exchange:binding()) -> 'ok'). -spec(remove_bindings/2 :: (rabbit_exchange:exchange(), - list(rabbit:binding())) -> 'ok'). + [rabbit_exchange:binding()]) -> 'ok'). -spec(assert_args_equivalence/2 :: (rabbit_exchange:exchange(), rabbit_framing:amqp_table()) -> 'ok'). diff --git a/src/rabbit.erl b/src/rabbit.erl index 9d826760..ee295c3b 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -39,9 +39,8 @@ -export([log_location/1]). --export_type([regexp/0, vhost/0, txn/0, resource_name/0, thunk/1, - maybe/1, - msg_id/0, ctag/0, erlang_node/0, message/0, basic_message/0, +-export_type([regexp/0, txn/0, thunk/1,maybe/1, info/0, info_key/0, + msg_id/0, erlang_node/0, message/0, basic_message/0, delivery/0, content/0, decoded_content/0, encoded_content/0, unencoded_content/0]). @@ -204,18 +203,18 @@ properties_bin :: binary(), payload_fragments_rev :: [binary()]} | #content{class_id :: rabbit_framing:amqp_class_id(), - properties :: amqp_properties(), + properties :: rabbit_framing:amqp_properties(), properties_bin :: 'none', payload_fragments_rev :: [binary()]}). -type(unencoded_content() :: undecoded_content()). -type(decoded_content() :: #content{class_id :: rabbit_framing:amqp_class_id(), - properties :: amqp_properties(), + properties :: rabbit_framing:amqp_properties(), properties_bin :: rabbit:maybe(binary()), payload_fragments_rev :: [binary()]}). -type(encoded_content() :: #content{class_id :: rabbit_framing:amqp_class_id(), - properties :: rabbit:maybe(amqp_properties()), + properties :: rabbit:maybe(rabbit_framing:amqp_properties()), properties_bin :: binary(), payload_fragments_rev :: [binary()]}). -type(content() :: undecoded_content() | decoded_content()). @@ -235,24 +234,14 @@ %% this is really an abstract type, but dialyzer does not support them -type(txn() :: rabbit_guid:guid()). --type(permission() :: - #permission{configure :: regexp(), - write :: regexp(), - read :: regexp()}). --type(binding() :: - #binding{exchange_name :: rabbit_exchange:name(), - queue_name :: rabbit_amqqueue:name(), - key :: binding_key()}). %% this really should be an abstract type -type(msg_id() :: non_neg_integer()). --type(listener() :: - #listener{node :: erlang_node(), - protocol :: atom(), - host :: inet:hostname(), - port :: inet:ip_port()}). -type(log_location() :: 'tty' | 'undefined' | file:filename()). -type(file_suffix() :: binary()). +-type(info_key() :: atom()). +-type(info() :: {info_key(), any()}). + -spec(prepare/0 :: () -> 'ok'). -spec(start/0 :: () -> 'ok'). -spec(stop/0 :: () -> 'ok'). diff --git a/src/rabbit_access_control.erl b/src/rabbit_access_control.erl index 1658b5c5..08f00ab2 100644 --- a/src/rabbit_access_control.erl +++ b/src/rabbit_access_control.erl @@ -40,6 +40,7 @@ -export([add_vhost/1, delete_vhost/1, list_vhosts/0]). -export([set_permissions/5, clear_permissions/2, list_vhost_permissions/1, list_user_permissions/1]). +-export_type([username/0]). %%---------------------------------------------------------------------------- @@ -54,28 +55,28 @@ -spec(check_login/2 :: (binary(), binary()) -> user()). -spec(user_pass_login/2 :: (username(), password()) -> user()). --spec(check_vhost_access/2 :: (user(), rabbit:vhost()) -> 'ok'). +-spec(check_vhost_access/2 :: (user(), rabbit_framing:vhost()) -> 'ok'). -spec(check_resource_access/3 :: - (username(), rabbit:r(atom()), permission_atom()) -> 'ok'). + (username(), rabbit_misc:r(atom()), permission_atom()) -> 'ok'). -spec(add_user/2 :: (username(), password()) -> 'ok'). -spec(delete_user/1 :: (username()) -> 'ok'). -spec(change_password/2 :: (username(), password()) -> 'ok'). -spec(list_users/0 :: () -> [username()]). -spec(lookup_user/1 :: (username()) -> - {'ok', user()} | rabbit:not_found()). --spec(add_vhost/1 :: (rabbit:vhost()) -> 'ok'). --spec(delete_vhost/1 :: (rabbit:vhost()) -> 'ok'). --spec(list_vhosts/0 :: () -> [rabbit:vhost()]). + {'ok', user()} | rabbit_misc:not_found()). +-spec(add_vhost/1 :: (rabbit_framing:vhost()) -> 'ok'). +-spec(delete_vhost/1 :: (rabbit_framing:vhost()) -> 'ok'). +-spec(list_vhosts/0 :: () -> [rabbit_framing:vhost()]). -spec(set_permissions/5 :: - (username(), rabbit:vhost(), rabbit:regexp(), + (username(), rabbit_framing:vhost(), rabbit:regexp(), rabbit:regexp(), rabbit:regexp() ) -> 'ok'). --spec(clear_permissions/2 :: (username(), rabbit:vhost()) -> 'ok'). +-spec(clear_permissions/2 :: (username(), rabbit_framing:vhost()) -> 'ok'). -spec(list_vhost_permissions/1 :: - (rabbit:vhost()) -> [{username(), rabbit:regexp(), - rabbit:regexp(), rabbit:regexp()}]). + (rabbit_framing:vhost()) -> [{username(), rabbit:regexp(), + rabbit:regexp(), rabbit:regexp()}]). -spec(list_user_permissions/1 :: - (username()) -> [{rabbit:vhost(), rabbit:regexp(), + (username()) -> [{rabbit_framing:vhost(), rabbit:regexp(), rabbit:regexp(), rabbit:regexp()}]). -endif. diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl index eef3a39b..af8e1a0d 100644 --- a/src/rabbit_amqqueue.erl +++ b/src/rabbit_amqqueue.erl @@ -58,11 +58,7 @@ -ifdef(use_specs). - --type(info_key() :: atom()). --type(info() :: {info_key(), any()}). - --type(name() :: rabbit:r('queue')). +-type(name() :: rabbit_misc:r('queue')). -type(amqqueue() :: #amqqueue{name :: name(), durable :: boolean(), @@ -81,18 +77,20 @@ -spec(start/0 :: () -> 'ok'). -spec(declare/5 :: (name(), boolean(), boolean(), rabbit_framing:amqp_table(), rabbit:maybe(pid())) -> {'new' | 'existing', amqqueue()}). --spec(lookup/1 :: (name()) -> {'ok', amqqueue()} | rabbit:not_found()). --spec(with/2 :: (name(), qfun(A)) -> A | rabbit:not_found()). +-spec(lookup/1 :: (name()) -> {'ok', amqqueue()} | rabbit_misc:not_found()). +-spec(with/2 :: (name(), qfun(A)) -> A | rabbit_misc:not_found()). -spec(with_or_die/2 :: (name(), qfun(A)) -> A). --spec(list/1 :: (rabbit:vhost()) -> [amqqueue()]). --spec(info_keys/0 :: () -> [info_key()]). --spec(info/1 :: (amqqueue()) -> [info()]). --spec(info/2 :: (amqqueue(), [info_key()]) -> [info()]). --spec(info_all/1 :: (rabbit:vhost()) -> [[info()]]). --spec(info_all/2 :: (rabbit:vhost(), [info_key()]) -> [[info()]]). --spec(consumers/1 :: (amqqueue()) -> [{pid(), rabbit:ctag(), boolean()}]). --spec(consumers_all/1 :: - (rabbit:vhost()) -> [{name(), pid(), rabbit:ctag(), boolean()}]). +-spec(list/1 :: (rabbit_framing:vhost()) -> [amqqueue()]). +-spec(info_keys/0 :: () -> [rabbit:info_key()]). +-spec(info/1 :: (amqqueue()) -> [rabbit:info()]). +-spec(info/2 :: (amqqueue(), [rabbit:info_key()]) -> [rabbit:info()]). +-spec(info_all/1 :: (rabbit_framing:vhost()) -> [[rabbit:info()]]). +-spec(info_all/2 :: (rabbit_framing:vhost(), [rabbit:info_key()]) + -> [[rabbit:info()]]). +-spec(consumers/1 :: + (amqqueue()) -> [{pid(), rabbit_framing:ctag(), boolean()}]). +-spec(consumers_all/1 :: (rabbit_framing:vhost()) + -> [{name(), pid(), rabbit_framing:ctag(), boolean()}]). -spec(stat/1 :: (amqqueue()) -> qstats()). -spec(stat_all/0 :: () -> [qstats()]). -spec(delete/3 :: @@ -105,7 +103,8 @@ -spec(purge/1 :: (amqqueue()) -> qlen()). -spec(deliver/2 :: (pid(), rabbit:delivery()) -> boolean()). -spec(requeue/3 :: (pid(), [rabbit:msg_id()], pid()) -> 'ok'). --spec(ack/4 :: (pid(), rabbit:maybe(rabbit:txn()), [rabbit:msg_id()], pid()) -> 'ok'). +-spec(ack/4 :: (pid(), rabbit:maybe(rabbit:txn()), [rabbit:msg_id()], pid()) + -> 'ok'). -spec(commit_all/3 :: ([pid()], rabbit:txn(), pid()) -> ok_or_errors()). -spec(rollback_all/3 :: ([pid()], rabbit:txn(), pid()) -> 'ok'). -spec(notify_down_all/2 :: ([pid()], pid()) -> ok_or_errors()). @@ -113,15 +112,15 @@ -spec(basic_get/3 :: (amqqueue(), pid(), boolean()) -> {'ok', non_neg_integer(), qmsg()} | 'empty'). -spec(basic_consume/7 :: - (amqqueue(), boolean(), pid(), pid() | 'undefined', rabbit:ctag(), + (amqqueue(), boolean(), pid(), pid() | 'undefined', rabbit_framing:ctag(), boolean(), any()) -> 'ok' | {'error', 'exclusive_consume_unavailable'}). --spec(basic_cancel/4 :: (amqqueue(), pid(), rabbit:ctag(), any()) -> 'ok'). +-spec(basic_cancel/4 :: (amqqueue(), pid(), rabbit_framing:ctag(), any()) -> 'ok'). -spec(notify_sent/2 :: (pid(), pid()) -> 'ok'). -spec(unblock/2 :: (pid(), pid()) -> 'ok'). -spec(flush_all/2 :: ([pid()], pid()) -> 'ok'). -spec(internal_declare/2 :: (amqqueue(), boolean()) -> amqqueue() | 'not_found'). --spec(internal_delete/1 :: (name()) -> 'ok' | rabbit:not_found()). +-spec(internal_delete/1 :: (name()) -> 'ok' | rabbit_misc:not_found()). -spec(maybe_run_queue_via_backing_queue/2 :: (pid(), (fun ((A) -> A))) -> 'ok'). -spec(update_ram_duration/1 :: (pid()) -> 'ok'). -spec(set_ram_duration_target/2 :: (pid(), number() | 'infinity') -> 'ok'). diff --git a/src/rabbit_basic.erl b/src/rabbit_basic.erl index cec392cf..8979b83b 100644 --- a/src/rabbit_basic.erl +++ b/src/rabbit_basic.erl @@ -42,20 +42,22 @@ -ifdef(use_specs). --type(properties_input() :: (rabbit:amqp_properties() | [{atom(), any()}])). +-type(properties_input() :: + (rabbit_framing:amqp_properties() | [{atom(), any()}])). -type(publish_result() :: ({ok, rabbit_router:routing_result(), [pid()]} - | rabbit:not_found())). + | rabbit_misc:not_found())). -spec(publish/1 :: (rabbit:delivery()) -> publish_result()). -spec(delivery/4 :: (boolean(), boolean(), rabbit:maybe(rabbit:txn()), rabbit:message()) -> rabbit:delivery()). --spec(message/4 :: (rabbit:exchange_name(), rabbit_router:routing_key(), +-spec(message/4 :: (rabbit_exchange:name(), rabbit_router:routing_key(), properties_input(), binary()) -> (rabbit:message() | {'error', any()})). --spec(properties/1 :: (properties_input()) -> rabbit:amqp_properties()). --spec(publish/4 :: (rabbit:exchange_name(), rabbit_router:routing_key(), +-spec(properties/1 :: + (properties_input()) -> rabbit_framing:amqp_properties()). +-spec(publish/4 :: (rabbit_exchange:name(), rabbit_router:routing_key(), properties_input(), binary()) -> publish_result()). --spec(publish/7 :: (rabbit:exchange_name(), rabbit_router:routing_key(), boolean(), boolean(), +-spec(publish/7 :: (rabbit_exchange:name(), rabbit_router:routing_key(), boolean(), boolean(), rabbit:maybe(rabbit:txn()), properties_input(), binary()) -> publish_result()). -spec(build_content/2 :: (rabbit_framing:amqp_properties(), binary()) diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 93970fe9..080c4c99 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -44,6 +44,8 @@ -export([init/1, terminate/2, code_change/3, handle_call/3, handle_cast/2, handle_info/2, handle_pre_hibernate/1]). +-export_type([channel_number/0]). + -record(ch, {state, channel, reader_pid, writer_pid, limiter_pid, transaction_id, tx_participants, next_tag, uncommitted_ack_q, unacked_message_q, @@ -76,13 +78,14 @@ -spec(start_link/6 :: (channel_number(), pid(), pid(), rabbit_access_control:username(), - rabbit:vhost(), pid()) -> pid()). + rabbit_framing:vhost(), pid()) -> pid()). -spec(do/2 :: (pid(), rabbit_framing:amqp_method_record()) -> 'ok'). -spec(do/3 :: (pid(), rabbit_framing:amqp_method_record(), rabbit:maybe(rabbit:content())) -> 'ok'). -spec(shutdown/1 :: (pid()) -> 'ok'). -spec(send_command/2 :: (pid(), rabbit_framing:amqp_method()) -> 'ok'). --spec(deliver/4 :: (pid(), rabbit:ctag(), boolean(), rabbit_queue:qmsg()) -> 'ok'). +-spec(deliver/4 :: + (pid(), rabbit_framing:ctag(), boolean(), rabbit_queue:qmsg()) -> 'ok'). -spec(conserve_memory/2 :: (pid(), boolean()) -> 'ok'). -spec(flushed/2 :: (pid(), pid()) -> 'ok'). -spec(flow_timeout/2 :: (pid(), ref()) -> 'ok'). diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl index 5a721982..e109158b 100644 --- a/src/rabbit_exchange.erl +++ b/src/rabbit_exchange.erl @@ -43,7 +43,7 @@ -export([assert_args_equivalence/2]). -export([check_type/1]). --export_type([name/0]). +-export_type([name/0, exchange/0, binding/0]). %% EXTENDED API -export([list_exchange_bindings/1]). @@ -58,7 +58,7 @@ -ifdef(use_specs). --type(name() :: rabbit:r('exchange')). +-type(name() :: rabbit_misc:r('exchange')). -type(exchange() :: #exchange{name :: name(), type :: type(), @@ -66,6 +66,12 @@ auto_delete :: boolean(), arguments :: rabbit_framing:amqp_table()}). -type(type() :: atom()). +-type(binding_key() :: binary()). +-type(binding() :: + #binding{exchange_name :: name(), + queue_name :: rabbit_amqqueue:name(), + key :: binding_key()}). + -type(bind_res() :: 'ok' | {'error', 'queue_not_found' | @@ -79,32 +85,42 @@ -spec(check_type/1 :: (binary()) -> atom()). -spec(assert_equivalence/5 :: (exchange(), atom(), boolean(), boolean(), rabbit_framing:amqp_table()) -> 'ok'). --spec(assert_args_equivalence/2 :: (exchange(), rabbit_framing:amqp_table()) -> 'ok'). --spec(lookup/1 :: (name()) -> {'ok', exchange()} | rabbit:not_found()). +-spec(assert_args_equivalence/2 :: + (exchange(), rabbit_framing:amqp_table()) -> 'ok'). +-spec(lookup/1 :: (name()) + -> {'ok', exchange()} | rabbit_misc:not_found()). -spec(lookup_or_die/1 :: (name()) -> exchange()). --spec(list/1 :: (rabbit:vhost()) -> [exchange()]). +-spec(list/1 :: (rabbit_framing:vhost()) -> [exchange()]). -spec(info_keys/0 :: () -> [rabbit:info_key()]). -spec(info/1 :: (exchange()) -> [rabbit:info()]). -spec(info/2 :: (exchange(), [rabbit:info_key()]) -> [rabbit:info()]). --spec(info_all/1 :: (rabbit:vhost()) -> [[rabbit:info()]]). --spec(info_all/2 :: (rabbit:vhost(), [rabbit:info_key()]) -> [[rabbit:info()]]). --spec(publish/2 :: (exchange(), rabbit:delivery()) -> {rabbit_router:routing_result(), [pid()]}). --spec(add_binding/5 :: (name(), rabbit_amqqueue:name(), rabbit_router:routing_key(), - rabbit_framing:amqp_table(), inner_fun()) -> bind_res()). --spec(delete_binding/5 :: (name(), rabbit_amqqueue:name(), rabbit_router:routing_key(), - rabbit_framing:amqp_table(), inner_fun()) -> - bind_res() | {'error', 'binding_not_found'}). --spec(list_bindings/1 :: (rabbit:vhost()) -> - [{name(), rabbit_amqqueue:name(), rabbit_router:routing_key(), rabbit_framing:amqp_table()}]). --spec(delete_queue_bindings/1 :: (rabbit_amqqueue:name()) -> fun (() -> none())). +-spec(info_all/1 :: (rabbit_framing:vhost()) -> [[rabbit:info()]]). +-spec(info_all/2 :: (rabbit_framing:vhost(), [rabbit:info_key()]) + -> [[rabbit:info()]]). +-spec(publish/2 :: (exchange(), rabbit:delivery()) + -> {rabbit_router:routing_result(), [pid()]}). +-spec(add_binding/5 :: + (name(), rabbit_amqqueue:name(), rabbit_router:routing_key(), + rabbit_framing:amqp_table(), inner_fun()) -> bind_res()). +-spec(delete_binding/5 :: + (name(), rabbit_amqqueue:name(), rabbit_router:routing_key(), + rabbit_framing:amqp_table(), inner_fun()) + -> bind_res() | {'error', 'binding_not_found'}). +-spec(list_bindings/1 :: (rabbit_framing:vhost()) -> + [{name(), rabbit_amqqueue:name(), + rabbit_router:routing_key(), rabbit_framing:amqp_table()}]). +-spec(delete_queue_bindings/1 :: + (rabbit_amqqueue:name()) -> fun (() -> none())). -spec(delete_transient_queue_bindings/1 :: (rabbit_amqqueue:name()) -> fun (() -> none())). -spec(delete/2 :: (name(), boolean()) -> 'ok' | rabbit:not_found() | {'error', 'in_use'}). --spec(list_queue_bindings/1 :: (rabbit_amqqueue:name()) -> - [{name(), rabbit_router:routing_key(), rabbit_framing:amqp_table()}]). --spec(list_exchange_bindings/1 :: (name()) -> - [{rabbit_amqqueue:name(), rabbit_router:routing_key(), rabbit_framing:amqp_table()}]). +-spec(list_queue_bindings/1 :: + (rabbit_amqqueue:name()) + -> [{name(), rabbit_router:routing_key(), rabbit_framing:amqp_table()}]). +-spec(list_exchange_bindings/1 :: + (name()) -> [{rabbit_amqqueue:name(), rabbit_router:routing_key(), + rabbit_framing:amqp_table()}]). -endif. diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index ee83e237..cd6dbdd9 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -63,6 +63,8 @@ -export([version_compare/2, version_compare/3]). -export([recursive_delete/1, dict_cons/3, unlink_and_capture_exit/1]). +-export_type([not_found/0, r/1]). + -import(mnesia). -import(lists). -import(cover). @@ -79,16 +81,17 @@ method :: atom()}). -type(not_found() :: {'error', 'not_found'}). -type(r(Kind) :: - #resource{virtual_host :: rabbit:vhost(), + #resource{virtual_host :: rabbit_framing:vhost(), kind :: Kind, - name :: rabbit:resource_name()}). + name :: rabbit_framing:resource_name()}). -spec(method_record_type/1 :: (tuple()) -> atom()). -spec(polite_pause/0 :: () -> 'done'). -spec(polite_pause/1 :: (non_neg_integer()) -> 'done'). -spec(die/1 :: (atom()) -> no_return()). -spec(frame_error/2 :: (atom(), binary()) -> no_return()). --spec(amqp_error/4 :: (atom(), string(), [any()], atom()) -> rabbit_misc:amqp_error()). +-spec(amqp_error/4 :: + (atom(), string(), [any()], atom()) -> rabbit_misc:amqp_error()). -spec(protocol_error/3 :: (atom(), string(), [any()]) -> no_return()). -spec(protocol_error/4 :: (atom(), string(), [any()], atom()) -> no_return()). -spec(not_found/1 :: (r(atom())) -> no_return()). @@ -96,15 +99,18 @@ -spec(get_config/2 :: (atom(), A) -> A). -spec(set_config/2 :: (atom(), any()) -> 'ok'). -spec(dirty_read/1 :: ({atom(), any()}) -> {'ok', any()} | not_found()). --spec(r/3 :: (rabbit:vhost() | rabbit:r(atom()), K, rabbit:resource_name()) -> - rabbit:r(K) when is_subtype(K, atom())). --spec(r/2 :: (rabbit:vhost(), K) -> #resource{virtual_host :: rabbit:vhost(), +-spec(r/3 :: (rabbit_framing:vhost() | r(atom()), K, + rabbit_framing:resource_name()) -> + r(K) when is_subtype(K, atom())). +-spec(r/2 :: (rabbit_framing:vhost(), K) + -> #resource{virtual_host :: rabbit_framing:vhost(), kind :: K, name :: '_'} when is_subtype(K, atom())). --spec(r_arg/4 :: (rabbit:vhost() | rabbit:r(atom()), K, rabbit_framing:amqp_table(), binary()) -> - undefined | rabbit:r(K) when is_subtype(K, atom())). --spec(rs/1 :: (rabbit:r(atom())) -> string()). +-spec(r_arg/4 :: (rabbit_framing:vhost() | r(atom()), K, + rabbit_framing:amqp_table(), binary()) + -> undefined | r(K) when is_subtype(K, atom())). +-spec(rs/1 :: (r(atom())) -> string()). -spec(enable_cover/0 :: () -> ok_or_error()). -spec(start_cover/1 :: ([{string(), string()} | string()]) -> 'ok'). -spec(report_cover/0 :: () -> 'ok'). @@ -115,9 +121,9 @@ -spec(with_exit_handler/2 :: (rabbit:thunk(A), rabbit:thunk(A)) -> A). -spec(filter_exit_map/2 :: (fun ((A) -> B), [A]) -> [B]). -spec(with_user/2 :: (rabbit_access_control:username(), rabbit:thunk(A)) -> A). --spec(with_vhost/2 :: (rabbit:vhost(), rabbit:thunk(A)) -> A). +-spec(with_vhost/2 :: (rabbit_framing:vhost(), rabbit:thunk(A)) -> A). -spec(with_user_and_vhost/3 :: (rabbit_access_control:username(), - rabbit:vhost(), rabbit:thunk(A)) -> A). + rabbit_framing:vhost(), rabbit:thunk(A)) -> A). -spec(execute_mnesia_transaction/1 :: (rabbit:thunk(A)) -> A). -spec(ensure_ok/2 :: (ok_or_error(), atom()) -> 'ok'). -spec(makenode/1 :: ({string(), string()} | string()) -> rabbit:erlang_node()). diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl index ed396647..25ca5914 100644 --- a/src/rabbit_networking.erl +++ b/src/rabbit_networking.erl @@ -73,7 +73,8 @@ -spec(start/0 :: () -> 'ok'). -spec(start_tcp_listener/2 :: (inet:hostname(), inet:ip_port()) -> 'ok'). --spec(start_ssl_listener/3 :: (inet:hostname(), inet:ip_port(), [rabbit:info()]) -> 'ok'). +-spec(start_ssl_listener/3 :: (inet:hostname(), inet:ip_port(), [rabbit:info()]) + -> 'ok'). -spec(stop_tcp_listener/2 :: (inet:hostname(), inet:ip_port()) -> 'ok'). -spec(active_listeners/0 :: () -> [listener()]). -spec(node_listeners/1 :: (rabbit:erlang_node()) -> [listener()]). diff --git a/src/rabbit_router.erl b/src/rabbit_router.erl index 8144d4a9..86ce4128 100644 --- a/src/rabbit_router.erl +++ b/src/rabbit_router.erl @@ -36,6 +36,7 @@ -export([deliver/2, match_bindings/2, match_routing_key/2]). +-export_type([routing_key/0, routing_result/0]). %%---------------------------------------------------------------------------- |