-
Notifications
You must be signed in to change notification settings - Fork 251
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: trigger crate #418
feat: trigger crate #418
Conversation
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
- Add ComponentMap::get_by_id to support simplified Router impl - Refactor Router to build from ComponentMap & return component IDs
Better match Rust naming conventions. Also, use this function in spin_testing.
Since it no longer "looks like" it has CoreComponent keys, replace it with a type alias to a HashMap.
@Mossaka: Reviewing this PR inspired me to make a bunch of changes I've been thinking of doing anyway, one benefit of which being that I was able to simplify some of the new trigger crate code. Take a look: https://github.com/fermyon/spin/pull/418/files/2eaa0c48c09a2f16a4211a169dd047bc2fefc7c1..4b54f9cc1883f3b1e2bff0b2c438a1ad26f1b667 |
@lann I really like your approach that removes the dependency on |
I will have an update to resolve the conflicts |
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.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.
LGTM - delighted to see this
crates/http/src/lib.rs
Outdated
.ok_or_else(|| anyhow!("Expected HTTP configuration for component {}", id)) | ||
})?; | ||
#[derive(Clone)] | ||
pub struct HttpRuntimeConfig { |
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: Anything but just "Runtime"......maybe HttpTriggerRuntimeConfig? ......pretty please
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.
OR HttpTriggerConfig?
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.
Whatya think?
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.
there are just too many configs...
HttpTriggerConfiguration
HttpConfig
- and this
HttpRuntimeConfig
How about HttpRuntimeConfig
-> HttpTriggerExecutionConfig
?
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 might be one for a subsequent blitz on naming - I don't even know the difference between the first two let along the new one - we should do a pass for figure out their different responsibilities and give them clearly distinct names that clearly express those differences, but this PR might not be the place for that, not sure.
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.
Agreed. My understanding is that
- The first one is for top level trigger struct
"trigger = { type = "http", base = "/" }
- The second one is for component trigger struct
[component.trigger]
route = "/hello"
- The third one is for CLI aguments: http has
--listen address
,--log-dir
and--tls-cert/key
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 agree that we shouldn't try to name everything perfectly in this PR. The names were already pretty confusing.
Signed-off-by: Jiaxiao Zhou <jiazho@microsoft.com>
I had a commit 3822f58 that changes some struct's names mostly |
I am going to resolve conflicts and merge shortly. |
Built on top of the draft PR #415 and discussed in issue #402
Notable difference: added a type
TriggerExtra
that encapsulateRouter
forHttpTrigger
orsubscriptions
forRedisTrigger
@lann @radu-matei