diff options
author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-07-06 12:18:16 +0100 |
---|---|---|
committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2010-07-06 12:18:16 +0100 |
commit | 48f266120343484064adb51385a70b15eefcd275 (patch) | |
tree | f103d937b14cfbceab6bad1078ffac386ab95656 | |
parent | f585792df291dd5566bbc6853309bdc9d299a895 (diff) | |
download | rabbitmq-server-48f266120343484064adb51385a70b15eefcd275.tar.gz |
refactored r types and specs
-rw-r--r-- | src/rabbit_misc.erl | 13 | ||||
-rw-r--r-- | src/rabbit_types.erl | 11 |
2 files changed, 13 insertions, 11 deletions
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 0133b9cf..1940ab65 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -75,8 +75,8 @@ -export_type([resource_name/0]). -type(ok_or_error() :: rabbit_types:ok_or_error(any())). --type(resource_name() :: binary()). -type(thunk(T) :: fun(() -> T)). +-type(resource_name() :: binary()). -spec(method_record_type/1 :: (rabbit_framing:amqp_method_record()) -> rabbit_framing:amqp_method_name()). @@ -97,13 +97,12 @@ -spec(get_config/2 :: (atom(), A) -> A). -spec(set_config/2 :: (atom(), any()) -> 'ok'). -spec(dirty_read/1 :: ({atom(), any()}) -> rabbit_types:ok(any()) | rabbit_types:error('not_found')). --spec(r/3 :: (rabbit_types:vhost() | rabbit_types:r(atom()), K, resource_name()) - -> rabbit_types:r(K) when is_subtype(K, atom())). -spec(r/2 :: (rabbit_types:vhost(), K) - -> #resource{virtual_host :: rabbit_types:vhost(), - kind :: K, - name :: '_'} - when is_subtype(K, atom())). + -> rabbit_types:r(rabbit_types:vhost(), K) + when is_subtype(K, atom())). +-spec(r/3 :: (rabbit_types:vhost() | rabbit_types:r(atom()), K, resource_name()) + -> rabbit_types:r(rabbit_types:vhost(), K, resource_name()) + when is_subtype(K, atom())). -spec(r_arg/4 :: (rabbit_types:vhost() | rabbit_types:r(atom()), K, rabbit_framing:amqp_table(), binary()) -> undefined | rabbit_types:r(K) when is_subtype(K, atom())). diff --git a/src/rabbit_types.erl b/src/rabbit_types.erl index e42c6b44..212ae840 100644 --- a/src/rabbit_types.erl +++ b/src/rabbit_types.erl @@ -38,7 +38,7 @@ -export_type([txn/0, maybe/1, info/0, info_key/0, message/0, basic_message/0, delivery/0, content/0, decoded_content/0, undecoded_content/0, unencoded_content/0, encoded_content/0, vhost/0, ctag/0, amqp_error/0, - r/1, ssl_socket/0, listener/0, binding/0, amqqueue/0, + r/1, r/2, r/3, ssl_socket/0, listener/0, binding/0, amqqueue/0, exchange/0, connection/0, user/0, error/1, ok_or_error/1, ok/1]). -type(maybe(T) :: T | 'none'). @@ -92,10 +92,13 @@ #amqp_error{name :: rabbit_framing:amqp_exception(), explanation :: string(), method :: rabbit_framing:amqp_method_name()}). --type(r(Kind) :: - #resource{virtual_host :: rabbit_types:vhost(), + +-type(r(Kind) :: r(vhost(), Kind, rabbit_misc:resource_name())). +-type(r(VirtualHost, Kind) :: r(VirtualHost, Kind, rabbit_misc:resource_name())). +-type(r(VirtualHost, Kind, Name) :: + #resource{virtual_host :: VirtualHost, kind :: Kind, - name :: rabbit_misc:resource_name()}). + name :: Name}). -type(ssl_socket() :: #ssl_socket{}). |