-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-architecture the node binding #36
Comments
@mgautierfr I would be happy if you could give a few guidelines/things to respect to do that work properly. |
First, you have to consider the reading part and the writing part as two different libraries. They are in the same repository and share few common structure name (as
About blob. Blob is a proxy to a content store somewhere. It mostly contains a pointer to the data and a size. It is cheap to copy. On reading side, the wrapper should avoid to copy the data pointed by the blob. If it is not possible, the data must be copied the later possible, and only when actually needed. The best would be to "convert" the blob to the equivalent in node world (I don't know if it is possible, we have When creating zim file, the wrapper must create a blob (when needed) pointing to the data and pass it to c++. You must ensure that the data is not deleted by node as long as c++ use the blob. (You are sure that the blob will not live longer than the article. So it is enough, and easier, to ensure that the pointed data existing as long as the article exists). |
@mgautierfr I have a few questions about libzim's architecture regarding this.
|
Because they are nothing in common (even if few methods have the same name). When you use inheritance,
This is a flaw in the API. I realized that when working with python wrapper. You can't create your own Blob managing its own data internally.
Yes. It is probably this system that should be use once we will fix the issue with the blob. The deletion of the data would be tied to the existance of the blob (or one of its copy). When the last copy of the blob is deleted, then napi would delete the data. |
@kelvinhammond Would be happy to invite you to our Slack channel if you are interested.... because part of the discussion around node-libzim and MWoffliner just happen there. Just write me an email to kelson at kiwix . org to get an invitation. |
@kelvinhammond To which extend #72 fixes this ticket? |
@kelson42 You're still going to have issues with the copying, I haven't figured out a way to avoid that in nodejs. We now have the threading issue where we can't easily create custom content creators. |
@kelvinhammond To my understanding, it looks like you have done most of the work requested here. If so, I woukd recommend to open dedicated tickets for the parts still to do and close this one. Do you agree? |
@kelvinhammond Any feedback here please? Now that libzim 8.2.0 has been released, I will push the release of libzim-nodejs 3.0.0 (finally). |
@kelvinhammond We have #80 for the threading issue, but if you could open a ticket for the copying issue, I would be glad to close this old ticket which has been implemented to 99% thanks to your work. |
@audiodude Issue probably worth a read |
The current node binding does not respect the libzim reader/writer patterns. This should be rewritten to respect it (like the the python-libzim binding does).
After this is doing, we could probably provide high level abstraction of it in a dedicated package (like the python_scraperlib) to simplify the life of scraper devs.
The text was updated successfully, but these errors were encountered: