Implement failing lookups in the driver.

This commit is contained in:
Jesper Louis Andersen 2012-01-07 22:57:01 +01:00
parent eae41cec83
commit 6b8683bb08

View file

@ -9,6 +9,7 @@
-export([ -export([
delete_exist/2, delete_exist/2,
lookup_exist/2, lookup_exist/2,
lookup_fail/2,
open/1, close/1, open/1, close/1,
put/3, put/3,
stop/0]). stop/0]).
@ -31,7 +32,10 @@ call(X) ->
gen_server:call(?SERVER, X, infinity). gen_server:call(?SERVER, X, infinity).
lookup_exist(N, K) -> lookup_exist(N, K) ->
call({lookup_exist, N, K}). call({lookup, N, K}).
lookup_fail(N, K) ->
call({lookup, N, K}).
delete_exist(N, K) -> delete_exist(N, K) ->
call({delete_exist, N, K}). call({delete_exist, N, K}).
@ -80,7 +84,7 @@ handle_call({delete_exist, N, K}, _, #state { btrees = D} = State) ->
Tree = dict:fetch(N, D), Tree = dict:fetch(N, D),
Reply = lsm_btree:delete(Tree, K), Reply = lsm_btree:delete(Tree, K),
{reply, Reply, State}; {reply, Reply, State};
handle_call({lookup_exist, N, K}, _, #state { btrees = D} = State) -> handle_call({lookup, N, K}, _, #state { btrees = D} = State) ->
Tree = dict:fetch(N, D), Tree = dict:fetch(N, D),
Reply = lsm_btree:lookup(Tree, K), Reply = lsm_btree:lookup(Tree, K),
{reply, Reply, State}; {reply, Reply, State};