feat: initial wasm support#5288
Conversation
Signed-off-by: spacewander <[email protected]>
|
|
||
| * All plugin run in the same WASM VM, like the Lua plugin in the Lua VM | ||
| * Each plugin has its own VMContext (the root ctx) | ||
| * Each configured route/global rules has its own PluginContext (the plugin ctx). |
There was a problem hiding this comment.
| * Each configured route/global rules has its own PluginContext (the plugin ctx). | |
| * Each configured route/global rules has its own PluginContext (the plugin ctx). | |
There was a problem hiding this comment.
The For example in the next line belongs to this item.
| * All plugin run in the same WASM VM, like the Lua plugin in the Lua VM | ||
| * Each plugin has its own VMContext (the root ctx) | ||
| * Each configured route/global rules has its own PluginContext (the plugin ctx). | ||
| For example, if we have a service configures with WASM plugin, and two routes inherit from it, |
There was a problem hiding this comment.
| For example, if we have a service configures with WASM plugin, and two routes inherit from it, | |
| For example, if we have a service configuring the WASM plugin, and two routes inherit from it, |
| there will be two plugin ctxs. | ||
| * Each HTTP request which hits the configuration will have its own HttpContext (the HTTP ctx). | ||
| For example, if we configure both global rules and route, the HTTP request will | ||
| have two HTTP ctxs, one for the plugin ctx from global rules and another for the |
There was a problem hiding this comment.
| have two HTTP ctxs, one for the plugin ctx from global rules and another for the | |
| have two HTTP ctxs, one for the plugin ctx from global rules and the other for the |
membphis
left a comment
There was a problem hiding this comment.
A benchmark is missing, confirm that it works
| type = "object", | ||
| properties = { | ||
| name = { | ||
| type = "string" |
There was a problem hiding this comment.
Lack of a reasonable length range?
There was a problem hiding this comment.
We don't need to have a limitation of the length. Otherwise people will ask they can't set a xxx with length yyy.
| type = "string" | ||
| }, | ||
| file = { | ||
| type = "string" |
| function get_plugin_ctx_key(ctx) | ||
| key_buf[1] = ctx.conf_type | ||
| key_buf[2] = ctx.conf_id | ||
| return concat(key_buf, "#", 1, 2) |
There was a problem hiding this comment.
style: ctx.conf_type .. '#' .. ctx.conf_id is better
There was a problem hiding this comment.
The current way is faster
| └────────────────────────────────────────────────────────────────┘ | ||
| ``` | ||
|
|
||
| * All plugin run in the same WASM VM, like the Lua plugin in the Lua VM |
I will add it later, this PR already has more than 1000 lines. |
Signed-off-by: spacewander <[email protected]>
| This plugin requires APISIX to run on [APISIX-OpenResty](../how-to-build.md#step-6-build-openresty-for-apache-apisix), and is under construction. | ||
| Currently, only a few APIs are implemented. Please follow [wasm-nginx-module](https://github.com/api7/wasm-nginx-module) to know the progress. |
There was a problem hiding this comment.
and is under construction -> which is under construction
There was a problem hiding this comment.
No, after this change it seems APISIX-OpenResty is under construction.
Signed-off-by: spacewander [email protected]
What this PR does / why we need it:
Fix #157
Pre-submission checklist: