diff options
author | Matthew Sackman <matthew@rabbitmq.com> | 2011-01-18 14:07:52 +0000 |
---|---|---|
committer | Matthew Sackman <matthew@rabbitmq.com> | 2011-01-18 14:07:52 +0000 |
commit | 707ea589a37bbf8c2004baad35818238e96696de (patch) | |
tree | ec23555f4fd4bd89e9b6a6fb40f038e08526a05a | |
parent | dd1937a0c465d716c115963838feb90c1c388486 (diff) | |
download | rabbitmq-server-707ea589a37bbf8c2004baad35818238e96696de.tar.gz |
Correct specs
-rw-r--r-- | src/rabbit_amqqueue.erl | 4 | ||||
-rw-r--r-- | src/rabbit_binding.erl | 13 | ||||
-rw-r--r-- | src/rabbit_misc.erl | 5 |
3 files changed, 13 insertions, 9 deletions
diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl index 9626e126..db07f136 100644 --- a/src/rabbit_amqqueue.erl +++ b/src/rabbit_amqqueue.erl @@ -69,6 +69,8 @@ -type(ok_or_errors() :: 'ok' | {'error', [{'error' | 'exit' | 'throw', any()}]}). +-type(queue_or_not_found() :: rabbit_types:amqqueue() | 'not_found'). + -spec(start/0 :: () -> 'ok'). -spec(stop/0 :: () -> 'ok'). -spec(declare/5 :: @@ -147,7 +149,7 @@ -spec(flush_all/2 :: ([pid()], pid()) -> 'ok'). -spec(internal_declare/2 :: (rabbit_types:amqqueue(), boolean()) - -> rabbit_types:amqqueue() | 'not_found'). + -> queue_or_not_found() | rabbit_misc:thunk(queue_or_not_found())). -spec(internal_delete/1 :: (name()) -> rabbit_types:ok_or_error('not_found') | rabbit_types:connection_exit()). diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl index 74fd00b7..9742c4b6 100644 --- a/src/rabbit_binding.erl +++ b/src/rabbit_binding.erl @@ -59,17 +59,18 @@ rabbit_types:exchange() | rabbit_types:amqqueue()) -> rabbit_types:ok_or_error(rabbit_types:amqp_error()))). -type(bindings() :: [rabbit_types:binding()]). +-type(add_res() :: bind_res() | rabbit_misc:const(bind_res())). +-type(bind_or_error() :: bind_res() | rabbit_types:error('binding_not_found')). +-type(remove_res() :: bind_or_error() | rabbit_misc:const(bind_or_error())). -opaque(deletions() :: dict()). -spec(recover/0 :: () -> [rabbit_types:binding()]). -spec(exists/1 :: (rabbit_types:binding()) -> boolean() | bind_errors()). --spec(add/1 :: (rabbit_types:binding()) -> bind_res()). --spec(remove/1 :: (rabbit_types:binding()) -> - bind_res() | rabbit_types:error('binding_not_found')). --spec(add/2 :: (rabbit_types:binding(), inner_fun()) -> bind_res()). --spec(remove/2 :: (rabbit_types:binding(), inner_fun()) -> - bind_res() | rabbit_types:error('binding_not_found')). +-spec(add/1 :: (rabbit_types:binding()) -> add_res()). +-spec(remove/1 :: (rabbit_types:binding()) -> remove_res()). +-spec(add/2 :: (rabbit_types:binding(), inner_fun()) -> add_res()). +-spec(remove/2 :: (rabbit_types:binding(), inner_fun()) -> remove_res()). -spec(list/1 :: (rabbit_types:vhost()) -> bindings()). -spec(list_for_source/1 :: (rabbit_types:binding_source()) -> bindings()). diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 9e8ba91b..14f03a77 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -75,10 +75,11 @@ -ifdef(use_specs). --export_type([resource_name/0, thunk/1]). +-export_type([resource_name/0, thunk/1, const/1]). -type(ok_or_error() :: rabbit_types:ok_or_error(any())). -type(thunk(T) :: fun(() -> T)). +-type(const(T) :: fun((any()) -> T)). -type(resource_name() :: binary()). -type(optdef() :: {flag, string()} | {option, string(), any()}). -type(channel_or_connection_exit() @@ -204,7 +205,7 @@ -spec(now_ms/0 :: () -> non_neg_integer()). -spec(lock_file/1 :: (file:filename()) -> rabbit_types:ok_or_error('eexist')). -spec(const_ok/1 :: (any()) -> 'ok'). --spec(const/1 :: (A) -> fun ((_) -> A)). +-spec(const/1 :: (A) -> const(A)). -endif. |