-
Notifications
You must be signed in to change notification settings - Fork 101
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
Allow RootContext to create child contexts for streams. #34
Conversation
3b1b730
to
fa8512a
Compare
src/traits.rs
Outdated
fn create_http_context(&self, _context_id: u32, _root_context_id: u32) -> Box<dyn HttpContext> { | ||
Box::new(EmptyHttpContext) | ||
} | ||
|
||
fn create_stream_context( | ||
&self, | ||
_context_id: u32, | ||
_root_context_id: u32, | ||
) -> Box<dyn StreamContext> { | ||
Box::new(EmptyStreamContext) | ||
} | ||
|
||
fn get_type(&self) -> ContextType { | ||
ContextType::RootContext | ||
} |
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.
Since we know the context type, could this be turned into a single new_context
function that returns various context types?
Alternatively, we could allow plugins to implement multiple traits/interfaces, in which case get_type
would be an unnecessary limitation, although I don't think this could work with the current ABI...
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.
if I had to choose I'd prefer the former (ie have a single new_context
fn that creates whatever type), but at this point I think I like the more explicit approach more- because in the end we would have to be type-casting in the SDK again to call trait-specific fn's. but I'm open to suggestions
examples/http_body.rs
Outdated
} | ||
} | ||
|
||
impl Context for HttpBodyRoot {} |
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.
Nit: move impl Context
before impl RootContext
to match order for HttpBody
.
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.
done
examples/http_auth_random.rs
Outdated
@@ -20,10 +20,23 @@ use std::time::Duration; | |||
#[no_mangle] | |||
pub fn _start() { | |||
proxy_wasm::set_log_level(LogLevel::Trace); | |||
proxy_wasm::set_http_context(|_, _| -> Box<dyn HttpContext> { Box::new(HttpAuthRandom) }); | |||
proxy_wasm::set_root_context(|_| -> Box<dyn RootContext> { Box::new(HttpAuthRandomRoot) }); |
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.
Looking at this example, I wonder if we couldn't do something type-specific here, e.g.
proxy_wasm::set_root_context(|_| -> Box<dyn RootContext> { Box::new(HttpHeadersRoot) });
proxy_wasm::set_http_context(|root_context, context_id| -> Box<dyn HttpContext> {
root_context.new_http_context(context_id)
});
with dispatcher taking care of resolving root_context_id
to root_context
before calling this callback?
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.
On the second thought, that might be useless, since we cannot expose multiple interfaces right now anyway.
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.
Also, could you merge/rebase on top of current master branch? Thanks!
Signed-off-by: Daniel Grimm <dgrimm@redhat.com>
Signed-off-by: Daniel Grimm <dgrimm@redhat.com>
- Remove root_context_id from RootContext's create_http_stream and create_http_context calls - Move EmptyHttpContext after HttpContext declaration - Reorder trait impl's in examples to be consistent Signed-off-by: Daniel Grimm <dgrimm@redhat.com>
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.
Thanks! Could you also add an example showing developers how to use this feature? Maybe add a new header which value is passed via configuration to examples/http_headers.rs
?
Note to self: merge this after tagging v0.1.3 (pending fix for #40).
examples/http_body.rs
Outdated
@@ -18,10 +18,23 @@ use proxy_wasm::types::*; | |||
#[no_mangle] | |||
pub fn _start() { | |||
proxy_wasm::set_log_level(LogLevel::Trace); | |||
proxy_wasm::set_http_context(|_, _| -> Box<dyn HttpContext> { Box::new(HttpBody) }); | |||
proxy_wasm::set_root_context(|_| -> Box<dyn RootContext> { Box::new(HttpBodyRoot) }); | |||
} | |||
|
|||
struct HttpBody; |
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.
Nit: move struct HttpBody;
after definition of HttpBodyRoot
.
src/types.rs
Outdated
@@ -85,3 +85,9 @@ pub enum MetricType { | |||
} | |||
|
|||
pub type Bytes = Vec<u8>; | |||
|
|||
pub enum ContextType { |
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.
Please add:
#[repr(u32)]
#[derive(Debug)]
(it's not used in the ABI right now, but it's going to be soon, so we might as well define it properly now)
Also, could you move it below Status
?
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.
done
self.create_stream_context(context_id, root_context_id) | ||
} | ||
ContextType::RootContext => panic!("missing ContextType on root_context"), | ||
} |
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.
One more thing. I think it would be useful if we could retain backwards compatibility, and merge this without breaking all existing plugins, even if there aren't too many in the wild right now.
One way to do this is to fallback to the standalone constructors in case root_context.get_type()
returns ContextType::RootContext
or None
, and perhaps revert changes to examples/http_auth_random.rs
to make sure that the old code path still works.
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.
+1 to remain backwards-compatible, but I think we should then deprecate the old way to create contexts and remove it in 0.2.0
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.
that would also allow us to remove NoopRoot
in 0.2.0
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 "old way" is fine for plugins that don't have configuration (e.g. where everything is already in the code), and the "new way" can double the code size with unnecessary boilerplate.
But it's something to consider for sure.
src/traits.rs
Outdated
@@ -121,6 +121,18 @@ pub trait RootContext: Context { | |||
fn on_queue_ready(&mut self, _queue_id: u32) {} | |||
|
|||
fn on_log(&mut self) {} | |||
|
|||
fn create_http_context(&self, _context_id: u32) -> Box<dyn HttpContext> { | |||
Box::new(EmptyHttpContext) |
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.
Box<dyn HttpContext>
-> Option<Box<dyn HttpContext>>
and return None
.
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.
done
src/traits.rs
Outdated
} | ||
|
||
fn create_stream_context(&self, _context_id: u32) -> Box<dyn StreamContext> { | ||
Box::new(EmptyStreamContext) |
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.
Ditto.
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.
done
src/traits.rs
Outdated
} | ||
|
||
fn get_type(&self) -> ContextType { | ||
ContextType::RootContext |
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.
Option<ContextType>
and return None
.
src/traits.rs
Outdated
struct EmptyStreamContext; | ||
|
||
impl StreamContext for EmptyStreamContext {} | ||
impl Context for EmptyStreamContext {} |
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.
This won't be needed with Option<T>
.
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.
done
src/traits.rs
Outdated
struct EmptyHttpContext; | ||
|
||
impl HttpContext for EmptyHttpContext {} | ||
impl Context for EmptyHttpContext {} |
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.
This won't be needed with Option<T>
.
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.
removed
4fc15fc
to
05d21f3
Compare
- consistent ordering of struct defs in examples - attributes for ContextType enum Signed-off-by: Daniel Grimm <dgrimm@redhat.com>
Signed-off-by: Daniel Grimm <dgrimm@redhat.com>
Signed-off-by: Daniel Grimm <dgrimm@redhat.com>
examples/http_config.rs
Outdated
proxy_wasm::set_log_level(LogLevel::Trace); | ||
proxy_wasm::set_root_context(|_| -> Box<dyn RootContext> { | ||
Box::new(HttpConfigHeaderRootContext { | ||
header_content: "".to_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.
header_content: String::new(),
but you could also use:
header_context: None,
if you change header_content
into Option<String>
.
examples/http_config.rs
Outdated
} | ||
} | ||
|
||
struct HttpConfigHeaderRootContext { |
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.
Nit: name this HttpConfigHeaderRoot
and move it before HttpConfigHeader
to match style used in other examples.
|
||
fn create_http_context(&self, _context_id: u32) -> Option<Box<dyn HttpContext>> { | ||
Some(Box::new(HttpConfigHeader { | ||
header_content: self.header_content.clone(), |
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.
This seems expensive, since presumably each context will own a copy of the header value.
It's fine in this example, since the value is small, but in general, wouldn't it be better to store a reference to the parent context and access configuration from there?
self.create_stream_context(context_id, root_context_id) | ||
} | ||
ContextType::RootContext => panic!("missing ContextType on root_context"), | ||
} |
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 "old way" is fine for plugins that don't have configuration (e.g. where everything is already in the code), and the "new way" can double the code size with unnecessary boilerplate.
But it's something to consider for sure.
#[repr(u32)] | ||
#[derive(Debug)] | ||
pub enum ContextType { | ||
HttpContext = 0, |
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.
Could you re-add RootContext
as 0
here? Thanks.
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.
Why? How would that be different from returning None
?
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 meant only adding enum value here, not using it in this PR, since the ContextType
is part of the updated ABI and I wanted to avoid renumbering later... But since it's not transmitted over the ABI boundary, it probably doesn't matter too much.
Signed-off-by: Daniel Grimm <dgrimm@redhat.com>
#[repr(u32)] | ||
#[derive(Debug)] | ||
pub enum ContextType { | ||
HttpContext = 0, |
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 meant only adding enum value here, not using it in this PR, since the ContextType
is part of the updated ABI and I wanted to avoid renumbering later... But since it's not transmitted over the ABI boundary, it probably doesn't matter too much.
Fixes yskopets#6. Signed-off-by: Daniel Grimm <dgrimm@redhat.com>
* Use Rust toolchains with working components. (#16) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Split licenses check into a separate test target. (#17) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Help other developers get started using this SDK. (#15) Signed-off-by: DazWilkin <daz.wilkin@gmail.com> * Add Bazel support. (#18) Signed-off-by: Shikugawa <Shikugawa@gmail.com> Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add support for setting HTTP bodies. (#2) Signed-off-by: Gregory Brail <gregbrail@google.com> * Release v0.1.1. (#20) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update MapType values to match updated Proxy-Wasm ABI v0.1.0. (#7) Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io> * Release v0.1.2. (#21) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update hashbrown to v0.8.2. (#22) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add cargo audit and cargo outdated checks. (#23) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update chrono to v0.4.15. (proxy-wasm#33) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Move optional checks to the end. (proxy-wasm#28) While there, align style with the test framework. Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Move Bazel to //bazel. (proxy-wasm#29) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Fix HTTP body example. (proxy-wasm#32) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add support for setting network buffers. (proxy-wasm#31) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add metrics. (proxy-wasm#30) Fixes #4. Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update hashbrown and transitive dependencies. (proxy-wasm#45) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Allow building for wasm32-wasi target. (proxy-wasm#42) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Make wee-alloc an optional feature. (proxy-wasm#38) Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com> * Update rules_rust to latest. (proxy-wasm#46) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update cargo-raze to latest and regenerate artifacts. (proxy-wasm#47) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Allow building for wasm32-wasi target using Bazel. (proxy-wasm#50) While there, update Bazel to 3.7.0. Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Show getrandom and chrono/time usage in examples. (proxy-wasm#51) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Use cargo-raze's gen_buildrs for trusted crates. (proxy-wasm#53) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add support for nested HTTP callouts. (proxy-wasm#56) Signed-off-by: Svetlin Zarev <svetlin.zarev@sap.com> * Allow RootContext to create child contexts for streams. (proxy-wasm#34) Fixes #6. Signed-off-by: Daniel Grimm <dgrimm@redhat.com> * Fix warnings from Clippy v1.50.0 (nightly). (proxy-wasm#58) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Release v0.1.3. (proxy-wasm#59) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Cleanup instructions for updating dependencies. (proxy-wasm#60) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Cleanup WORKSPACE. (proxy-wasm#61) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Cleanup examples. (proxy-wasm#62) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update libc (transitive dependency) to v0.2.81. (proxy-wasm#63) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update the declared ABI version to 0.2.0 Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Update the examples so that they use the latest API Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Remove ChildContext for now, which is not used anymore Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Bump the version to 0.0.8 Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Fix bazel build for the fork's crate Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Fix clippy erros in bytestring.rs Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Update dependencies Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Fix Cargo.toml Signed-off-by: Takaya Saeki <takaya@tetrate.io> * outdated should check only root deps Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Fix inconsistent derived traits Signed-off-by: Takaya Saeki <takaya@tetrate.io> Co-authored-by: Piotr Sikora <piotrsikora@google.com> Co-authored-by: Daz Wilkin <DazWilkin@users.noreply.github.com> Co-authored-by: Greg Brail <gbrail@users.noreply.github.com> Co-authored-by: Yaroslav Skopets <y.skopets@gmail.com> Co-authored-by: Yuval Kohavi <yuval.kohavi@gmail.com> Co-authored-by: SvetlinZarev-SAP <43135961+SvetlinZarev-SAP@users.noreply.github.com> Co-authored-by: Daniel Grimm <dgrimm@redhat.com>
* Use Rust toolchains with working components. (#16) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Split licenses check into a separate test target. (#17) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Help other developers get started using this SDK. (#15) Signed-off-by: DazWilkin <daz.wilkin@gmail.com> * Add Bazel support. (#18) Signed-off-by: Shikugawa <Shikugawa@gmail.com> Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add support for setting HTTP bodies. (#2) Signed-off-by: Gregory Brail <gregbrail@google.com> * Release v0.1.1. (#20) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update MapType values to match updated Proxy-Wasm ABI v0.1.0. (#7) Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io> * Release v0.1.2. (#21) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update hashbrown to v0.8.2. (#22) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add cargo audit and cargo outdated checks. (#23) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update chrono to v0.4.15. (proxy-wasm#33) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Move optional checks to the end. (proxy-wasm#28) While there, align style with the test framework. Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Move Bazel to //bazel. (proxy-wasm#29) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Fix HTTP body example. (proxy-wasm#32) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add support for setting network buffers. (proxy-wasm#31) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add metrics. (proxy-wasm#30) Fixes #4. Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update hashbrown and transitive dependencies. (proxy-wasm#45) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Allow building for wasm32-wasi target. (proxy-wasm#42) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Make wee-alloc an optional feature. (proxy-wasm#38) Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com> * Update rules_rust to latest. (proxy-wasm#46) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update cargo-raze to latest and regenerate artifacts. (proxy-wasm#47) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Allow building for wasm32-wasi target using Bazel. (proxy-wasm#50) While there, update Bazel to 3.7.0. Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Show getrandom and chrono/time usage in examples. (proxy-wasm#51) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Use cargo-raze's gen_buildrs for trusted crates. (proxy-wasm#53) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add support for nested HTTP callouts. (proxy-wasm#56) Signed-off-by: Svetlin Zarev <svetlin.zarev@sap.com> * Allow RootContext to create child contexts for streams. (proxy-wasm#34) Fixes #6. Signed-off-by: Daniel Grimm <dgrimm@redhat.com> * Fix warnings from Clippy v1.50.0 (nightly). (proxy-wasm#58) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Release v0.1.3. (proxy-wasm#59) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Cleanup instructions for updating dependencies. (proxy-wasm#60) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Cleanup WORKSPACE. (proxy-wasm#61) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Cleanup examples. (proxy-wasm#62) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update libc (transitive dependency) to v0.2.81. (proxy-wasm#63) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update the declared ABI version to 0.2.0 Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Update the examples so that they use the latest API Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Remove ChildContext for now, which is not used anymore Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Bump the version to 0.0.8 Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Fix bazel build for the fork's crate Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Fix clippy erros in bytestring.rs Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Update dependencies Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Fix Cargo.toml Signed-off-by: Takaya Saeki <takaya@tetrate.io> * outdated should check only root deps Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Fix inconsistent derived traits Signed-off-by: Takaya Saeki <takaya@tetrate.io> Co-authored-by: Piotr Sikora <piotrsikora@google.com> Co-authored-by: Daz Wilkin <DazWilkin@users.noreply.github.com> Co-authored-by: Greg Brail <gbrail@users.noreply.github.com> Co-authored-by: Yaroslav Skopets <y.skopets@gmail.com> Co-authored-by: Yuval Kohavi <yuval.kohavi@gmail.com> Co-authored-by: SvetlinZarev-SAP <43135961+SvetlinZarev-SAP@users.noreply.github.com> Co-authored-by: Daniel Grimm <dgrimm@redhat.com>
This is kind of an improvement from #93 in favor of proxy-wasm/proxy-wasm-rust-sdk#34 and proxy-wasm/proxy-wasm-rust-sdk#67 Note that this is a breaking change, though the fix is trivial. Signed-off-by: Takeshi Yoneda takeshi@tetrate.io
…opets#19) * Use Rust toolchains with working components. (yskopets#16) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Split licenses check into a separate test target. (yskopets#17) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Help other developers get started using this SDK. (yskopets#15) Signed-off-by: DazWilkin <daz.wilkin@gmail.com> * Add Bazel support. (yskopets#18) Signed-off-by: Shikugawa <Shikugawa@gmail.com> Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add support for setting HTTP bodies. (yskopets#2) Signed-off-by: Gregory Brail <gregbrail@google.com> * Release v0.1.1. (yskopets#20) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update MapType values to match updated Proxy-Wasm ABI v0.1.0. (yskopets#7) Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io> * Release v0.1.2. (yskopets#21) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update hashbrown to v0.8.2. (yskopets#22) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add cargo audit and cargo outdated checks. (yskopets#23) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update chrono to v0.4.15. (proxy-wasm#33) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Move optional checks to the end. (proxy-wasm#28) While there, align style with the test framework. Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Move Bazel to //bazel. (proxy-wasm#29) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Fix HTTP body example. (proxy-wasm#32) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add support for setting network buffers. (proxy-wasm#31) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add metrics. (proxy-wasm#30) Fixes yskopets#4. Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update hashbrown and transitive dependencies. (proxy-wasm#45) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Allow building for wasm32-wasi target. (proxy-wasm#42) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Make wee-alloc an optional feature. (proxy-wasm#38) Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com> * Update rules_rust to latest. (proxy-wasm#46) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update cargo-raze to latest and regenerate artifacts. (proxy-wasm#47) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Allow building for wasm32-wasi target using Bazel. (proxy-wasm#50) While there, update Bazel to 3.7.0. Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Show getrandom and chrono/time usage in examples. (proxy-wasm#51) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Use cargo-raze's gen_buildrs for trusted crates. (proxy-wasm#53) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Add support for nested HTTP callouts. (proxy-wasm#56) Signed-off-by: Svetlin Zarev <svetlin.zarev@sap.com> * Allow RootContext to create child contexts for streams. (proxy-wasm#34) Fixes yskopets#6. Signed-off-by: Daniel Grimm <dgrimm@redhat.com> * Fix warnings from Clippy v1.50.0 (nightly). (proxy-wasm#58) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Release v0.1.3. (proxy-wasm#59) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Cleanup instructions for updating dependencies. (proxy-wasm#60) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Cleanup WORKSPACE. (proxy-wasm#61) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Cleanup examples. (proxy-wasm#62) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update libc (transitive dependency) to v0.2.81. (proxy-wasm#63) Signed-off-by: Piotr Sikora <piotrsikora@google.com> * Update the declared ABI version to 0.2.0 Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Update the examples so that they use the latest API Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Remove ChildContext for now, which is not used anymore Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Bump the version to 0.0.8 Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Fix bazel build for the fork's crate Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Fix clippy erros in bytestring.rs Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Update dependencies Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Fix Cargo.toml Signed-off-by: Takaya Saeki <takaya@tetrate.io> * outdated should check only root deps Signed-off-by: Takaya Saeki <takaya@tetrate.io> * Fix inconsistent derived traits Signed-off-by: Takaya Saeki <takaya@tetrate.io> Co-authored-by: Piotr Sikora <piotrsikora@google.com> Co-authored-by: Daz Wilkin <DazWilkin@users.noreply.github.com> Co-authored-by: Greg Brail <gbrail@users.noreply.github.com> Co-authored-by: Yaroslav Skopets <y.skopets@gmail.com> Co-authored-by: Yuval Kohavi <yuval.kohavi@gmail.com> Co-authored-by: SvetlinZarev-SAP <43135961+SvetlinZarev-SAP@users.noreply.github.com> Co-authored-by: Daniel Grimm <dgrimm@redhat.com>
Signed-off-by: Kit Chan <kichan@apache.org>
To fix #6
Without this, it's impossible (or just incredibly hard, I tried for hours) to read filter config from within an
HttpContext
orStreamContext
. It requires users to always supply aRootContext
, which adds a bit of boilerplate, but IMO is a reasonable way to connectRootContext
with its children in Rust, as there's no easy way to manage global state.I'm still very new to Rust so this might be the wrong way to do it. Let's discuss.