From bcf10c970970534ca58a47731b1e88bec10bf675 Mon Sep 17 00:00:00 2001 From: Martin Sumner Date: Tue, 19 Nov 2019 16:36:57 +0000 Subject: [PATCH] Fixup comments --- src/leveled_imanifest.erl | 7 +++++++ src/leveled_inker.erl | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/leveled_imanifest.erl b/src/leveled_imanifest.erl index 4e560e9..e278ad7 100644 --- a/src/leveled_imanifest.erl +++ b/src/leveled_imanifest.erl @@ -151,6 +151,10 @@ to_list(Manifest) -> -spec reader(integer(), string()) -> manifest(). %% @doc %% Given a file path and a manifest SQN return the inker manifest +%% If the reader crashes on startup the database cannot be started. However, +%% previous versions of the manifest are kept - and so a rollback can be +%% performed. If waste is not retained though, there may be unresolvable data +%% loss on rollback. reader(SQN, RootPath) -> ManifestPath = leveled_inker:filepath(RootPath, manifest_dir), leveled_log:log("I0015", [ManifestPath, SQN]), @@ -171,6 +175,9 @@ writer(Manifest, ManSQN, RootPath) -> integer_to_list(ManSQN) ++ "." ++ ?MANIFEST_FILEX), TmpFN = filename:join(ManPath, integer_to_list(ManSQN) ++ "." ++ ?PENDING_FILEX), + %% TODO: This should support a CRC check, but issues with making the CRC + %% check backwards compatible (so that the reader can read manifests both + %% with and without a CRC check) MBin = term_to_binary(to_list(Manifest), [compressed]), leveled_log:log("I0016", [ManSQN]), ok = leveled_util:safe_rename(TmpFN, NewFN, MBin, true), diff --git a/src/leveled_inker.erl b/src/leveled_inker.erl index e19ceda..32ee376 100644 --- a/src/leveled_inker.erl +++ b/src/leveled_inker.erl @@ -323,7 +323,7 @@ ink_fold(Pid, MinSQN, FoldFuns, Acc) -> -spec ink_loadpcl(pid(), integer(), fun(), pid()) -> ok. %% -%% Function to prompt load of the Ledger at startup. the Penciller should +%% Function to prompt load of the Ledger at startup. The Penciller should %% have determined the lowest SQN not present in the Ledger, and the inker %% should fold over the Journal from that point, using the function to load %% penciller with the results. @@ -988,7 +988,7 @@ key_check(LedgerKey, SQN, Manifest) -> -spec build_manifest(list(), list(), #cdb_options{}) -> {leveled_imanifest:manifest(), integer(), integer(), pid()}. %% @doc -%% Selectes the correct manifets to open, and the starts a process for each +%% Selects the correct manifest to open, and then starts a process for each %% file in the manifest, storing the PID for that process within the manifest. %% Opens an active journal if one is not present. build_manifest(ManifestFilenames, @@ -1026,7 +1026,7 @@ build_manifest(ManifestFilenames, JSQN end, - % Update the manifest if it has been changed by the process of laoding + % Update the manifest if it has been changed by the process of loading % the manifest (must also increment the manifest SQN). UpdManifestSQN = if