mirror of
https://git.pumpin.online/funkpower/catena.git
synced 2026-10-23 03:07:13 +00:00
bindings: what a book says about itself, and what the register says back
book-pipeline reaches for colophon and bibfetch on every book it repairs. Shelling out would mean a process per book per tool across five thousand books, and parsing back the JSON it is about to parse anyway. bibfetch's fetch loop lived in main.rs, so binding it meant either lifting it or writing a second one. A second implementation of 'which register answers about this kind of identifier, and in what order' would drift from the first, and the copy nobody runs from a terminal would drift silently. It is now bibfetch::ask, and the command line calls it too — verified by running the CLI before and after and diffing. fetch_identifier releases the GIL around the request. It is the only function here that opens a socket, and holding the interpreter for the length of an HTTP call would stop every other thread in it. bibfetch is optional and only the python feature turns it on: its HTTP client does not build for wasm32, and an unconditional dependency would have taken the JavaScript package down with it.
This commit is contained in:
@@ -30,6 +30,7 @@ crate-type = ["cdylib", "rlib"]
|
||||
[dependencies]
|
||||
booksniff.workspace = true
|
||||
bibclean.workspace = true
|
||||
colophon.workspace = true
|
||||
chunkmd.workspace = true
|
||||
citefind.workspace = true
|
||||
corpus-core.workspace = true
|
||||
@@ -47,6 +48,11 @@ textkit.workspace = true
|
||||
|
||||
pyo3 = { workspace = true, optional = true }
|
||||
|
||||
# Only the Python build gets this. bibfetch is the one tool here that opens a
|
||||
# socket, and its HTTP client does not build for wasm32 — so a dependency that
|
||||
# is unconditional would take the JavaScript package down with it.
|
||||
bibfetch = { workspace = true, optional = true }
|
||||
|
||||
# The JavaScript build. Only ever compiled for a wasm32 target; on any other
|
||||
# the module is compiled out and these sit unused.
|
||||
wasm-bindgen = { workspace = true, optional = true }
|
||||
@@ -56,7 +62,7 @@ serde-wasm-bindgen = { workspace = true, optional = true }
|
||||
# Only maturin turns this on. pyo3's extension-module feature leaves the
|
||||
# Python symbols to be resolved by the interpreter at load time, so an
|
||||
# ordinary `cargo build` would fail to link if it were on by default.
|
||||
python = ["dep:pyo3"]
|
||||
python = ["dep:pyo3", "dep:bibfetch"]
|
||||
# The C ABI. Off by default so an ordinary build does not also export a
|
||||
# hundred symbols nobody asked for.
|
||||
capi = []
|
||||
|
||||
Reference in New Issue
Block a user