summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2009-09-07 05:07:53 +0100
committerMatthias Radestock <matthias@lshift.net>2009-09-07 05:07:53 +0100
commitd33ca7441695703d2c9922fa4862bb00dad8bd85 (patch)
tree3f1ed2981b322291e60c5715530e02b7f418c739 /src
parent9d3dc5a14236a709387c6036c11dae58901b043e (diff)
downloadrabbitmq-server-git-d33ca7441695703d2c9922fa4862bb00dad8bd85.tar.gz
do not return body size from rabbit_msg_file:read
it's not used anywhere and was cluttering the api Also, make type sigs more meaningful and do not include rabbit.hrl, thus underlining the general nature of this module.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_msg_file.erl23
-rw-r--r--src/rabbit_msg_store.erl4
2 files changed, 15 insertions, 12 deletions
diff --git a/src/rabbit_msg_file.erl b/src/rabbit_msg_file.erl
index 0b3b5af856..d5b891b69a 100644
--- a/src/rabbit_msg_file.erl
+++ b/src/rabbit_msg_file.erl
@@ -35,8 +35,6 @@
%%----------------------------------------------------------------------------
--include("rabbit.hrl").
-
-define(INTEGER_SIZE_BYTES, 8).
-define(INTEGER_SIZE_BITS, (8 * ?INTEGER_SIZE_BYTES)).
-define(WRITE_OK_SIZE_BITS, 8).
@@ -48,14 +46,19 @@
-ifdef(use_specs).
--spec(append/4 :: (io_device(), msg_id(), binary(), boolean()) ->
- ({'ok', non_neg_integer()} | {'error', any()})).
--spec(read/2 :: (io_device(), non_neg_integer()) ->
- ({'ok', {msg_id(), binary(), boolean(), non_neg_integer()}} |
- {'error', any()})).
+-type(io_device() :: any()).
+-type(msg_id() :: any()).
+-type(msg() :: binary()).
+-type(msg_attrs() :: boolean()).
+-type(position() :: non_neg_integer()).
+-type(msg_size() :: non_neg_integer()).
+
+-spec(append/4 :: (io_device(), msg_id(), msg(), msg_attrs()) ->
+ ({'ok', msg_size()} | {'error', any()})).
+-spec(read/2 :: (io_device(), msg_size()) ->
+ ({'ok', {msg_id(), msg(), msg_attrs()}} | {'error', any()})).
-spec(scan/1 :: (io_device()) ->
- {'ok', [{msg_id(), boolean(), non_neg_integer(),
- non_neg_integer()}]}).
+ {'ok', [{msg_id(), msg_attrs(), msg_size(), position()}]}).
-endif.
@@ -93,7 +96,7 @@ read(FileHdl, TotalSize) ->
?WRITE_OK_TRANSIENT -> false;
?WRITE_OK_PERSISTENT -> true
end,
- {ok, {binary_to_term(MsgId), MsgBody, Persistent, BodySize}};
+ {ok, {binary_to_term(MsgId), MsgBody, Persistent}};
KO -> KO
end.
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl
index e4ccc1dfbe..e45c9a6337 100644
--- a/src/rabbit_msg_store.erl
+++ b/src/rabbit_msg_store.erl
@@ -369,13 +369,13 @@ read(MsgId, State) ->
total_size = TotalSize }] ->
case fetch_and_increment_cache(MsgId, State) of
not_found ->
- {{ok, {MsgId, MsgBody, _IsPersistent, _BodySize}}, State1} =
+ {{ok, {MsgId, MsgBody, _IsPersistent}}, State1} =
with_read_handle_at(
File, Offset,
fun(Hdl) ->
Res = case rabbit_msg_file:read(
Hdl, TotalSize) of
- {ok, {MsgId, _, _, _}} = Obj -> Obj;
+ {ok, {MsgId, _, _}} = Obj -> Obj;
{ok, Rest} ->
throw({error,
{misread,