diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_queue_index.erl | 30 | ||||
| -rw-r--r-- | src/rabbit_types.erl | 5 |
2 files changed, 21 insertions, 14 deletions
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()). |
