summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2010-07-19 15:26:13 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2010-07-19 15:26:13 +0100
commita04151e688705c47af821f5287185a26e1beead5 (patch)
tree9e549ff018c70c8437b3aeebcb9d3eeac9fced18
parent7c52c2aab2c535f576a4d6cc99dc1246ebf5c76e (diff)
downloadrabbitmq-server-a04151e688705c47af821f5287185a26e1beead5.tar.gz
flesh out vq API with funs useful for testing
-rw-r--r--src/rabbit_variable_queue.erl21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index ac3128d4..5a53e2bd 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -41,6 +41,9 @@
-export([start/1]).
+%% exported for testing only
+-export([start_msg_store/2, stop_msg_store/0]).
+
%%----------------------------------------------------------------------------
%% Definitions:
@@ -344,11 +347,15 @@
start(DurableQueues) ->
{AllTerms, StartFunState} = rabbit_queue_index:recover(DurableQueues),
- Refs = [Ref || Terms <- AllTerms,
- begin
- Ref = proplists:get_value(persistent_ref, Terms),
- Ref =/= undefined
- end],
+ start_msg_store(
+ [Ref || Terms <- AllTerms,
+ begin
+ Ref = proplists:get_value(persistent_ref, Terms),
+ Ref =/= undefined
+ end],
+ StartFunState).
+
+start_msg_store(Refs, StartFunState) ->
ok = rabbit_sup:start_child(?TRANSIENT_MSG_STORE, rabbit_msg_store,
[?TRANSIENT_MSG_STORE, rabbit_mnesia:dir(),
undefined, {fun (ok) -> finished end, ok}]),
@@ -356,6 +363,10 @@ start(DurableQueues) ->
[?PERSISTENT_MSG_STORE, rabbit_mnesia:dir(),
Refs, StartFunState]).
+stop_msg_store() ->
+ ok = rabbit_sup:stop_child(?PERSISTENT_MSG_STORE),
+ ok = rabbit_sup:stop_child(?TRANSIENT_MSG_STORE).
+
init(QueueName, IsDurable, _Recover) ->
{DeltaCount, Terms, IndexState} =
rabbit_queue_index:init(