Skip to content
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

feat(nodes): pass the library path in the context #247

Merged
merged 2 commits into from
Apr 17, 2024

Conversation

J-Loudet
Copy link
Contributor

Fixes #246.

As explained in #246, providing the path of the library that Zenoh-Flow loads is a requirement for developing extensions. For instance, in Python, the pyo3 library needs to load the script.

This change adds the accessor method library_path to the Context structure, that returns a reference to the full path of the library being loaded.

  • zenoh-flow-nodes/src/context.rs:
    • add the library_path field to the Context structure,
    • update the constructor accordingly,
    • add the accessor method library_path().
  • zenoh-flow-runtime/src/loader/mod.rs:
    • update the Loader structure to also store the path of the library that is being loaded,
    • update the code to account for the path of the library being also stored.
  • zenoh-flow-runtime/src/runtime/load.rs:
    • remove the Context in the arguments of the try_load_* methods as it cannot be created at that stage but only when the nodes are loaded,
    • create the Context where appropriate.

Fixes #246.

As explained in #246, providing the path of the library that Zenoh-Flow
loads is a requirement for developing extensions. For instance, in
Python, the `pyo3` library needs to load the script.

This change adds the accessor method `library_path` to the `Context`
structure, that returns a reference to the full path of the library
being loaded.

* zenoh-flow-nodes/src/context.rs:
  - add the library_path field to the Context structure,
  - update the constructor accordingly,
  - add the accessor method `library_path()`.
* zenoh-flow-runtime/src/loader/mod.rs:
  - update the Loader structure to also store the path of the library
    that is being loaded,
  - update the code to account for the path of the library being also
    stored.
* zenoh-flow-runtime/src/runtime/load.rs:
  - remove the `Context` in the arguments of the `try_load_*` methods as
    it cannot be created at that stage but only when the nodes are
    loaded,
  - create the `Context` where appropriate.

Signed-off-by: Julien Loudet <[email protected]>
The previous code was exposing the path of the rust library associated
with the extension, not the path of the library that was "loaded".

This code will load the rust library but keep track and expose the path
of the library that is to load (be it an extension or not).

* zenoh-flow-runtime/src/loader/mod.rs:
  - differentiate the rust library from the "library to load", that, in
    the case of extensions, are different,
  - keep in the hashmap the "library to load" as key.

Signed-off-by: Julien Loudet <[email protected]>
@J-Loudet J-Loudet merged commit 3365158 into main Apr 17, 2024
9 checks passed
@J-Loudet J-Loudet deleted the feat/context-provide-library-path branch May 2, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide the Path of the library in the Context
1 participant