Add deletion support to the driver.
This commit is contained in:
parent
e10208462b
commit
c80d7d1a6a
1 changed files with 8 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
||||||
-export([start_link/0]).
|
-export([start_link/0]).
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
|
delete_exist/2,
|
||||||
lookup_exist/2,
|
lookup_exist/2,
|
||||||
open/1,
|
open/1,
|
||||||
put/3,
|
put/3,
|
||||||
|
@ -32,6 +33,9 @@ call(X) ->
|
||||||
lookup_exist(N, K) ->
|
lookup_exist(N, K) ->
|
||||||
call({lookup_exist, N, K}).
|
call({lookup_exist, N, K}).
|
||||||
|
|
||||||
|
delete_exist(N, K) ->
|
||||||
|
call({delete_exist, N, K}).
|
||||||
|
|
||||||
open(N) ->
|
open(N) ->
|
||||||
call({open, N}).
|
call({open, N}).
|
||||||
|
|
||||||
|
@ -61,6 +65,10 @@ handle_call({put, N, K, V}, _, #state { btrees = D} = State) ->
|
||||||
Other ->
|
Other ->
|
||||||
{reply, {error, Other}, State}
|
{reply, {error, Other}, State}
|
||||||
end;
|
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) ->
|
handle_call({lookup_exist, N, K}, _, #state { btrees = D} = State) ->
|
||||||
Tree = dict:fetch(N, D),
|
Tree = dict:fetch(N, D),
|
||||||
Reply = fractal_btree:lookup(Tree, K),
|
Reply = fractal_btree:lookup(Tree, K),
|
||||||
|
|
Loading…
Reference in a new issue