diff options
author | Jerry Kuch <jerryk@vmware.com> | 2010-11-18 13:17:14 +0000 |
---|---|---|
committer | Jerry Kuch <jerryk@vmware.com> | 2010-11-18 13:17:14 +0000 |
commit | 218d06dfd68eea0e5068336971ac0c862a62c48c (patch) | |
tree | f47d9674b92766191ec5bbae02a477f7085f1f5d | |
parent | 6d322d651d1515d58e2371c9ffe8a8fd9758bede (diff) | |
download | rabbitmq-server-218d06dfd68eea0e5068336971ac0c862a62c48c.tar.gz |
Merge add_internal_to_[exchange|durable_exchange] into single upgrade function.
Per Simon's feedback---they really belong together.
-rw-r--r-- | src/rabbit_upgrade_functions.erl | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/rabbit_upgrade_functions.erl b/src/rabbit_upgrade_functions.erl index 98db3c3b..bf8e3a1f 100644 --- a/src/rabbit_upgrade_functions.erl +++ b/src/rabbit_upgrade_functions.erl @@ -27,8 +27,7 @@ -rabbit_upgrade({remove_user_scope, []}). -rabbit_upgrade({hash_passwords, []}). -rabbit_upgrade({add_ip_to_listener, []}). --rabbit_upgrade({add_internal_to_exchange, []}). --rabbit_upgrade({add_internal_to_durable_exchange, []}). +-rabbit_upgrade({add_internal_to_exchange_and_durable_exchange, []}). %% ------------------------------------------------------------------- @@ -37,8 +36,7 @@ -spec(remove_user_scope/0 :: () -> 'ok'). -spec(hash_passwords/0 :: () -> 'ok'). -spec(add_ip_to_listener/0 :: () -> 'ok'). --spec(add_internal_to_exchange/0 :: () -> 'ok'). --spec(add_internal_to_durable_exchange/0 :: () -> 'ok'). +-spec(add_internal_to_exchange_and_durable_exchange/0 :: () -> 'ok'). -endif. @@ -75,20 +73,18 @@ add_ip_to_listener() -> end, [node, protocol, host, ip_address, port]). -add_internal_to_exchange() -> - mnesia( - rabbit_exchange, - fun ({exchange, Name, Type, Durable, AutoDelete, Args}) -> - {exchange, Name, Type, Durable, AutoDelete, false, Args} - end, - [name, type, durable, auto_delete, internal, arguments]). - -add_internal_to_durable_exchange() -> +add_internal_to_exchange_and_durable_exchange() -> + AddInternalFun = + fun ({exchange, Name, Type, Durable, AutoDelete, Args}) -> + {exchange, Name, Type, Durable, AutoDelete, false, Args} + end, + ok = mnesia( + rabbit_exchange, + AddInternalFun, + [name, type, durable, auto_delete, internal, arguments]), mnesia( rabbit_durable_exchange, - fun ({exchange, Name, Type, Durable, AutoDelete, Args}) -> - {exchange, Name, Type, Durable, AutoDelete, false, Args} - end, + AddInternalFun, [name, type, durable, auto_delete, internal, arguments]). %%-------------------------------------------------------------------- |