-
Notifications
You must be signed in to change notification settings - Fork 5
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
Initial support 1.5.8 #40
Conversation
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
@PLeVasseur Would you mind taking a look? |
Hi @evshary -- I'm on vacation starting tomorrow till next Monday. I'll see if I can sneak a review of this in. :) |
Hi @PLeVasseur It's fine to be reviewed next week. Enjoy your vacation! |
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
@@ -31,6 +29,15 @@ use zenoh::{ | |||
subscriber::Subscriber, | |||
}; | |||
|
|||
// CY_TODO: Whether to expose from up_rust or not |
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.
Very good question. IMHO it makes sense for these to live in up-rust
.
@@ -277,97 +208,111 @@ impl UPClientZenoh { | |||
}; | |||
Ok(uattributes) | |||
} | |||
|
|||
/* The table for mapping resource ID to message type |
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 this table doesn't exist in up-spec it'd be great to have you contribute to adding it there!
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.
So is the table clear to you? The reason why I hesitate to add the table into spec is that I'm afraid it makes readers difficult to understand.
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.
Yeah, I get it. I spent a few minutes just mentally going over the table to see if it aligned with my understanding.
I think, even if it takes some time for someone to process what's in the table, it makes a lot more sense to have it written up in a place like up-spec that can be referenced for any implementation 🙂
self.register_request_listener(&topic, listener.clone()) | ||
let flag = UPClientZenoh::get_listener_message_type(source_filter, sink_filter)?; | ||
// Publish & Notification | ||
if flag.contains(MessageFlag::Publish) || flag.contains(MessageFlag::Notification) { |
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.
So I think based on how I am reading this, the intention looks to be that the source and sink filters may result in more than one bit being set in the bitmask enum. That seems to be the intent. And that makes sense.
I'm having a hard time seeing how the function get_listener_message_type() can set multiple bits. It looks like a single value is set based on the if conditionals and returned. Hmm. Perhaps I need to read more 🤔
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.
You're right... I made the silly mistakes.
I updated how get_listener_message_type
works and added more tests case to avoid the mistakes in the future.
#[test_case(test_lib::create_utransport_uuri(Some(0), 0, 0); "Publish / Notification register_listener")] | ||
#[test_case(test_lib::create_rpcserver_uuri(Some(0), 0); "RPC register_listener")] | ||
#[test_case(test_lib::create_special_uuri(0); "Special UUri register_listener")] | ||
#[test_case(&test_lib::new_uuri("src", 1, 1, 0x8000), None; "Listen to Publish")] |
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.
Is there a way to listen to all point to point messages? I see ability to listen to all messages of a given type. What about being able to express "all messages with a sink whose source authority_name is foo"?
That's one of the streamer use cases for connecting two authorities together over two transports.
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.
Just checked the uP-L1 Zenoh spec. Looks like this case may have been missed. Can we update the spec to clarify this is also possible and add this capability to the transport? (If I am reading it correctly it looks like registering to get all point to point messages as it was in 1.5.7 is not possible in the current implementation. Very possible I'm wrong and if so please point it out 😅)
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.
Is this what you expect? I added the uStreamer test cases in the tests now.
ea3a993#diff-c19a9c920bb76a5ab06a7d28f16df025d34c3a66697465b9e92c9df37ecdc0a3R36
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 think this is pretty close, left a comment on that test.
* - Response: {(0-8000), 0}, {(0-8000), FFFF}, (FFFF, 0), {FFFF, FFFF} | ||
*/ | ||
#[allow(clippy::nonminimal_bool)] // Don't simplify the boolean expression for better understanding | ||
fn get_listener_message_type( |
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.
IMHO something very similar could be useful in up-rust with modifications to support the uStreamer case of all point to point messages from a certain authority.
Signed-off-by: ChenYing Kuo <evshary@gmail.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.
I think you may need to modify or make a new test so that we can test the uStreamer use-case of all of Notification, Request, and Response.
I think it'd be good to update the name to |
As I start to work with the Zenoh transport, I think it would be good if from this crate we re-exported some key Zenoh items such that an end-user of up-transport-zenoh-rust doesn't also need to pull in Zenoh as a dependency and can use the stuff required from there. I'm thinking specifically at the moment about Zenoh's Config, as it would appear in order to configure the Zenoh transport I do need to pass in a |
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
Signed-off-by: ChenYing Kuo <evshary@gmail.com>
I found something wrong with Response use case. In the previous implementation, calling I fixed the issue with the help of the intersection in Zenoh key. Now @PLeVasseur Let me know if the test case is not what you imagine. |
entity: Some(uentity).into(), | ||
..Default::default() | ||
}; | ||
pub async fn new(config: Config, authority_name: String) -> Result<UPClientZenoh, UStatus> { |
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.
Hey @evshary -- for the uStreamer use-case we'll need a function to build a UPClientZenoh object from a Zenoh Runtime in order to fit within the topology with up-linux-streamer as a Zenoh plugin.
I'm okay if you want to merge this one and address that in a follow up. 👍
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.
OK. Don't make the PR to lengthy. I'll create an issue to track.
@@ -21,8 +21,9 @@ use std::{ | |||
}; | |||
use tokio::runtime::Runtime; | |||
use up_rust::{ComparableListener, UAttributes, UCode, UListener, UPriority, UStatus, UUri}; | |||
// Re-export Zenoh config | |||
pub use zenoh::config::Config; |
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.
Is this enough to configure a Config completely? Or should we re-export all of zenoh::config::*?
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.
It seems like there will be some conflicts if expose all config. I'll deal with it later.
The PR is to support up-spec 1.5.8
Close #39