Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Handle exclusive mode in bitcask_file:file_open

  • Loading branch information...
commit a6cc3aeb2ec99e25a17b7c7f9be9d3ae840f9b85 1 parent f20c143
@jtuple jtuple authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/bitcask_file.erl
View
12 src/bitcask_file.erl
@@ -78,11 +78,15 @@ init([]) ->
{ok, #state{}}.
handle_call({file_open, Filename, Opts}, _From, State) ->
- Mode = case proplists:get_bool(readonly, Opts) of
- true ->
+ IsCreate = proplists:get_bool(create, Opts),
+ IsReadOnly = proplists:get_bool(readonly, Opts),
+ Mode = case {IsReadOnly, IsCreate} of
+ {true, _} ->
[read, raw, binary, read_ahead];
- false ->
- [read, write, raw, binary, read_ahead]
+ {_, false} ->
+ [read, write, raw, binary, read_ahead];
+ {_, true} ->
+ [read, write, exclusive, raw, binary, read_ahead]
end,
%% [lager:warning("Option ~p ignored", [Opt]) || Opt <- [create, o_sync],
%% proplists:get_bool(Opt, Opts)],
Please sign in to comment.
Something went wrong with that request. Please try again.