Add support for index_entry's size field

This commit is contained in:
Carlos Martín Nieto
2013-09-01 19:56:35 +02:00
parent e39a17fe43
commit 15ba2dd65f
4 changed files with 13 additions and 12 deletions

View File

@@ -74,8 +74,8 @@ get(Pid, Path, Stage) ->
nth(Pid, Nth) ->
maybe_entry(gen_server:call(Pid, {nth, Nth})).
maybe_entry({ok, Path, Id, Mode}) ->
{ok, #geef_index_entry{path=Path, id=#geef_oid{oid=Id}, mode=Mode}};
maybe_entry({ok, Path, Id, Mode, Size}) ->
{ok, #geef_index_entry{path=Path, id=#geef_oid{oid=Id}, mode=Mode, size=Size}};
maybe_entry(Error = {error, _}) ->
Error.
@@ -136,7 +136,7 @@ handle_call({get, Path, Stage}, _From, State = #state{handle=Handle}) ->
Reply = geef_nif:index_get(Handle, Path, Stage),
{reply, Reply, State};
handle_call({add, Entry}, _From, State = #state{handle=Handle}) ->
handle_call({add, Entry = #geef_index_entry{}}, _From, State = #state{handle=Handle}) ->
Reply = geef_nif:index_add(Handle, Entry),
{reply, Reply, State}.

View File

@@ -5,7 +5,7 @@
{ctime :: non_neg_integer(), mtime :: non_neg_integer(),
dev :: non_neg_integer(), ino :: non_neg_integer(),
mode :: non_neg_integer(), uid :: non_neg_integer(), gid :: non_neg_integer(),
size :: non_neg_integer(),
size = 0 :: non_neg_integer(),
id :: geef_oid:oid(),
flags, flags_extended,
path :: iolist()}).