Skip to content

Commit

Permalink
Add deletion support to the driver.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlouis committed Jan 7, 2012
1 parent e102084 commit c80d7d1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/fractal_btree_drv.erl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
-export([start_link/0]).

-export([
delete_exist/2,
lookup_exist/2,
open/1,
put/3,
Expand All @@ -32,6 +33,9 @@ call(X) ->
lookup_exist(N, K) ->
call({lookup_exist, N, K}).

delete_exist(N, K) ->
call({delete_exist, N, K}).

open(N) ->
call({open, N}).

Expand Down Expand Up @@ -61,6 +65,10 @@ handle_call({put, N, K, V}, _, #state { btrees = D} = State) ->
Other ->
{reply, {error, Other}, State}
end;
handle_call({delete_exist, N, K}, _, #state { btrees = D} = State) ->
Tree = dict:fetch(N, D),
Reply = fractal_btree:delete(Tree, K),
{reply, Reply, State};
handle_call({lookup_exist, N, K}, _, #state { btrees = D} = State) ->
Tree = dict:fetch(N, D),
Reply = fractal_btree:lookup(Tree, K),
Expand Down

0 comments on commit c80d7d1

Please sign in to comment.