diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2012-03-27 15:17:16 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2012-03-27 15:17:16 +0100 |
| commit | d921ad17ea24a4a042e46eb20710fc1a76e0db0b (patch) | |
| tree | 2a9753c51afb4bc744ee0677ff9bfe49be9910ca /src | |
| parent | 799eee63e19fa4313125ea4c02c524a924ad6205 (diff) | |
| download | rabbitmq-server-git-d921ad17ea24a4a042e46eb20710fc1a76e0db0b.tar.gz | |
API tweak
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_control.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_runtime_parameter.erl | 4 | ||||
| -rw-r--r-- | src/rabbit_runtime_parameters.erl | 16 |
3 files changed, 14 insertions, 8 deletions
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index cd1df2e258..3e6ec0993c 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -271,7 +271,7 @@ action(set_parameter, Node, [AppName, Key, Value], _Opts, Inform) -> Inform("Setting runtime parameter ~p for app ~p to ~p", [Key, AppName, Value]), rpc_call(Node, rabbit_runtime_parameters, set, - [list_to_atom(AppName), list_to_atom(Key), + [list_to_atom(AppName), list_to_binary(Key), rabbit_runtime_parameters:parse(Value)]); action(clear_parameter, Node, [AppName, Key], _Opts, Inform) -> diff --git a/src/rabbit_runtime_parameter.erl b/src/rabbit_runtime_parameter.erl index ea37fda194..239a533bef 100644 --- a/src/rabbit_runtime_parameter.erl +++ b/src/rabbit_runtime_parameter.erl @@ -20,8 +20,8 @@ behaviour_info(callbacks) -> [ - {validate, 2}, - {notify, 2} + {validate, 3}, + {notify, 3} ]; behaviour_info(_Other) -> undefined. diff --git a/src/rabbit_runtime_parameters.erl b/src/rabbit_runtime_parameters.erl index d1ff159d0b..305afb25d1 100644 --- a/src/rabbit_runtime_parameters.erl +++ b/src/rabbit_runtime_parameters.erl @@ -18,8 +18,8 @@ -include("rabbit.hrl"). --export([parse/1, set/3, clear/2, list/0, list_formatted/0, lookup/2, value/3, - info_keys/0]). +-export([parse/1, set/3, clear/2, list/0, list_formatted/0, lookup/2, value/2, + value/3, info_keys/0]). -import(rabbit_misc, [pget/2, pset/3]). @@ -30,12 +30,12 @@ set(AppName, Key, Term) -> Module = lookup_app(AppName), validate(Term), - Module:validate(Key, Term), + Module:validate(AppName, Key, Term), ok = rabbit_misc:execute_mnesia_transaction( fun () -> ok = mnesia:write(?TABLE, c(AppName, Key, Term), write) end), - Module:notify(Key, Term), + Module:notify(AppName, Key, Term), ok. clear(AppName, Key) -> @@ -51,11 +51,17 @@ list_formatted() -> [pset(value, format(pget(value, P)), P) || P <- list()]. lookup(AppName, Key) -> - case lookup0(AppName, Key, rabbit_misc:const(not_found)) of + case value(AppName, Key) of not_found -> not_found; Params -> p(Params) end. +value(AppName, Key) -> + case lookup0(AppName, Key, rabbit_misc:const(not_found)) of + not_found -> not_found; + Params -> Params#runtime_parameters.value + end. + value(AppName, Key, Default) -> Params = lookup0(AppName, Key, fun () -> lookup_missing(AppName, Key, Default) end), |
