summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2010-07-30 17:22:45 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2010-07-30 17:22:45 +0100
commit67a67d0384902b6e15bc1293ec8e02aba4b84f34 (patch)
tree642419aaed93b64dbbf6ac9f56888947c3f97872
parentfb7a0b5c07e38bfb7ff0e7a00306fed145f0fb05 (diff)
downloadrabbitmq-server-bug23022.tar.gz
added connection_exit() and channel_exit() to relevant function specsbug23022
-rw-r--r--codegen.py3
-rw-r--r--include/rabbit_exchange_type_spec.hrl5
-rw-r--r--src/rabbit_access_control.erl16
-rw-r--r--src/rabbit_amqqueue.erl25
-rw-r--r--src/rabbit_basic.erl8
-rw-r--r--src/rabbit_exchange.erl34
-rw-r--r--src/rabbit_misc.erl16
-rw-r--r--src/rabbit_types.erl6
8 files changed, 74 insertions, 39 deletions
diff --git a/codegen.py b/codegen.py
index 1244aae1..420fc870 100644
--- a/codegen.py
+++ b/codegen.py
@@ -401,7 +401,8 @@ def genErl(spec):
-spec(is_method_synchronous/1 :: (amqp_method_record()) -> boolean()).
-spec(method_record/1 :: (amqp_method_name()) -> amqp_method_record()).
-spec(method_fieldnames/1 :: (amqp_method_name()) -> [amqp_method_field_name()]).
--spec(decode_method_fields/2 :: (amqp_method_name(), binary()) -> amqp_method_record()).
+-spec(decode_method_fields/2 ::
+ (amqp_method_name(), binary()) -> amqp_method_record() | rabbit_types:connection_exit()).
-spec(decode_properties/2 :: (non_neg_integer(), binary()) -> amqp_property_record()).
-spec(encode_method_fields/1 :: (amqp_method_record()) -> binary()).
-spec(encode_properties/1 :: (amqp_method_record()) -> binary()).
diff --git a/include/rabbit_exchange_type_spec.hrl b/include/rabbit_exchange_type_spec.hrl
index f05bcb84..cecd666b 100644
--- a/include/rabbit_exchange_type_spec.hrl
+++ b/include/rabbit_exchange_type_spec.hrl
@@ -43,7 +43,8 @@
rabbit_types:binding()) -> 'ok').
-spec(remove_bindings/2 :: (rabbit_types:exchange(),
[rabbit_types:binding()]) -> 'ok').
--spec(assert_args_equivalence/2 :: (rabbit_types:exchange(),
- rabbit_framing:amqp_table()) -> 'ok').
+-spec(assert_args_equivalence/2 ::
+ (rabbit_types:exchange(), rabbit_framing:amqp_table())
+ -> 'ok' | rabbit_types:connection_exit()).
-endif.
diff --git a/src/rabbit_access_control.erl b/src/rabbit_access_control.erl
index 3aaf5928..55d738ff 100644
--- a/src/rabbit_access_control.erl
+++ b/src/rabbit_access_control.erl
@@ -52,12 +52,16 @@
-type(password() :: binary()).
-type(regexp() :: binary()).
--spec(check_login/2 :: (binary(), binary()) -> rabbit_types:user()).
+-spec(check_login/2 ::
+ (binary(), binary()) -> rabbit_types:user() |
+ rabbit_types:channel_exit()).
-spec(user_pass_login/2 :: (username(), password()) -> rabbit_types:user()).
-spec(check_vhost_access/2 ::
- (rabbit_types:user(), rabbit_types:vhost()) -> 'ok').
+ (rabbit_types:user(), rabbit_types:vhost())
+ -> 'ok' | rabbit_types:channel_exit()).
-spec(check_resource_access/3 ::
- (username(), rabbit_types:r(atom()), permission_atom()) -> 'ok').
+ (username(), rabbit_types:r(atom()), permission_atom())
+ -> 'ok' | rabbit_types:channel_exit()).
-spec(add_user/2 :: (username(), password()) -> 'ok').
-spec(delete_user/1 :: (username()) -> 'ok').
-spec(change_password/2 :: (username(), password()) -> 'ok').
@@ -65,8 +69,10 @@
-spec(lookup_user/1 ::
(username()) -> rabbit_types:ok(rabbit_types:user())
| rabbit_types:error('not_found')).
--spec(add_vhost/1 :: (rabbit_types:vhost()) -> 'ok').
--spec(delete_vhost/1 :: (rabbit_types:vhost()) -> 'ok').
+-spec(add_vhost/1 ::
+ (rabbit_types:vhost()) -> 'ok' | rabbit_types:connection_exit()).
+-spec(delete_vhost/1 ::
+ (rabbit_types:vhost()) -> 'ok' | rabbit_types:connection_exit()).
-spec(list_vhosts/0 :: () -> [rabbit_types:vhost()]).
-spec(set_permissions/5 ::(username(), rabbit_types:vhost(), regexp(),
regexp(), regexp()) -> 'ok').
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl
index 6bf2f6db..6eace7e9 100644
--- a/src/rabbit_amqqueue.erl
+++ b/src/rabbit_amqqueue.erl
@@ -77,18 +77,24 @@
-spec(declare/5 ::
(name(), boolean(), boolean(),
rabbit_framing:amqp_table(), rabbit_types:maybe(pid()))
- -> {'new' | 'existing', rabbit_types:amqqueue()}).
+ -> {'new' | 'existing', rabbit_types:amqqueue()} |
+ rabbit_types:channel_error()).
-spec(lookup/1 ::
(name()) -> rabbit_types:ok(rabbit_types:amqqueue()) |
rabbit_types:error('not_found')).
-spec(with/2 :: (name(), qfun(A)) -> A | rabbit_types:error('not_found')).
--spec(with_or_die/2 :: (name(), qfun(A)) -> A).
+-spec(with_or_die/2 ::
+ (name(), qfun(A)) -> A | rabbit_types:channel_exit()).
-spec(assert_equivalence/5 ::
(rabbit_types:amqqueue(), boolean(), boolean(),
rabbit_framing:amqp_table(), rabbit_types:maybe(pid()))
- -> 'ok' | no_return()).
--spec(check_exclusive_access/2 :: (rabbit_types:amqqueue(), pid()) -> 'ok').
--spec(with_exclusive_access_or_die/3 :: (name(), pid(), qfun(A)) -> A).
+ -> 'ok' | rabbit_types:channel_exit() |
+ rabbit_types:connection_exit()).
+-spec(check_exclusive_access/2 ::
+ (rabbit_types:amqqueue(), pid())
+ -> 'ok' | rabbit_types:channel_exit()).
+-spec(with_exclusive_access_or_die/3 ::
+ (name(), pid(), qfun(A)) -> A | rabbit_types:channel_exit()).
-spec(list/1 :: (rabbit_types:vhost()) -> [rabbit_types:amqqueue()]).
-spec(info_keys/0 :: () -> [rabbit_types:info_key()]).
-spec(info/1 :: (rabbit_types:amqqueue()) -> [rabbit_types:info()]).
@@ -141,15 +147,18 @@
-spec(flush_all/2 :: ([pid()], pid()) -> 'ok').
-spec(internal_declare/2 ::
(rabbit_types:amqqueue(), boolean())
- -> rabbit_types:amqqueue() | 'not_found').
--spec(internal_delete/1 :: (name()) -> rabbit_types:ok_or_error('not_found')).
+ -> rabbit_types:amqqueue() | 'not_found' |
+ rabbit_types:connection_exit()).
+-spec(internal_delete/1 ::
+ (name()) -> rabbit_types:ok_or_error('not_found') |
+ rabbit_types:connection_exit()).
-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').
-spec(set_maximum_since_use/2 :: (pid(), non_neg_integer()) -> 'ok').
-spec(maybe_expire/1 :: (pid()) -> 'ok').
--spec(on_node_down/1 :: (node()) -> 'ok').
+-spec(on_node_down/1 :: (node()) -> 'ok' | rabbit_types:connection_exit()).
-spec(pseudo_queue/2 :: (binary(), pid()) -> rabbit_types:amqqueue()).
-endif.
diff --git a/src/rabbit_basic.erl b/src/rabbit_basic.erl
index 03a19961..848c1e91 100644
--- a/src/rabbit_basic.erl
+++ b/src/rabbit_basic.erl
@@ -48,7 +48,9 @@
({ok, rabbit_router:routing_result(), [pid()]}
| rabbit_types:error('not_found'))).
--spec(publish/1 :: (rabbit_types:delivery()) -> publish_result()).
+-spec(publish/1 ::
+ (rabbit_types:delivery()) -> publish_result() |
+ rabbit_types:connection_exit()).
-spec(delivery/4 ::
(boolean(), boolean(), rabbit_types:maybe(rabbit_types:txn()),
rabbit_types:message())
@@ -62,12 +64,12 @@
-spec(publish/4 ::
(rabbit_exchange:name(), rabbit_router:routing_key(),
properties_input(), binary())
- -> publish_result()).
+ -> publish_result() | rabbit_types:connection_exit()).
-spec(publish/7 ::
(rabbit_exchange:name(), rabbit_router:routing_key(),
boolean(), boolean(), rabbit_types:maybe(rabbit_types:txn()),
properties_input(), binary())
- -> publish_result()).
+ -> publish_result() | rabbit_types:connection_exit()).
-spec(build_content/2 ::
(rabbit_framing:amqp_property_record(), binary())
-> rabbit_types:content()).
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl
index 7f7622b2..b4b2ae68 100644
--- a/src/rabbit_exchange.erl
+++ b/src/rabbit_exchange.erl
@@ -67,22 +67,25 @@
fun((rabbit_types:exchange(), queue()) ->
rabbit_types:ok_or_error(rabbit_types:amqp_error()))).
--spec(recover/0 :: () -> 'ok').
+-spec(recover/0 :: () -> 'ok' | rabbit_types:connection_exit()).
-spec(declare/5 ::
(name(), type(), boolean(), boolean(), rabbit_framing:amqp_table())
- -> rabbit_types:exchange()).
--spec(check_type/1 :: (binary()) -> atom()).
+ -> rabbit_types:exchange() | rabbit_types:connection_exit()).
+-spec(check_type/1 ::
+ (binary()) -> atom() | rabbit_types:connection_exit()).
-spec(assert_equivalence/5 ::
(rabbit_types:exchange(), atom(), boolean(), boolean(),
rabbit_framing:amqp_table())
- -> 'ok' | no_return()).
+ -> 'ok' | rabbit_types:connection_exit()).
-spec(assert_args_equivalence/2 ::
- (rabbit_types:exchange(), rabbit_framing:amqp_table()) ->
- 'ok' | no_return()).
+ (rabbit_types:exchange(), rabbit_framing:amqp_table())
+ -> 'ok' | rabbit_types:connection_exit()).
-spec(lookup/1 ::
(name()) -> rabbit_types:ok(rabbit_types:exchange()) |
rabbit_types:error('not_found')).
--spec(lookup_or_die/1 :: (name()) -> rabbit_types:exchange()).
+-spec(lookup_or_die/1 ::
+ (name()) -> rabbit_types:exchange() |
+ rabbit_types:channel_exit()).
-spec(list/1 :: (rabbit_types:vhost()) -> [rabbit_types:exchange()]).
-spec(info_keys/0 :: () -> [rabbit_types:info_key()]).
-spec(info/1 :: (rabbit_types:exchange()) -> [rabbit_types:info()]).
@@ -93,27 +96,32 @@
-spec(info_all/2 ::(rabbit_types:vhost(), [rabbit_types:info_key()])
-> [[rabbit_types:info()]]).
-spec(publish/2 :: (rabbit_types:exchange(), rabbit_types:delivery())
- -> {rabbit_router:routing_result(), [pid()]}).
+ -> {rabbit_router:routing_result(), [pid()]} |
+ rabbit_types:connection_exit()).
-spec(add_binding/5 ::
(name(), rabbit_amqqueue:name(), rabbit_router:routing_key(),
rabbit_framing:amqp_table(), inner_fun())
- -> bind_res()).
+ -> bind_res() | rabbit_types:connection_exit()).
-spec(delete_binding/5 ::
(name(), rabbit_amqqueue:name(), rabbit_router:routing_key(),
rabbit_framing:amqp_table(), inner_fun())
- -> bind_res() | rabbit_types:error('binding_not_found')).
+ -> bind_res() | rabbit_types:error('binding_not_found') |
+ rabbit_types:connection_exit()).
-spec(list_bindings/1 ::
(rabbit_types:vhost())
-> [{name(), rabbit_amqqueue:name(), rabbit_router:routing_key(),
rabbit_framing:amqp_table()}]).
-spec(delete_queue_bindings/1 ::
- (rabbit_amqqueue:name()) -> fun (() -> none())).
+ (rabbit_amqqueue:name())
+ -> fun (() -> none()) | rabbit_types:connection_exit()).
-spec(delete_transient_queue_bindings/1 ::
- (rabbit_amqqueue:name()) -> fun (() -> none())).
+ (rabbit_amqqueue:name())
+ -> fun (() -> none()) | rabbit_types:connection_exit()).
-spec(delete/2 ::
(name(), boolean())-> 'ok' |
rabbit_types:error('not_found') |
- rabbit_types:error('in_use')).
+ rabbit_types:error('in_use') |
+ rabbit_types:connection_exit()).
-spec(list_queue_bindings/1 ::
(rabbit_amqqueue:name())
-> [{name(), rabbit_router:routing_key(),
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index 050b499f..7543ae5b 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -84,25 +84,29 @@
-> rabbit_framing:amqp_method_name()).
-spec(polite_pause/0 :: () -> 'done').
-spec(polite_pause/1 :: (non_neg_integer()) -> 'done').
--spec(die/1 :: (rabbit_framing:amqp_exception()) -> no_return()).
+-spec(die/1 ::
+ (rabbit_framing:amqp_exception())
+ -> rabbit_types:channel_exit() | rabbit_types:connection_exit()).
-spec(frame_error/2 :: (rabbit_framing:amqp_method_name(), binary())
- -> no_return()).
+ -> rabbit_types:connection_exit()).
-spec(amqp_error/4 ::
(rabbit_framing:amqp_exception(), string(), [any()],
rabbit_framing:amqp_method_name())
-> rabbit_types:amqp_error()).
-spec(protocol_error/3 :: (rabbit_framing:amqp_exception(), string(), [any()])
- -> no_return()).
+ -> rabbit_types:channel_exit() |
+ rabbit_types:connection_exit()).
-spec(protocol_error/4 ::
(rabbit_framing:amqp_exception(), string(), [any()],
rabbit_framing:amqp_method_name())
- -> no_return()).
+ -> rabbit_types:channel_exit() |
+ rabbit_types:connection_exit()).
-spec(protocol_error/1 :: (rabbit_types:amqp_error()) -> no_return()).
--spec(not_found/1 :: (rabbit_types:r(atom())) -> no_return()).
+-spec(not_found/1 :: (rabbit_types:r(atom())) -> rabbit_types:channel_exit()).
-spec(assert_args_equivalence/4 :: (rabbit_framing:amqp_table(),
rabbit_framing:amqp_table(),
rabbit_types:r(any()), [binary()]) ->
- 'ok' | no_return()).
+ 'ok' | rabbit_types:connection_exit()).
-spec(get_config/1 ::
(atom()) -> rabbit_types:ok_or_error2(any(), 'not_found')).
-spec(get_config/2 :: (atom(), A) -> A).
diff --git a/src/rabbit_types.erl b/src/rabbit_types.erl
index 2e492b80..1f182593 100644
--- a/src/rabbit_types.erl
+++ b/src/rabbit_types.erl
@@ -40,7 +40,11 @@
unencoded_content/0, encoded_content/0, vhost/0, ctag/0,
amqp_error/0, r/1, r2/2, r3/3, ssl_socket/0, listener/0,
binding/0, amqqueue/0, exchange/0, connection/0, user/0,
- error/1, ok_or_error/1, ok_or_error2/2, ok/1]).
+ error/1, ok_or_error/1, ok_or_error2/2, ok/1,
+ channel_exit/0, connection_exit/0]).
+
+-type(channel_exit() :: no_return()).
+-type(connection_exit() :: no_return()).
-type(maybe(T) :: T | 'none').
-type(vhost() :: binary()).