diff options
| author | Rob Harrop <rharrop@vmware.com> | 2010-09-22 12:06:23 +0100 |
|---|---|---|
| committer | Rob Harrop <rharrop@vmware.com> | 2010-09-22 12:06:23 +0100 |
| commit | 33fa8a2e3207e2ba240b79efac0dd72e6bec76a3 (patch) | |
| tree | 18aa0b1efc0fb766545f2f9c825886a6404b9a90 | |
| parent | de20ca33aed6823d3d13b7dbdc30ec0869584269 (diff) | |
| download | rabbitmq-server-git-33fa8a2e3207e2ba240b79efac0dd72e6bec76a3.tar.gz | |
clean up of specs and dialzer results
| -rw-r--r-- | include/rabbit_backing_queue_spec.hrl | 28 | ||||
| -rw-r--r-- | src/rabbit_queue_index.erl | 30 | ||||
| -rw-r--r-- | src/rabbit_types.erl | 5 |
3 files changed, 41 insertions, 22 deletions
diff --git a/include/rabbit_backing_queue_spec.hrl b/include/rabbit_backing_queue_spec.hrl index 005994f09f..f417c6d95a 100644 --- a/include/rabbit_backing_queue_spec.hrl +++ b/include/rabbit_backing_queue_spec.hrl @@ -30,12 +30,17 @@ %% -type(fetch_result() :: - %% Message, IsDelivered, AckTag, Remaining_Len - ('empty'|{rabbit_types:basic_message(), boolean(), ack(), non_neg_integer()})). + %% Message, MessageProperties, IsDelivered, AckTag, Remaining_Len + ('empty'|{rabbit_types:basic_message(), + rabbit_types:msg_properties(), + 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(msg_properties_transformer() :: + fun ((rabbit_types:msg_properties()) -> rabbit_types:msg_properties())). -spec(start/1 :: ([rabbit_amqqueue:name()]) -> 'ok'). -spec(stop/0 :: () -> 'ok'). @@ -43,16 +48,23 @@ -spec(terminate/1 :: (state()) -> state()). -spec(delete_and_terminate/1 :: (state()) -> state()). -spec(purge/1 :: (state()) -> {purged_msg_count(), state()}). --spec(publish/2 :: (rabbit_types:basic_message(), state()) -> state()). --spec(publish_delivered/3 :: - (ack_required(), rabbit_types:basic_message(), state()) -> {ack(), state()}). +-spec(publish/3 :: + (rabbit_types:basic_message(), rabbit_types:msg_properties(), state()) + -> state()). +-spec(publish_delivered/4 :: + (ack_required(), rabbit_types:basic_message(), + rabbit_types:msg_properties(), state()) -> {ack(), state()}). -spec(fetch/2 :: (ack_required(), state()) -> {fetch_result(), state()}). -spec(ack/2 :: ([ack()], state()) -> state()). --spec(tx_publish/3 :: (rabbit_types:txn(), rabbit_types:basic_message(), state()) -> state()). +-spec(tx_publish/4 :: + (rabbit_types:txn(), rabbit_types:basic_message(), + rabbit_types:msg_properties(), state()) -> state()). -spec(tx_ack/3 :: (rabbit_types:txn(), [ack()], state()) -> state()). -spec(tx_rollback/2 :: (rabbit_types:txn(), state()) -> {[ack()], state()}). --spec(tx_commit/3 :: (rabbit_types:txn(), fun (() -> any()), state()) -> {[ack()], state()}). --spec(requeue/2 :: ([ack()], state()) -> state()). +-spec(tx_commit/4 :: + (rabbit_types:txn(), fun (() -> any()), + msg_properties_transformer(), state()) -> {[ack()], state()}). +-spec(requeue/3 :: ([ack()], msg_properties_transformer(), state()) -> state()). -spec(len/1 :: (state()) -> non_neg_integer()). -spec(is_empty/1 :: (state()) -> boolean()). -spec(set_ram_duration_target/2 :: diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl index 6ace4c8b22..820378a512 100644 --- a/src/rabbit_queue_index.erl +++ b/src/rabbit_queue_index.erl @@ -203,14 +203,15 @@ {'undefined' | non_neg_integer(), [any()], qistate()}). -spec(terminate/2 :: ([any()], qistate()) -> qistate()). -spec(delete_and_terminate/1 :: (qistate()) -> qistate()). --spec(publish/5 :: (rabbit_guid:guid(), seq_id(), msg_properties(), +-spec(publish/5 :: (rabbit_guid:guid(), seq_id(), rabbit_types:msg_properties(), boolean(), qistate()) -> qistate()). -spec(deliver/2 :: ([seq_id()], qistate()) -> qistate()). -spec(ack/2 :: ([seq_id()], qistate()) -> qistate()). -spec(sync/2 :: ([seq_id()], qistate()) -> qistate()). -spec(flush/1 :: (qistate()) -> qistate()). -spec(read/3 :: (seq_id(), seq_id(), qistate()) -> - {[{rabbit_guid:guid(), seq_id(), msg_properties(), + {[{rabbit_guid:guid(), seq_id(), + rabbit_types:msg_properties(), boolean(), boolean()}], qistate()}). -spec(next_segment_boundary/1 :: (seq_id()) -> seq_id()). -spec(bounds/1 :: (qistate()) -> @@ -537,17 +538,20 @@ expiry_to_binary(Expiry) -> <<Expiry:?EXPIRY_BITS>>. read_pub_record_body(Hdl) -> - {ok, Bin} = file_handle_cache:read(Hdl, ?GUID_BYTES + ?EXPIRY_BYTES), - - %% work around for binary data fragmentation. See - %% rabbit_msg_file:read_next/2 - <<GuidNum:?GUID_BITS, Expiry:?EXPIRY_BITS>> = Bin, - <<Guid:?GUID_BYTES/binary>> = <<GuidNum:?GUID_BITS>>, - Exp = case Expiry of - ?NO_EXPIRY -> undefined; - X -> X - end, - {Guid, #msg_properties{expiry = Exp}}. + case file_handle_cache:read(Hdl, ?GUID_BYTES + ?EXPIRY_BYTES) of + {ok, Bin} -> + %% work around for binary data fragmentation. See + %% rabbit_msg_file:read_next/2 + <<GuidNum:?GUID_BITS, Expiry:?EXPIRY_BITS>> = Bin, + <<Guid:?GUID_BYTES/binary>> = <<GuidNum:?GUID_BITS>>, + Exp = case Expiry of + ?NO_EXPIRY -> undefined; + X -> X + end, + {Guid, #msg_properties{expiry = Exp}}; + Error -> + Error + end. %%---------------------------------------------------------------------------- %% journal manipulation diff --git a/src/rabbit_types.erl b/src/rabbit_types.erl index 0b6a15ec83..35f74da328 100644 --- a/src/rabbit_types.erl +++ b/src/rabbit_types.erl @@ -41,7 +41,8 @@ amqp_error/0, r/1, r2/2, r3/3, listener/0, binding/0, amqqueue/0, exchange/0, connection/0, protocol/0, user/0, ok/1, error/1, ok_or_error/1, ok_or_error2/2, - ok_pid_or_error/0, channel_exit/0, connection_exit/0]). + ok_pid_or_error/0, channel_exit/0, connection_exit/0, + msg_properties/0]). -type(channel_exit() :: no_return()). -type(connection_exit() :: no_return()). @@ -86,6 +87,8 @@ txn :: maybe(txn()), sender :: pid(), message :: message()}). +-type(msg_properties() :: + #msg_properties{expiry :: pos_integer()}). %% this is really an abstract type, but dialyzer does not support them -type(txn() :: rabbit_guid:guid()). |
