diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2011-01-23 18:56:51 +0000 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2011-01-23 18:56:51 +0000 |
commit | 1d50f8c007729875efdab3fa4d02faa11f5e4812 (patch) | |
tree | 99a91448f5a0adf7c744536c54b47b5bbd48ae1a | |
parent | 84ecc484e583b674e09ea8928ef3a187101a0225 (diff) | |
download | rabbitmq-server-1d50f8c007729875efdab3fa4d02faa11f5e4812.tar.gz |
dependently type acktag producing functions
s.t. the "blank ack" case is manifest
Switched from blank_ack to the more universal 'undefined' in the process.
-rw-r--r-- | include/rabbit_backing_queue_spec.hrl | 15 | ||||
-rw-r--r-- | src/rabbit_variable_queue.erl | 6 |
2 files changed, 12 insertions, 9 deletions
diff --git a/include/rabbit_backing_queue_spec.hrl b/include/rabbit_backing_queue_spec.hrl index 296bfdb3..accb2c0e 100644 --- a/include/rabbit_backing_queue_spec.hrl +++ b/include/rabbit_backing_queue_spec.hrl @@ -14,14 +14,13 @@ %% Copyright (c) 2007-2011 VMware, Inc. All rights reserved. %% --type(fetch_result() :: +-type(fetch_result(Ack) :: ('empty' | %% Message, IsDelivered, AckTag, Remaining_Len - {rabbit_types:basic_message(), boolean(), ack(), non_neg_integer()})). + {rabbit_types:basic_message(), boolean(), Ack, non_neg_integer()})). -type(is_durable() :: boolean()). -type(attempt_recovery() :: boolean()). -type(purged_msg_count() :: non_neg_integer()). --type(ack_required() :: boolean()). -type(confirm_required() :: boolean()). -type(message_properties_transformer() :: fun ((rabbit_types:message_properties()) @@ -36,13 +35,17 @@ -spec(purge/1 :: (state()) -> {purged_msg_count(), state()}). -spec(publish/3 :: (rabbit_types:basic_message(), rabbit_types:message_properties(), state()) -> state()). --spec(publish_delivered/4 :: (ack_required(), rabbit_types:basic_message(), +-spec(publish_delivered/4 :: (true, rabbit_types:basic_message(), rabbit_types:message_properties(), state()) - -> {ack(), state()}). + -> {ack(), state()}; + (false, rabbit_types:basic_message(), + rabbit_types:message_properties(), state()) + -> {undefined, state()}). -spec(dropwhile/2 :: (fun ((rabbit_types:message_properties()) -> boolean()), state()) -> state()). --spec(fetch/2 :: (ack_required(), state()) -> {fetch_result(), state()}). +-spec(fetch/2 :: (true, state()) -> {fetch_result(ack()), state()}; + (false, state()) -> {fetch_result(undefined), state()}). -spec(ack/2 :: ([ack()], state()) -> state()). -spec(tx_publish/4 :: (rabbit_types:txn(), rabbit_types:basic_message(), rabbit_types:message_properties(), state()) -> state()). diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl index f39bc964..97b33c82 100644 --- a/src/rabbit_variable_queue.erl +++ b/src/rabbit_variable_queue.erl @@ -299,7 +299,7 @@ -type(timestamp() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}). -type(seq_id() :: non_neg_integer()). --type(ack() :: seq_id() | 'blank_ack'). +-type(ack() :: seq_id()). -type(rates() :: #rates { egress :: {timestamp(), non_neg_integer()}, ingress :: {timestamp(), non_neg_integer()}, @@ -509,7 +509,7 @@ publish(Msg, MsgProps, State) -> publish_delivered(false, #basic_message { guid = Guid }, _MsgProps, State = #vqstate { len = 0 }) -> blind_confirm(self(), gb_sets:singleton(Guid)), - {blank_ack, a(State)}; + {undefined, a(State)}; publish_delivered(true, Msg = #basic_message { is_persistent = IsPersistent, guid = Guid }, MsgProps = #message_properties { @@ -628,7 +628,7 @@ internal_fetch(AckRequired, MsgStatus = #msg_status { MsgStatus #msg_status { is_delivered = true }, State), {SeqId, StateN}; - false -> {blank_ack, State} + false -> {undefined, State} end, PCount1 = PCount - one_if(IsPersistent andalso not AckRequired), |