Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
calculate version correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Newson committed Mar 8, 2011
1 parent b7ceb52 commit 8084c02
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/monic_file_writer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,11 @@ load_main_items(Tid, Fd, Location) ->
Else
end.

update_item(Tid, Fd, Location, Key, Cookie, Size, Fun) ->
Version = ets:update_counter(Tid, Key, {4, 1, 65535, 1}),
update_item(Tid, Fd, Location, Key, Cookie, Size, Fun) ->
Version = case ets:lookup(Tid, Key) of
[] -> 1;
[V] -> V + 1
end,
Header = #header{key=Key,cookie=Cookie,size=Size,version=Version, flags=0},
case monic_utils:pwrite_header(Fd, Location, Header) of
ok ->
Expand Down

0 comments on commit 8084c02

Please sign in to comment.