summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2009-08-28 20:25:07 +0100
committerMatthias Radestock <matthias@lshift.net>2009-08-28 20:25:07 +0100
commitf74e8dfd75f9f4b1859b7de8eb21666ecbd4bf3d (patch)
tree6d050a3feb97fee2e90922534d050a7baf2fec73 /src
parentb96bcd7d3dccd320bd2a6b4023495ca53b7c6092 (diff)
downloadrabbitmq-server-git-f74e8dfd75f9f4b1859b7de8eb21666ecbd4bf3d.tar.gz
refactor: pull msg_location_dets filename construction into separate fun
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_disk_queue.erl13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/rabbit_disk_queue.erl b/src/rabbit_disk_queue.erl
index 42a635a14b..f78f413fda 100644
--- a/src/rabbit_disk_queue.erl
+++ b/src/rabbit_disk_queue.erl
@@ -401,12 +401,11 @@ init([FileSizeLimit, ReadFileHandlesLimit]) ->
ok = detect_shutdown_state_and_adjust_delivered_flags(),
- file:delete(form_filename(atom_to_list(?MSG_LOC_NAME) ++
- ?FILE_EXTENSION_DETS)),
+ file:delete(msg_location_dets_file()),
+
{ok, MsgLocationDets} =
dets:open_file(?MSG_LOC_NAME,
- [{file, form_filename(atom_to_list(?MSG_LOC_NAME) ++
- ?FILE_EXTENSION_DETS)},
+ [{file, msg_location_dets_file()},
{min_no_slots, 1024*1024},
%% man says this should be <= 32M. But it works...
{max_no_slots, 30*1024*1024},
@@ -583,8 +582,7 @@ shutdown(State = #dqstate { msg_location_dets = MsgLocationDets,
%% deliberately ignoring return codes here
State1 = stop_commit_timer(stop_memory_timer(State)),
dets:close(MsgLocationDets),
- file:delete(form_filename(atom_to_list(?MSG_LOC_NAME) ++
- ?FILE_EXTENSION_DETS)),
+ file:delete(msg_location_dets_file()),
true = ets:delete_all_objects(MsgLocationEts),
case FileHdl of
undefined -> ok;
@@ -806,6 +804,9 @@ form_filename(Name) ->
base_directory() ->
filename:join(rabbit_mnesia:dir(), "rabbit_disk_queue/").
+msg_location_dets_file() ->
+ form_filename(atom_to_list(?MSG_LOC_NAME) ++ ?FILE_EXTENSION_DETS).
+
with_read_handle_at(File, Offset, Fun, State =
#dqstate { read_file_hc_cache = HC,
current_file_name = CurName,