Iterator support
Add iterator support, used initially only for retrieving bucket statistics. The iterator is supported by exporting a function, and when the function is claled it will take a snapshot of the ledger, run the iterator and hten close the snapshot. This required a numbe rof underlying changes, in particular to get key comparison to work as "expected". The code had previously misunderstood how comparison worked between Erlang terms, and in particular did not account for tuple length being compared first by size of the tuple (and not just by each element in order).
This commit is contained in:
parent
d2cc07a9eb
commit
0a08867280
6 changed files with 762 additions and 202 deletions
|
@ -100,6 +100,7 @@ init([]) ->
|
|||
handle_call({register, Owner}, _From, State) ->
|
||||
{reply, ok, State#state{owner=Owner}, ?INACTIVITY_TIMEOUT};
|
||||
handle_call({manifest_change, return, true}, _From, State) ->
|
||||
io:format("Request for manifest change from clerk on closing~n"),
|
||||
case State#state.change_pending of
|
||||
true ->
|
||||
WI = State#state.work_item,
|
||||
|
@ -110,11 +111,13 @@ handle_call({manifest_change, return, true}, _From, State) ->
|
|||
handle_call({manifest_change, confirm, Closing}, From, State) ->
|
||||
case Closing of
|
||||
true ->
|
||||
io:format("Confirmation of manifest change on closing~n"),
|
||||
WI = State#state.work_item,
|
||||
ok = mark_for_delete(WI#penciller_work.unreferenced_files,
|
||||
State#state.owner),
|
||||
{stop, normal, ok, State};
|
||||
false ->
|
||||
io:format("Prompted confirmation of manifest change~n"),
|
||||
gen_server:reply(From, ok),
|
||||
WI = State#state.work_item,
|
||||
mark_for_delete(WI#penciller_work.unreferenced_files,
|
||||
|
@ -168,6 +171,7 @@ requestandhandle_work(State) ->
|
|||
{NewManifest, FilesToDelete} = merge(WI),
|
||||
UpdWI = WI#penciller_work{new_manifest=NewManifest,
|
||||
unreferenced_files=FilesToDelete},
|
||||
io:format("Clerk prompting Penciller regarding manifest change~n"),
|
||||
ok = leveled_penciller:pcl_promptmanifestchange(State#state.owner,
|
||||
UpdWI),
|
||||
{true, UpdWI}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue