-
Notifications
You must be signed in to change notification settings - Fork 86
Context support for Rust wasm filter SDK #399
Conversation
6ad8815
to
928f876
Compare
Signed-off-by: shikugawa <Shikugawa@gmail.com> Kick CI Signed-off-by: shikugawa <Shikugawa@gmail.com>
928f876
to
42d3da1
Compare
api/wasm/rust/src/context.rs
Outdated
pub trait ContextFactory { | ||
fn create( | ||
&self, | ||
_root_context: Arc<Mutex<dyn RootContext + Sync + Send>>, |
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.
i dont think you need Arc \ mutex here.
regular Rc without mutex should work, as IIRC VMs are instantiated per thread.
even if that wasn't the case i would still go for Arc but without mutex (similar to how envoy filters work today).
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.
@yuval-k It may be not required Mutex, but required Arc. Because we use only Rc, we can't guarantee the thread safety of static region variables and rustc can't pass them. It can pass with thread_local!
macro. But we can't apply thread_local!
and lazy_static!
simultaneously.
So we should rewrite it to
_root_context: Arc<dyn RootContext + Sync + Send>
Signed-off-by: shikugawa <Shikugawa@gmail.com>
Signed-off-by: shikugawa <Shikugawa@gmail.com>
Hi @Shikugawa, thanks writing this code and apologies for the delay! However, please see: #351 (comment) and #384 (comment). I have a fairly more complete Rust SDK staged for publishing, but it's waiting for some approvals. Once it's out, I'm happy to incorporate changes from this PR. Sorry for the inconvenience! |
@PiotrSikora Thanks. I'm developing Rust support not only context but also other functionalities. (e.g. pair marshaling/unmarshaling) I will add some functionality if there is missing that. I will help Rust SDK development! |
Signed-off-by: shikugawa <Shikugawa@gmail.com>
As you already noticed, the Rust SDK has been published at: Please feel free to reopen PRs there, thanks! |
Description: Context support for Rust wasm filter SDK. This is the only proposal implementation for SDK. So It may be required to discuss.
Risk Level: Low
Testing:
Docs Changes:
Release Notes:
[Optional Fixes #Issue]
[Optional Deprecated:]