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

Plugin system status here #19

Open
DmitryHudrich opened this issue Jan 6, 2025 · 1 comment
Open

Plugin system status here #19

DmitryHudrich opened this issue Jan 6, 2025 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@DmitryHudrich
Copy link
Member

Concept

Asya will interop with plugins through C ABI compatible code.

Currently all plugins works as event loops:

  • *const PluginInformation plugin_info() where PluginInformation is a struct, defined here and looks like:

        #[repr(C)]
        #[derive(Debug)]
        pub struct PluginInformation {
            pub name: *const c_char,
            pub event_callback: EventCallbalck,
            pub init_callback: InitCallback,
            pub execute_callback: ExecuteCallback,
        }

    PluginInformation represents bootstrap data, that contains name, and few callbacks:

    • name is a name of plugin which doesn't depend of file name of plugins. need for more stability. this name also used during event publishing from plugin.
    • init_callback - called when the plugins starts, should returns *mut State
    • event_callback - called when the plugin receives event in EventState
    • execute_callback - called every 100 microseconds

I think event loop is too complicated for development and i suggest this:

  • write plugins with some entry_point, e.g. init_callback from prev example.
  • start this entry point in separated thread.
  • all plugins will be share events and some data through api calls, e.g. from here.
    This approach gives us more safety because crash in plugin won't crash entire plugins system. And states of plugins will be store in plugins instead of storing them in plugin resolver
@DmitryHudrich DmitryHudrich added the enhancement New feature or request label Jan 6, 2025
@DmitryHudrich DmitryHudrich pinned this issue Jan 6, 2025
@DmitryHudrich
Copy link
Member Author

#15 working here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants