summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2011-03-17 09:17:27 +0000
committerMatthew Sackman <matthew@rabbitmq.com>2011-03-17 09:17:27 +0000
commit5a390fde517e6f8539f75199b357d064d8c11541 (patch)
treef62a8ab97ae09629e0163793b7675939d7fc9019 /src
parent221433535cd1551a83132d0a8d46440dd12ea433 (diff)
downloadrabbitmq-server-5a390fde517e6f8539f75199b357d064d8c11541.tar.gz
renamings
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_mnesia.erl10
-rw-r--r--src/rabbit_upgrade.erl8
-rw-r--r--src/rabbit_version.erl51
3 files changed, 34 insertions, 35 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index 4902cfeb..c598fbb9 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -442,7 +442,7 @@ init_db(ClusterNodes, Force) ->
{[AnotherNode|_], _} ->
%% Subsequent node in cluster, catch up
ensure_version_ok(
- rpc:call(AnotherNode, rabbit_version, read, [])),
+ rpc:call(AnotherNode, rabbit_version, recorded, [])),
IsDiskNode = ClusterNodes == [] orelse
lists:member(node(), ClusterNodes),
ok = wait_for_replicated_tables(),
@@ -457,7 +457,7 @@ init_db(ClusterNodes, Force) ->
%% If we're just starting up a new node we won't have
%% a version
version_not_available ->
- ok = rabbit_version:write_desired_version()
+ ok = rabbit_version:record_desired()
end,
ensure_schema_integrity()
end;
@@ -484,14 +484,14 @@ schema_ok_or_move() ->
end.
ensure_version_ok({ok, DiscVersion}) ->
- DesiredVersion = rabbit_version:desired_version(),
+ DesiredVersion = rabbit_version:desired(),
case rabbit_version:'=~='(DesiredVersion, DiscVersion) of
true -> ok;
false -> throw({error, {schema_mismatch,
DesiredVersion, DiscVersion}})
end;
ensure_version_ok({error, _}) ->
- ok = rabbit_version:write_desired_version().
+ ok = rabbit_version:record_desired().
create_schema() ->
mnesia:stop(),
@@ -501,7 +501,7 @@ create_schema() ->
cannot_start_mnesia),
ok = create_tables(),
ok = ensure_schema_integrity(),
- ok = rabbit_version:write_desired_version().
+ ok = rabbit_version:record_desired().
move_db() ->
mnesia:stop(),
diff --git a/src/rabbit_upgrade.erl b/src/rabbit_upgrade.erl
index 9347cc53..b4e1191e 100644
--- a/src/rabbit_upgrade.erl
+++ b/src/rabbit_upgrade.erl
@@ -141,13 +141,13 @@ upgrade_mode(AllNodes) ->
end;
[Another|_] ->
ClusterVersion =
- case rpc:call(Another, rabbit_version, desired_scope_version,
+ case rpc:call(Another, rabbit_version, desired_for_scope,
[mnesia]) of
{badrpc, {'EXIT', {undef, _}}} -> unknown_old_version;
{badrpc, Reason} -> {unknown, Reason};
V -> V
end,
- MyVersion = rabbit_version:desired_scope_version(mnesia),
+ MyVersion = rabbit_version:desired_for_scope(mnesia),
case rabbit_version:'=~='(ClusterVersion, MyVersion) of
true ->
%% The other node(s) have upgraded already, I am not the
@@ -208,7 +208,7 @@ secondary_upgrade(AllNodes) ->
end,
rabbit_misc:ensure_ok(mnesia:start(), cannot_start_mnesia),
ok = rabbit_mnesia:init_db(ClusterNodes, true),
- ok = rabbit_version:write_desired_scope_version(mnesia),
+ ok = rabbit_version:record_desired_for_scope(mnesia),
ok.
nodes_running(Nodes) ->
@@ -253,7 +253,7 @@ apply_upgrades(Scope, Upgrades, Fun) ->
[apply_upgrade(Scope, Upgrade) || Upgrade <- Upgrades],
info("~s upgrades: All upgrades applied successfully~n",
[Scope]),
- ok = rabbit_version:write_desired_scope_version(Scope),
+ ok = rabbit_version:record_desired_for_scope(Scope),
ok = rabbit_misc:recursive_delete([BackupDir]),
info("~s upgrades: Mnesia backup removed~n", [Scope]),
ok = file:delete(LockFile);
diff --git a/src/rabbit_version.erl b/src/rabbit_version.erl
index 2d7ba8e4..e079df4a 100644
--- a/src/rabbit_version.erl
+++ b/src/rabbit_version.erl
@@ -16,14 +16,14 @@
-module(rabbit_version).
--export([read/0, '=~='/2, desired_version/0, desired_scope_version/1,
- write_desired_version/0, write_desired_scope_version/1,
+-export([recorded/0, '=~='/2, desired/0, desired_for_scope/1,
+ record_desired/0, record_desired_for_scope/1,
upgrades_required/1]).
%% -------------------------------------------------------------------
-ifdef(use_specs).
--export_type([scope/0, step/0, scope_version/0]).
+-export_type([scope/0, step/0]).
-type(scope() :: atom()).
-type(scope_version() :: [atom()]).
@@ -31,12 +31,12 @@
-type(version() :: [atom()]).
--spec(read/0 :: () -> rabbit_types:ok_or_error2(version(), any())).
--spec('=~='/2 :: (version(), version()) -> boolean()).
--spec(desired_version/0 :: () -> version()).
--spec(desired_scope_version/1 :: (scope()) -> scope_version()).
--spec(write_desired_version/0 :: () -> 'ok').
--spec(write_desired_scope_version/1 ::
+-spec(recorded/0 :: () -> rabbit_types:ok_or_error2(version(), any())).
+-spec('=~='/2 :: ([A], [A]) -> boolean()).
+-spec(desired/0 :: () -> version()).
+-spec(desired_for_scope/1 :: (scope()) -> scope_version()).
+-spec(record_desired/0 :: () -> 'ok').
+-spec(record_desired_for_scope/1 ::
(scope()) -> rabbit_types:ok_or_error(any())).
-spec(upgrades_required/1 ::
(scope()) -> rabbit_types:ok_or_error2([step()], any())).
@@ -49,15 +49,15 @@
%% -------------------------------------------------------------------
-read() -> case rabbit_misc:read_term_file(schema_filename()) of
- {ok, [V]} -> {ok, V};
- {error, _} = Err -> Err
- end.
+recorded() -> case rabbit_misc:read_term_file(schema_filename()) of
+ {ok, [V]} -> {ok, V};
+ {error, _} = Err -> Err
+ end.
-write(V) -> ok = rabbit_misc:write_term_file(schema_filename(), [V]).
+record(V) -> ok = rabbit_misc:write_term_file(schema_filename(), [V]).
-read_scope_version(Scope) ->
- case read() of
+recorded_for_scope(Scope) ->
+ case recorded() of
{error, _} = Err ->
Err;
{ok, Version} ->
@@ -67,14 +67,14 @@ read_scope_version(Scope) ->
end}
end.
-write_scope_version(Scope, ScopeVersion) ->
- case read() of
+record_for_scope(Scope, ScopeVersion) ->
+ case recorded() of
{error, _} = Err ->
Err;
{ok, Version} ->
Version1 = lists:keystore(Scope, 1, categorise_by_scope(Version),
{Scope, ScopeVersion}),
- ok = write([Name || {_Scope, Names} <- Version1, Name <- Names])
+ ok = record([Name || {_Scope, Names} <- Version1, Name <- Names])
end.
%% -------------------------------------------------------------------
@@ -84,18 +84,17 @@ write_scope_version(Scope, ScopeVersion) ->
%% -------------------------------------------------------------------
-desired_version() ->
- [Name || Scope <- ?SCOPES, Name <- desired_scope_version(Scope)].
+desired() -> [Name || Scope <- ?SCOPES, Name <- desired_for_scope(Scope)].
-desired_scope_version(Scope) -> with_upgrade_graph(fun heads/1, Scope).
+desired_for_scope(Scope) -> with_upgrade_graph(fun heads/1, Scope).
-write_desired_version() -> write(desired_version()).
+record_desired() -> record(desired()).
-write_desired_scope_version(Scope) ->
- write_scope_version(Scope, desired_scope_version(Scope)).
+record_desired_for_scope(Scope) ->
+ record_for_scope(Scope, desired_for_scope(Scope)).
upgrades_required(Scope) ->
- case read_scope_version(Scope) of
+ case recorded_for_scope(Scope) of
{error, enoent} ->
{error, version_not_available};
{ok, CurrentHeads} ->