summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-10-06 17:50:32 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2010-10-06 17:50:32 +0100
commit72c74753173d556c8bdcdad2a0634342094d34e1 (patch)
treec841066e57a350595e3f1ce627cb2bf0c7887d64
parent3f3caf736eed01f3670ca6d69b4a1a89952910d3 (diff)
downloadrabbitmq-server-72c74753173d556c8bdcdad2a0634342094d34e1.tar.gz
cosmetic
-rw-r--r--src/rabbit_queue_index.erl29
-rw-r--r--src/rabbit_tests.erl28
2 files changed, 28 insertions, 29 deletions
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl
index c5a3da53..f84dff83 100644
--- a/src/rabbit_queue_index.erl
+++ b/src/rabbit_queue_index.erl
@@ -98,12 +98,12 @@
%% and seeding the message store on start up.
%%
%% Note that in general, the representation of a message's state as
-%% the tuple: {('no_pub'|{Guid, MsgProperties, IsPersistent}), ('del'|'no_del'),
-%% ('ack'|'no_ack')} is richer than strictly necessary for most
-%% operations. However, for startup, and to ensure the safe and
-%% correct combination of journal entries with entries read from the
-%% segment on disk, this richer representation vastly simplifies and
-%% clarifies the code.
+%% the tuple: {('no_pub'|{Guid, MsgProperties, IsPersistent}),
+%% ('del'|'no_del'), ('ack'|'no_ack')} is richer than strictly
+%% necessary for most operations. However, for startup, and to ensure
+%% the safe and correct combination of journal entries with entries
+%% read from the segment on disk, this richer representation vastly
+%% simplifies and clarifies the code.
%%
%% For notes on Clean Shutdown and startup, see documentation in
%% variable_queue.
@@ -300,7 +300,7 @@ flush(State) -> flush_journal(State).
read(StartEnd, StartEnd, State) ->
{[], State};
-read(Start, End, State = #qistate { segments = Segments,
+read(Start, End, State = #qistate { segments = Segments,
dir = Dir }) when Start =< End ->
%% Start is inclusive, End is exclusive.
LowerB = {StartSeg, _StartRelSeq} = seq_id_to_seg_and_rel_seq_id(Start),
@@ -537,10 +537,8 @@ queue_index_walker_reader(QueueName, Gatherer) ->
create_pub_record_body(Guid, #message_properties{expiry = Expiry}) ->
[Guid, expiry_to_binary(Expiry)].
-expiry_to_binary(undefined) ->
- <<?NO_EXPIRY:?EXPIRY_BITS>>;
-expiry_to_binary(Expiry) ->
- <<Expiry:?EXPIRY_BITS>>.
+expiry_to_binary(undefined) -> <<?NO_EXPIRY:?EXPIRY_BITS>>;
+expiry_to_binary(Expiry) -> <<Expiry:?EXPIRY_BITS>>.
read_pub_record_body(Hdl) ->
case file_handle_cache:read(Hdl, ?GUID_BYTES + ?EXPIRY_BYTES) of
@@ -681,10 +679,11 @@ load_journal_entries(State = #qistate { journal_handle = Hdl }) ->
_ ->
case read_pub_record_body(Hdl) of
{Guid, MsgProperties} ->
- Publish = {Guid, MsgProperties, case Prefix of
- ?PUB_PERSIST_JPREFIX -> true;
- ?PUB_TRANS_JPREFIX -> false
- end},
+ Publish = {Guid, MsgProperties,
+ case Prefix of
+ ?PUB_PERSIST_JPREFIX -> true;
+ ?PUB_TRANS_JPREFIX -> false
+ end},
load_journal_entries(
add_to_journal(SeqId, Publish, State));
_ErrOrEoF -> %% err, we've lost at least a publish
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl
index 638a45e1..72321f78 100644
--- a/src/rabbit_tests.erl
+++ b/src/rabbit_tests.erl
@@ -1850,26 +1850,26 @@ test_dropwhile(VQ0) ->
%% add messages with sequential expiry
VQ1 = lists:foldl(
- fun (N, VQN) ->
- rabbit_variable_queue:publish(
- rabbit_basic:message(
- rabbit_misc:r(<<>>, exchange, <<>>),
- <<>>, #'P_basic'{}, <<>>),
- #message_properties{expiry = N}, VQN)
- end, VQ0, lists:seq(1, Count)),
+ fun (N, VQN) ->
+ rabbit_variable_queue:publish(
+ rabbit_basic:message(
+ rabbit_misc:r(<<>>, exchange, <<>>),
+ <<>>, #'P_basic'{}, <<>>),
+ #message_properties{expiry = N}, VQN)
+ end, VQ0, lists:seq(1, Count)),
%% drop the first 5 messages
VQ2 = rabbit_variable_queue:dropwhile(
- fun(#message_properties { expiry = Expiry }) ->
- Expiry =< 5
- end, VQ1),
+ fun(#message_properties { expiry = Expiry }) ->
+ Expiry =< 5
+ end, VQ1),
%% fetch five now
VQ3 = lists:foldl(fun (_N, VQN) ->
- {{#basic_message{}, _, _, _}, VQM} =
- rabbit_variable_queue:fetch(false, VQN),
- VQM
- end, VQ2, lists:seq(1, 5)),
+ {{#basic_message{}, _, _, _}, VQM} =
+ rabbit_variable_queue:fetch(false, VQN),
+ VQM
+ end, VQ2, lists:seq(6, Count)),
%% should be empty now
{empty, VQ4} = rabbit_variable_queue:fetch(false, VQ3),