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 #15

Open
kgaughan opened this issue Nov 30, 2022 · 0 comments
Open

Plugin system #15

kgaughan opened this issue Nov 30, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@kgaughan
Copy link
Owner

kgaughan commented Nov 30, 2022

One gap in the functionality of Planet Mercury over Planet Venus is the lack of a plugin/filter system.

I think this should be implemented in two ways:

  1. A Go-based plugin system using the standard library's plugin package. This would be the most powerful method and would allow for the extension of the template system on top of giving ways to process entries. Having experimented with this, I'm not so sure it's a good idea. It requires the use of CGo. A better alternative would be to make use of net/rpc/jsonrpc and spin up small servers that can service requests to process entries. I'll need to work on what the interface will be, but initially, it'll probably be a single method called process that takes a serialised entry and returns a result along the same lines as the pipeline-based method.
  2. An external method for processing entries. This would serialise entries as JSON to be read from stdin and read the result from stdout. The status could be used to determine whether the script was happy (0), wants the entry skipped (1), or is returning an error (2+, with the error serialised as JSON). I don't think it's a good idea to overload the semantics of the exit status like this now.

There's an opportunity for batching here, which could aid with filtering. I think the top level of the request and response should be an array of entries, even if the entries are just being passed through one-by-one. That way, if an entry should be skipped, omitting the entry will be enough.

@kgaughan kgaughan added the enhancement New feature or request label Dec 1, 2022
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

1 participant