ETS delete

Delete the objects rather than starting a new table each time
This commit is contained in:
martinsumner 2016-12-11 07:07:30 +00:00
parent 2758498fad
commit 6f06c6fdeb
2 changed files with 4 additions and 1 deletions

View file

@ -467,12 +467,12 @@ handle_cast({levelzero_complete, FN, StartKey, EndKey, Bloom}, State) ->
filename=FN}, filename=FN},
UpdMan = lists:keystore(0, 1, State#state.manifest, {0, [ManEntry]}), UpdMan = lists:keystore(0, 1, State#state.manifest, {0, [ManEntry]}),
% Prompt clerk to ask about work - do this for every L0 roll % Prompt clerk to ask about work - do this for every L0 roll
leveled_pmem:clear_index(State#state.levelzero_index),
ok = leveled_pclerk:clerk_prompt(State#state.clerk), ok = leveled_pclerk:clerk_prompt(State#state.clerk),
{noreply, State#state{levelzero_cache=[], {noreply, State#state{levelzero_cache=[],
levelzero_pending=false, levelzero_pending=false,
levelzero_constructor=undefined, levelzero_constructor=undefined,
levelzero_size=0, levelzero_size=0,
levelzero_index=leveled_pmem:new_index(),
manifest=UpdMan, manifest=UpdMan,
persisted_sqn=State#state.ledger_sqn}}. persisted_sqn=State#state.ledger_sqn}}.

View file

@ -88,6 +88,9 @@ add_to_index(LevelMinus1, L0Index) ->
new_index() -> new_index() ->
ets:new(l0index, [private, set]). ets:new(l0index, [private, set]).
clear_index(L0Index) ->
ets:delete_all_objects(L0Index).
check_index(Hash, L0Index) -> check_index(Hash, L0Index) ->
case ets:lookup(L0Index, Hash) of case ets:lookup(L0Index, Hash) of
[{Hash}] -> [{Hash}] ->