Skip to content

Plugin API for extending back-end / server-side logic #69

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

Open
joepio opened this issue Oct 23, 2021 · 0 comments
Open

Plugin API for extending back-end / server-side logic #69

joepio opened this issue Oct 23, 2021 · 0 comments

Comments

@joepio
Copy link
Member

joepio commented Oct 23, 2021

Being able to extend the functionality of an Atomic Data Server can be very useful.

I've already written quite a bit on plugins, mostly in the atomic-data-rust repo in this issue and these tagged issues.

Usecases:

  • Automatically import things from some we service (e.g. import rss articles for an rss reader)
  • Use a custom / possibly external authorization mechanism (e.g. active directory)
  • Add custom, dynamic properties to resources (e.g. show who the author is of some resource by checking commits)
  • Add an endpoint that does things (e.g. an endpoit that serves Atomic Data events asiCal calendar items)

Hooks / handles

We need some way of knowing when a plugin should be executed. I think having a bunch of hooks is the way to go:

  • onCron (cron jobs, exectutes every X time)
  • beforeCommit (e.g. extra authorization checks)
  • aftercommit (e.g. additional indexing logic)
  • onRequest (e.g. extend a resource, or create some custom endpoint)

For many of these hooks, it makes sense to standardize conditional logic. For beforeCommit, for example, we might want to check if some properties in the resource are present. We could also keep this check logic in the hook itself, but then we'd need to call all of the hooks, always for every resource. If instantiating the plugin itself is costly, this could dramatically impact performance.

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

No branches or pull requests

1 participant