Level Zero constructor to get close
Allows for the L0 constructor to be closed (even though not yet in the manifest) on shutdown
This commit is contained in:
parent
b12b6e4c91
commit
e5a5da35eb
1 changed files with 25 additions and 12 deletions
|
@ -923,13 +923,13 @@ handle_call(close, _From, State) ->
|
||||||
leveled_log:log("P0010", [StatusTuple])
|
leveled_log:log("P0010", [StatusTuple])
|
||||||
end,
|
end,
|
||||||
|
|
||||||
shutdown_manifest(State#state.manifest),
|
shutdown_manifest(State#state.manifest, State#state.levelzero_constructor),
|
||||||
{stop, normal, ok, State};
|
{stop, normal, ok, State};
|
||||||
handle_call(doom, _From, State) ->
|
handle_call(doom, _From, State) ->
|
||||||
leveled_log:log("P0030", []),
|
leveled_log:log("P0030", []),
|
||||||
ok = leveled_pclerk:clerk_close(State#state.clerk),
|
ok = leveled_pclerk:clerk_close(State#state.clerk),
|
||||||
|
|
||||||
shutdown_manifest(State#state.manifest),
|
shutdown_manifest(State#state.manifest, State#state.levelzero_constructor),
|
||||||
|
|
||||||
ManifestFP = State#state.root_path ++ "/" ++ ?MANIFEST_FP ++ "/",
|
ManifestFP = State#state.root_path ++ "/" ++ ?MANIFEST_FP ++ "/",
|
||||||
FilesFP = State#state.root_path ++ "/" ++ ?FILES_FP ++ "/",
|
FilesFP = State#state.root_path ++ "/" ++ ?FILES_FP ++ "/",
|
||||||
|
@ -1183,21 +1183,34 @@ start_from_file(PCLopts) ->
|
||||||
{ok, State0}.
|
{ok, State0}.
|
||||||
|
|
||||||
|
|
||||||
-spec shutdown_manifest(leveled_pmanifest:manifest()) -> ok.
|
-spec shutdown_manifest(leveled_pmanifest:manifest(), pid()|undefined) -> ok.
|
||||||
%% @doc
|
%% @doc
|
||||||
%% Shutdown all the SST files within the manifest
|
%% Shutdown all the SST files within the manifest
|
||||||
shutdown_manifest(Manifest)->
|
shutdown_manifest(Manifest, L0Constructor) ->
|
||||||
EntryCloseFun =
|
EntryCloseFun =
|
||||||
fun(ME) ->
|
fun(ME) ->
|
||||||
case is_record(ME, manifest_entry) of
|
Owner =
|
||||||
true ->
|
case is_record(ME, manifest_entry) of
|
||||||
ok = leveled_sst:sst_close(ME#manifest_entry.owner);
|
true ->
|
||||||
false ->
|
ME#manifest_entry.owner;
|
||||||
{_SK, ME0} = ME,
|
false ->
|
||||||
ok = leveled_sst:sst_close(ME0#manifest_entry.owner)
|
case ME of
|
||||||
end
|
{_SK, ME0} ->
|
||||||
|
ME0#manifest_entry.owner;
|
||||||
|
ME ->
|
||||||
|
ME
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
ok =
|
||||||
|
case is_pid(Owner) of
|
||||||
|
true ->
|
||||||
|
leveled_sst:sst_close(Owner);
|
||||||
|
false ->
|
||||||
|
ok
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
leveled_pmanifest:close_manifest(Manifest, EntryCloseFun).
|
leveled_pmanifest:close_manifest(Manifest, EntryCloseFun),
|
||||||
|
EntryCloseFun(L0Constructor).
|
||||||
|
|
||||||
|
|
||||||
-spec archive_files(list(), list()) -> ok.
|
-spec archive_files(list(), list()) -> ok.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue