Simplify riak_kv_hanoi_backend:is_empty/1
Do range fold with limit=1, rather than throw exception.
This commit is contained in:
parent
0b8d035bda
commit
5b88a71e1d
1 changed files with 2 additions and 2 deletions
|
@ -303,10 +303,10 @@ drop(#state{ tree=Tree, partition=Partition, config=Config }=State) ->
|
|||
%% non-tombstone values; otherwise returns false.
|
||||
-spec is_empty(state()) -> boolean().
|
||||
is_empty(#state{tree=Tree}) ->
|
||||
FoldFun = fun(_K, _V, _Acc) -> throw(ok) end,
|
||||
FoldFun = fun(K, _V, Acc) -> [K|Acc] end,
|
||||
try
|
||||
Range = to_key_range(undefined),
|
||||
[] =:= hanoi:fold_range(Tree, FoldFun, [], Range)
|
||||
[] =:= hanoi:fold_range(Tree, FoldFun, [], Range#btree_range{ limit=1 })
|
||||
catch
|
||||
_:ok ->
|
||||
false
|
||||
|
|
Loading…
Reference in a new issue