summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-04-19 14:07:20 +0100
committerSimon MacMullen <simon@rabbitmq.com>2012-04-19 14:07:20 +0100
commit385c6d7f781e5ff6cf9670ac9e50d124031d1bad (patch)
tree2b180fa3d50f046afc2e455e8291859cf075cfe1
parentaa4a13a186c3a877325045932d253b5014f73a96 (diff)
downloadrabbitmq-server-385c6d7f781e5ff6cf9670ac9e50d124031d1bad.tar.gz
s/app_name/component/g
-rw-r--r--docs/rabbitmqctl.1.xml20
-rw-r--r--src/rabbit_control.erl14
-rw-r--r--src/rabbit_runtime_parameters.erl93
3 files changed, 64 insertions, 63 deletions
diff --git a/docs/rabbitmqctl.1.xml b/docs/rabbitmqctl.1.xml
index 7c74f20d..1effd691 100644
--- a/docs/rabbitmqctl.1.xml
+++ b/docs/rabbitmqctl.1.xml
@@ -750,24 +750,24 @@
Certain features of RabbitMQ (such as the federation plugin)
are controlled by dynamic,
cluster-wide <emphasis>parameters</emphasis>. Each parameter
- consists of an application name, a key and a value. The
- application name and key are strings, and the value is an
+ consists of a component name, a key and a value. The
+ component name and key are strings, and the value is an
Erlang term. Parameters can be set, cleared and listed. In
general you should refer to the documentation for the feature
in question to see how to set parameters.
</para>
<variablelist>
<varlistentry>
- <term><cmdsynopsis><command>set_parameter</command> <arg choice="req"><replaceable>app_name</replaceable></arg> <arg choice="req"><replaceable>key</replaceable></arg> <arg choice="req"><replaceable>value</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>set_parameter</command> <arg choice="req"><replaceable>component_name</replaceable></arg> <arg choice="req"><replaceable>key</replaceable></arg> <arg choice="req"><replaceable>value</replaceable></arg></cmdsynopsis></term>
<listitem>
<para>
Sets a parameter.
</para>
<variablelist>
<varlistentry>
- <term>app_name</term>
+ <term>component_name</term>
<listitem><para>
- The name of the application for which the
+ The name of the component for which the
parameter is being set.
</para></listitem>
</varlistentry>
@@ -789,21 +789,21 @@
<para role="example-prefix">For example:</para>
<screen role="example">rabbitmqctl set_parameter federation local_username '&lt;&lt;"guest">>'</screen>
<para role="example">
- This command sets the parameter <command>local_username</command> for the <command>federation</command> application to the Erlang term <command>&lt;&lt;"guest">></command>.
+ This command sets the parameter <command>local_username</command> for the <command>federation</command> component to the Erlang term <command>&lt;&lt;"guest">></command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term><cmdsynopsis><command>clear_parameter</command> <arg choice="req"><replaceable>app_name</replaceable></arg> <arg choice="req"><replaceable>key</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>clear_parameter</command> <arg choice="req"><replaceable>component_name</replaceable></arg> <arg choice="req"><replaceable>key</replaceable></arg></cmdsynopsis></term>
<listitem>
<para>
Clears a parameter.
</para>
<variablelist>
<varlistentry>
- <term>app_name</term>
+ <term>component_name</term>
<listitem><para>
- The name of the application for which the
+ The name of the component for which the
parameter is being cleared.
</para></listitem>
</varlistentry>
@@ -817,7 +817,7 @@
<para role="example-prefix">For example:</para>
<screen role="example">rabbitmqctl clear_parameter federation local_username</screen>
<para role="example">
- This command clears the parameter <command>local_username</command> for the <command>federation</command> application.
+ This command clears the parameter <command>local_username</command> for the <command>federation</command> component.
</para>
</listitem>
</varlistentry>
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl
index f41d465e..9f99f17a 100644
--- a/src/rabbit_control.erl
+++ b/src/rabbit_control.erl
@@ -350,15 +350,15 @@ action(list_permissions, Node, [], Opts, Inform) ->
list_vhost_permissions, [VHost]}),
rabbit_auth_backend_internal:vhost_perms_info_keys());
-action(set_parameter, Node, [AppName, Key, Value], _Opts, Inform) ->
- Inform("Setting runtime parameter ~p for app ~p to ~p",
- [Key, AppName, Value]),
+action(set_parameter, Node, [Component, Key, Value], _Opts, Inform) ->
+ Inform("Setting runtime parameter ~p for component ~p to ~p",
+ [Key, Component, Value]),
rpc_call(Node, rabbit_runtime_parameters, parse_set,
- [list_to_binary(AppName), list_to_binary(Key), Value]);
+ [list_to_binary(Component), list_to_binary(Key), Value]);
-action(clear_parameter, Node, [AppName, Key], _Opts, Inform) ->
- Inform("Clearing runtime parameter ~p for app ~p", [Key, AppName]),
- rpc_call(Node, rabbit_runtime_parameters, clear, [list_to_binary(AppName),
+action(clear_parameter, Node, [Component, Key], _Opts, Inform) ->
+ Inform("Clearing runtime parameter ~p for component ~p", [Key, Component]),
+ rpc_call(Node, rabbit_runtime_parameters, clear, [list_to_binary(Component),
list_to_binary(Key)]);
action(list_parameters, Node, Args = [], _Opts, Inform) ->
diff --git a/src/rabbit_runtime_parameters.erl b/src/rabbit_runtime_parameters.erl
index a8fa9d33..e1c417c4 100644
--- a/src/rabbit_runtime_parameters.erl
+++ b/src/rabbit_runtime_parameters.erl
@@ -48,14 +48,14 @@
%%---------------------------------------------------------------------------
-parse_set(AppName, Key, String) ->
+parse_set(Component, Key, String) ->
case parse(String) of
- {ok, Term} -> set(AppName, Key, Term);
+ {ok, Term} -> set(Component, Key, Term);
{errors, L} -> format_error(L)
end.
-set(AppName, Key, Term) ->
- case set0(AppName, Key, Term) of
+set(Component, Key, Term) ->
+ case set0(Component, Key, Term) of
ok -> ok;
{errors, L} -> format_error(L)
end.
@@ -63,16 +63,16 @@ set(AppName, Key, Term) ->
format_error(L) ->
{error_string, rabbit_misc:format_many([{"Validation failed~n", []} | L])}.
-set0(AppName, Key, Term) ->
- case lookup_app(AppName) of
+set0(Component, Key, Term) ->
+ case lookup_component(Component) of
{ok, Mod} ->
case flatten_errors(validate(Term)) of
ok ->
- case flatten_errors(Mod:validate(AppName, Key, Term)) of
+ case flatten_errors(Mod:validate(Component, Key, Term)) of
ok ->
- case mnesia_update(AppName, Key, Term) of
+ case mnesia_update(Component, Key, Term) of
{old, Term} -> ok;
- _ -> Mod:notify(AppName, Key, Term)
+ _ -> Mod:notify(Component, Key, Term)
end,
ok;
E ->
@@ -85,46 +85,46 @@ set0(AppName, Key, Term) ->
E
end.
-mnesia_update(AppName, Key, Term) ->
+mnesia_update(Component, Key, Term) ->
rabbit_misc:execute_mnesia_transaction(
fun () ->
- Res = case mnesia:read(?TABLE, {AppName, Key}) of
+ Res = case mnesia:read(?TABLE, {Component, Key}) of
[] -> new;
[Params] -> {old, Params#runtime_parameters.value}
end,
- ok = mnesia:write(?TABLE, c(AppName, Key, Term), write),
+ ok = mnesia:write(?TABLE, c(Component, Key, Term), write),
Res
end).
-clear(AppName, Key) ->
- case clear0(AppName, Key) of
+clear(Component, Key) ->
+ case clear0(Component, Key) of
ok -> ok;
{errors, L} -> format_error(L)
end.
-clear0(AppName, Key) ->
- case lookup_app(AppName) of
- {ok, Mod} -> case flatten_errors(Mod:validate_clear(AppName, Key)) of
- ok -> mnesia_clear(AppName, Key),
- Mod:notify_clear(AppName, Key),
+clear0(Component, Key) ->
+ case lookup_component(Component) of
+ {ok, Mod} -> case flatten_errors(Mod:validate_clear(Component, Key)) of
+ ok -> mnesia_clear(Component, Key),
+ Mod:notify_clear(Component, Key),
ok;
E -> E
end;
E -> E
end.
-mnesia_clear(AppName, Key) ->
+mnesia_clear(Component, Key) ->
ok = rabbit_misc:execute_mnesia_transaction(
fun () ->
- ok = mnesia:delete(?TABLE, {AppName, Key}, write)
+ ok = mnesia:delete(?TABLE, {Component, Key}, write)
end).
list() ->
[p(P) || P <- rabbit_misc:dirty_read_all(?TABLE)].
-list(AppName) ->
- case lookup_app(AppName) of
- {ok, _} -> Match = #runtime_parameters{key = {AppName, '_'}, _ = '_'},
+list(Component) ->
+ case lookup_component(Component) of
+ {ok, _} -> Match = #runtime_parameters{key = {Component, '_'}, _ = '_'},
[p(P) || P <- mnesia:dirty_match_object(?TABLE, Match)];
_ -> not_found
end.
@@ -132,56 +132,57 @@ list(AppName) ->
list_formatted() ->
[pset(value, format(pget(value, P)), P) || P <- list()].
-lookup(AppName, Key) ->
- case lookup0(AppName, Key, rabbit_misc:const(not_found)) of
+lookup(Component, Key) ->
+ case lookup0(Component, Key, rabbit_misc:const(not_found)) of
not_found -> not_found;
Params -> p(Params)
end.
-value(AppName, Key) ->
- case lookup0(AppName, Key, rabbit_misc:const(not_found)) of
+value(Component, Key) ->
+ case lookup0(Component, 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),
+value(Component, Key, Default) ->
+ Params = lookup0(Component, Key,
+ fun () -> lookup_missing(Component, Key, Default) end),
Params#runtime_parameters.value.
-lookup0(AppName, Key, DefaultFun) ->
- case mnesia:dirty_read(?TABLE, {AppName, Key}) of
+lookup0(Component, Key, DefaultFun) ->
+ case mnesia:dirty_read(?TABLE, {Component, Key}) of
[] -> DefaultFun();
[R] -> R
end.
-lookup_missing(AppName, Key, Default) ->
+lookup_missing(Component, Key, Default) ->
rabbit_misc:execute_mnesia_transaction(
fun () ->
- case mnesia:read(?TABLE, {AppName, Key}) of
- [] -> Record = c(AppName, Key, Default),
+ case mnesia:read(?TABLE, {Component, Key}) of
+ [] -> Record = c(Component, Key, Default),
mnesia:write(?TABLE, Record, write),
Record;
[R] -> R
end
end).
-c(AppName, Key, Default) -> #runtime_parameters{key = {AppName, Key},
- value = Default}.
+c(Component, Key, Default) -> #runtime_parameters{key = {Component, Key},
+ value = Default}.
-p(#runtime_parameters{key = {AppName, Key}, value = Value}) ->
- [{app_name, AppName},
- {key, Key},
- {value, Value}].
+p(#runtime_parameters{key = {Component, Key}, value = Value}) ->
+ [{component, Component},
+ {key, Key},
+ {value, Value}].
-info_keys() -> [app_name, key, value].
+info_keys() -> [component, key, value].
%%---------------------------------------------------------------------------
-lookup_app(App) ->
+lookup_component(Component) ->
case rabbit_registry:lookup_module(
- runtime_parameter, list_to_atom(binary_to_list(App))) of
- {error, not_found} -> {errors, [{"application ~s not found", [App]}]};
+ runtime_parameter, list_to_atom(binary_to_list(Component))) of
+ {error, not_found} -> {errors,
+ [{"component ~s not found", [Component]}]};
{ok, Module} -> {ok, Module}
end.