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

Allow loading external Rust Filters dynamically #420

Open
markmandel opened this issue Oct 12, 2021 · 3 comments
Open

Allow loading external Rust Filters dynamically #420

markmandel opened this issue Oct 12, 2021 · 3 comments
Labels
area/filters Related to Quilkin's filter API. area/user-experience Pertaining to developers trying to use Quilkin, e.g. cli interface, configuration, etc kind/design Proposal discussing new features / fixes and how they should be implemented kind/feature New feature or request

Comments

@markmandel
Copy link
Member

Context:

If the filter traits were moved to another crate, filters could be defined in separate crates and loaded by Quilkin at runtime. That would be much more reasonable for users.

Originally posted by @XAMPPRocky in #401 (comment)

This is an issue to track this idea, as I think it's definitely got value for sure. I'm sure @XAMPPRocky you know more about this than I do. I couldn't find a particularly clear guide.

Here are the resources I found:

@markmandel markmandel added area/filters Related to Quilkin's filter API. area/user-experience Pertaining to developers trying to use Quilkin, e.g. cli interface, configuration, etc kind/design Proposal discussing new features / fixes and how they should be implemented kind/feature New feature or request labels Oct 12, 2021
@XAMPPRocky
Copy link
Collaborator

I hadn't looked at stable_abi closely before, it seems interesting and worth investigating. I think we should discuss what kind of behaviour we expect from the runtime loading. Here are a couple of open questions that come to mind.

  • Where do we store the plugins? What's considered best practice for dynamic libraries in Linux/macOS/Windows?
    • I know Windows autoloads dlls adjacent to the running binary.
  • When are are plugins loaded, at startup, dynamically?
    • This is important as it would affect how the FFI code would work. stable_abi doesn't support unloading for example.
    • I'm inclined towards startup only for simplicity and security.
  • What context do we send across the FFI boundary?

@markmandel
Copy link
Member Author

Where do we store the plugins?

My suggestion: make the folder to search (I'm assuming there may be more than one plugin loaded at once) configurable through the config yaml, but with a default of a separate relative directory from the main binary.

I'm inclined towards startup only for simplicity and security.

100% concur. Runtime replacement of code scares me. 😱

What context do we send across the FFI boundary?

I expect this will require experimenting with abi_stable_crates and seeing what is possible, and how close it might come to our existing context data.

Side thought: Assuming all goes to plan with #411 -- would that make things harder to load an external plugin, as we no longer have a context object (or would we need to fabricate one just to allow external loading of code?) Again, might just require some experimentation to see what is possible.

@markmandel
Copy link
Member Author

https://robert.kra.hn/posts/hot-reloading-rust/

Was just reading this - based on work Bevy has been doing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/filters Related to Quilkin's filter API. area/user-experience Pertaining to developers trying to use Quilkin, e.g. cli interface, configuration, etc kind/design Proposal discussing new features / fixes and how they should be implemented kind/feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants