aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2026-09-21 11:52:52 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2026-09-22 14:54:35 -0400
commitb0084e0d55595b1d1cc93a088ae3c841220cddc6 (patch)
tree8ff94d30602444417ad730ab9b14c6d8b2696b35
parentocda.db: read a document language of a database (diff)
digests: db digest taken once on file completion
One file for the document (including all languages) with digest of the document. digests.txt lists it once, beside the shared images, taken when the last language has been written. digests.txt carries all digests. (assisted by Claude-Code)
-rw-r--r--org/out_metadata.org27
-rw-r--r--org/out_src_pod.org35
-rw-r--r--src/sisudoc/outputs/io_out/metadata.d27
-rw-r--r--src/sisudoc/outputs/io_out/source_pod.d35
4 files changed, 56 insertions, 68 deletions
diff --git a/org/out_metadata.org b/org/out_metadata.org
index b816dad..3a17ffe 100644
--- a/org/out_metadata.org
+++ b/org/out_metadata.org
@@ -182,7 +182,7 @@ if (doc_matters.opt.action.html_link_markup_source) {
~ "&nbsp;🫛&nbsp;tree&nbsp;</a>]&nbsp;";
{
auto pths_pod_ = spinePathsPods!()(doc_matters);
- string _db_name = doc_matters.src.doc_uid_out ~ ".ocda.db";
+ string _db_name = doc_matters.src.doc_uid_out_no_lang ~ ".ocda.db";
string _db_fn = pths_pod_.pod_dir_() ~ "/" ~ _db_name;
if (doc_matters.opt.action.ocda_db && _db_fn.exists) {
metadata_ ~= "<p class=\"lev1\">●&nbsp;&nbsp;document abstraction:"
@@ -205,23 +205,14 @@ if (doc_matters.opt.action.html_link_markup_source) {
writeln("WARNING, source doc_matters.src.filename_base not found: ", doc_matters.src.filename_base, pod_archive_suffix, "\n ", fn_pod);
}
}
- if (doc_matters.opt.action.ocda_db) {
- try { // sha digest and size for the abstraction database, beside the pod
- string _db_fn = pths_pod.pod_dir_() ~ "/"
- ~ doc_matters.src.doc_uid_out ~ ".ocda.db";
- if (_db_fn.exists) {
- auto data = (cast(byte[]) (_db_fn).read);
- metadata_ ~= "<p class=\"lev2\">";
- metadata_ ~= "<tt>" ~ data.sha256Of.toHexString ~ "::"
- ~ data.length.to!string ~ "</tt> - "
- ~ doc_matters.src.doc_uid_out ~ ".ocda.db";
- metadata_ ~= "</p>";
- }
- } catch (Exception ex) {
- writeln("WARNING, abstraction db not read for metadata page: ",
- doc_matters.src.doc_uid_out, ".ocda.db");
- }
- }
+ /+ ↓ no digest for the .ocda.db here.
+ One database holds every language of the document and is added to
+ once per language, so at the time this page is written for a given
+ language the file is in general not finished: a digest taken here
+ would be a digest of a file that no longer exists by the end of
+ the run. The digest is taken once, when the database is complete,
+ and recorded in <doc>.digests.txt, which is linked above.
+ +/
}
if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) {
metadata_ ~= "<hr /><p class=\"lev0\">Topics:</p>";
diff --git a/org/out_src_pod.org b/org/out_src_pod.org
index 8668078..b4bbde3 100644
--- a/org/out_src_pod.org
+++ b/org/out_src_pod.org
@@ -251,19 +251,22 @@ auto pod_zipMakeReady(M,P,S)(M doc_matters, P pths_pod, S _st) {
writeln("WARNING (io) src out NOT found (abstraction): ", fn_src_in);
}
}
- /+ ↓ the .ocda.db sits beside the pod rather than inside it: it
- carries the images itself, and putting it in the zip would
- store them twice. digested here so that digests.txt covers
- every artefact the pod directory holds for this document
- +/
- {
- string db_filename = _doc_uid_base ~ _lang ~ ".ocda.db";
- string fn_db = pths_pod.pod_dir_() ~ "/" ~ db_filename;
- if (exists(fn_db)) {
- ST_file_stat file_ = getFileStat(fn_db);
- _digests[_lang]["ocda_db"] ~= file_.sha256hash.toHexString
- ~ "::" ~ file_.fileSize.to!string ~ " - " ~ db_filename ~ "\n";
- }
+ }
+ /+ ↓ the .ocda.db sits beside the pod rather than inside it: it
+ carries the images itself, and putting it in the zip would
+ store them twice. digested here so that digests.txt covers
+ every artefact the pod directory holds for this document.
+ One database holds every language of the document, so it is
+ digested once, when the last language has been written into
+ it, and listed as shared rather than per language.
+ +/
+ {
+ string db_filename = doc_matters.src.doc_uid_out_no_lang ~ ".ocda.db";
+ string fn_db = pths_pod.pod_dir_() ~ "/" ~ db_filename;
+ if (exists(fn_db)) {
+ ST_file_stat file_ = getFileStat(fn_db);
+ _digests["shared"]["ocda_db"] ~= file_.sha256hash.toHexString
+ ~ "::" ~ file_.fileSize.to!string ~ " - " ~ db_filename ~ "\n";
}
}
}
@@ -738,12 +741,12 @@ void zipArchiveDigest(M,F,D)(M doc_matters, F fn_pod, D _digests) {
if (("ssp" in _digests[_lang]) && (_digests[_lang]["ssp"].length > 0)) {
f.writeln(_digests[_lang]["ssp"].strip);
}
- if (("ocda_db" in _digests[_lang]) && (_digests[_lang]["ocda_db"].length > 0)) {
- f.writeln(_digests[_lang]["ocda_db"].strip);
- }
}
}
if ("shared" in _digests) {
+ if (("ocda_db" in _digests["shared"]) && (_digests["shared"]["ocda_db"].length > 0)) {
+ f.writeln(_digests["shared"]["ocda_db"].strip);
+ }
if (("images" in _digests["shared"]) && (_digests["shared"]["images"].length > 0)) {
// if (doc_matters.opt.action.vox_gt_2) { writeln(_digests["shared"]["images"]); }
f.writeln(_digests["shared"]["images"]);
diff --git a/src/sisudoc/outputs/io_out/metadata.d b/src/sisudoc/outputs/io_out/metadata.d
index 5a10c64..c54c9af 100644
--- a/src/sisudoc/outputs/io_out/metadata.d
+++ b/src/sisudoc/outputs/io_out/metadata.d
@@ -516,7 +516,7 @@ string theme_light_1 = format(q"┃
~ "&nbsp;🫛&nbsp;tree&nbsp;</a>]&nbsp;";
{
auto pths_pod_ = spinePathsPods!()(doc_matters);
- string _db_name = doc_matters.src.doc_uid_out ~ ".ocda.db";
+ string _db_name = doc_matters.src.doc_uid_out_no_lang ~ ".ocda.db";
string _db_fn = pths_pod_.pod_dir_() ~ "/" ~ _db_name;
if (doc_matters.opt.action.ocda_db && _db_fn.exists) {
metadata_ ~= "<p class=\"lev1\">●&nbsp;&nbsp;document abstraction:"
@@ -539,23 +539,14 @@ string theme_light_1 = format(q"┃
writeln("WARNING, source doc_matters.src.filename_base not found: ", doc_matters.src.filename_base, pod_archive_suffix, "\n ", fn_pod);
}
}
- if (doc_matters.opt.action.ocda_db) {
- try { // sha digest and size for the abstraction database, beside the pod
- string _db_fn = pths_pod.pod_dir_() ~ "/"
- ~ doc_matters.src.doc_uid_out ~ ".ocda.db";
- if (_db_fn.exists) {
- auto data = (cast(byte[]) (_db_fn).read);
- metadata_ ~= "<p class=\"lev2\">";
- metadata_ ~= "<tt>" ~ data.sha256Of.toHexString ~ "::"
- ~ data.length.to!string ~ "</tt> - "
- ~ doc_matters.src.doc_uid_out ~ ".ocda.db";
- metadata_ ~= "</p>";
- }
- } catch (Exception ex) {
- writeln("WARNING, abstraction db not read for metadata page: ",
- doc_matters.src.doc_uid_out, ".ocda.db");
- }
- }
+ /+ ↓ no digest for the .ocda.db here.
+ One database holds every language of the document and is added to
+ once per language, so at the time this page is written for a given
+ language the file is in general not finished: a digest taken here
+ would be a digest of a file that no longer exists by the end of
+ the run. The digest is taken once, when the database is complete,
+ and recorded in <doc>.digests.txt, which is linked above.
+ +/
}
if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) {
metadata_ ~= "<hr /><p class=\"lev0\">Topics:</p>";
diff --git a/src/sisudoc/outputs/io_out/source_pod.d b/src/sisudoc/outputs/io_out/source_pod.d
index 4730bf2..f6d7765 100644
--- a/src/sisudoc/outputs/io_out/source_pod.d
+++ b/src/sisudoc/outputs/io_out/source_pod.d
@@ -282,19 +282,22 @@ template spinePod() {
writeln("WARNING (io) src out NOT found (abstraction): ", fn_src_in);
}
}
- /+ ↓ the .ocda.db sits beside the pod rather than inside it: it
- carries the images itself, and putting it in the zip would
- store them twice. digested here so that digests.txt covers
- every artefact the pod directory holds for this document
- +/
- {
- string db_filename = _doc_uid_base ~ _lang ~ ".ocda.db";
- string fn_db = pths_pod.pod_dir_() ~ "/" ~ db_filename;
- if (exists(fn_db)) {
- ST_file_stat file_ = getFileStat(fn_db);
- _digests[_lang]["ocda_db"] ~= file_.sha256hash.toHexString
- ~ "::" ~ file_.fileSize.to!string ~ " - " ~ db_filename ~ "\n";
- }
+ }
+ /+ ↓ the .ocda.db sits beside the pod rather than inside it: it
+ carries the images itself, and putting it in the zip would
+ store them twice. digested here so that digests.txt covers
+ every artefact the pod directory holds for this document.
+ One database holds every language of the document, so it is
+ digested once, when the last language has been written into
+ it, and listed as shared rather than per language.
+ +/
+ {
+ string db_filename = doc_matters.src.doc_uid_out_no_lang ~ ".ocda.db";
+ string fn_db = pths_pod.pod_dir_() ~ "/" ~ db_filename;
+ if (exists(fn_db)) {
+ ST_file_stat file_ = getFileStat(fn_db);
+ _digests["shared"]["ocda_db"] ~= file_.sha256hash.toHexString
+ ~ "::" ~ file_.fileSize.to!string ~ " - " ~ db_filename ~ "\n";
}
}
}
@@ -699,12 +702,12 @@ template spinePod() {
if (("ssp" in _digests[_lang]) && (_digests[_lang]["ssp"].length > 0)) {
f.writeln(_digests[_lang]["ssp"].strip);
}
- if (("ocda_db" in _digests[_lang]) && (_digests[_lang]["ocda_db"].length > 0)) {
- f.writeln(_digests[_lang]["ocda_db"].strip);
- }
}
}
if ("shared" in _digests) {
+ if (("ocda_db" in _digests["shared"]) && (_digests["shared"]["ocda_db"].length > 0)) {
+ f.writeln(_digests["shared"]["ocda_db"].strip);
+ }
if (("images" in _digests["shared"]) && (_digests["shared"]["images"].length > 0)) {
// if (doc_matters.opt.action.vox_gt_2) { writeln(_digests["shared"]["images"]); }
f.writeln(_digests["shared"]["images"]);