-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat: initial wasm support #5288
Conversation
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
|
||
* 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The For example
in the next line belongs to this item.
docs/en/latest/wasm.md
Outdated
* 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, |
docs/en/latest/wasm.md
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A benchmark is missing, confirm that it works
type = "object", | ||
properties = { | ||
name = { | ||
type = "string" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lack of a reasonable length range?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditoo
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: ctx.conf_type .. '#' .. ctx.conf_id
is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current way is faster
docs/en/latest/wasm.md
Outdated
└────────────────────────────────────────────────────────────────┘ | ||
``` | ||
|
||
* All plugin run in the same WASM VM, like the Lua plugin in the Lua VM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All plugin
-> All plugins
I will add it later, this PR already has more than 1000 lines. |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and is under construction
-> which is under construction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, after this change it seems APISIX-OpenResty is under construction.
Signed-off-by: spacewander spacewanderlzx@gmail.com
What this PR does / why we need it:
Fix #157
Pre-submission checklist: