Extensions System #466
-
|
Looking to improve how it is possible to "extend" pREST we are starting an extension system using the Go Language Plugin package that allows to load operating system libraries ( This way it is possible to develop pREST extensions in any language that generates
But today it is not possible to extend pREST as a framework?Yes (we have in the documentation how to do this), but my feeling is to teach people how to hack pREST, it's created "a new software" using the pREST packages, i.e. not necessarily using the pREST product. The proposal of the extension’s ecosystem is to support extending pREST without modifying the distributed binary ( Will framework support be discontinued?No, if you want to use pREST as a framework to develop APIs (or any web software) feel free - the MIT license allows you to do so. But we won't be able to support what's outside our domain (what was developed by you or your team). What can be extended?Some points that I think it is important to extend:
How would the extension be created?Here would not be the best place to talk about implementation, but follows an example of how to use the Go plugin package: Plugin with filename package main
// Hello plugin
func Hello() (ret string) {
ret = "Hello plugin caller!"
return
}It must be compiled using Loading the package main
import (
"fmt"
"plugin"
)
func main() {
p, err := plugin.Open("./exts/lib/hello.so")
if err != nil {
panic(err)
}
f, err := p.Lookup("Hello")
if err != nil {
panic(err)
}
ret := f.(func() string)()
fmt.Println("ret plugin:", ret)
}Running ❯ prestd (master) ✘ go run main.go
ret plugin: Hello plugin caller!Example of generating OS Library ".so" in:Draft: #475 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
|
what about using webassembly ? Envoy do something similar: https://containerjournal.com/features/extending-the-envoy-proxy-with-webassembly/ |
Beta Was this translation helpful? Give feedback.
-
|
I have implemented the first version of the plugin system based on an operating system library ( Following Felipe's proposal (which was sensational): opened an issue to implement the plugin via grpc protocol #662 |
Beta Was this translation helpful? Give feedback.
I have implemented the first version of the plugin system based on an operating system library (
.so), #659Following Felipe's proposal (which was sensational): opened an issue to implement the plugin via grpc protocol #662