knqyf263 / go-plugin

Go Plugin System over WebAssembly
MIT License
573 stars 27 forks source link

Generate host functions in the plugin for use as a reusable library/SDK #27

Closed dmvolod closed 1 year ago

dmvolod commented 1 year ago

Description of changes: This PR makes it possible to generate a plugin consisting only of host functions that can be built into other plugins. Allows to create and distribute resusable SDK/library solutions that are compatible with this plugin.

The following changes have been made

Motivation The wazero library allows you to create host functions and libraries based on them in golang, which can be used in any golang application. However, in some cases, the code that is generated by this plugin must be the source for other plugins, i.e. represent some standard interfaces that need to be implemented and a strict set of specific functions that can or should be used to access the host system. For example, it can be a plugin that is an extension of the Kubernetes operator functionality that implements some small peace of logic. This plugin already has a simple description and generation of host functions with the described interaction interface in the form of gRPC. Eventually, it will be possible to write wrapper functions to easily interact with host functions and package them as a library or SDK.

Embedding libraries into the plugin should be implemented based on code introduced in #28

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

codefromthecrypt commented 1 year ago

Thanks for putting this together. I mostly understand. Can you help me understand fully by adding to the description a summary of the motivation? For example, what concrete problem were you solving before this change and how does it look afterwards. For example, an http handler or something? For example, I'm wondering if you are making an SDK and to what precisely "foreign" will mean in practice. This will help!

dmvolod commented 1 year ago

Thanks for putting this together. I mostly understand. Can you help me understand fully by adding to the description a summary of the motivation? For example, what concrete problem were you solving before this change and how does it look afterwards. For example, an http handler or something? For example, I'm wondering if you are making an SDK and to what precisely "foreign" will mean in practice. This will help!

Thanks for review and provided feedback. Added motivation description in the PR summary. If this proposal is accepted by the community, I will add more documentation on these changes.

codefromthecrypt commented 1 year ago

in the middle of release candidate which should be out tomorrow. If I don't respond in 2 days please nag me!