-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Add addr
module
#430
Add addr
module
#430
Conversation
bac8fe0
to
f6508dc
Compare
They will be used next in other modules.
Signed-off-by: Marc-André Lureau <[email protected]>
There is not much you can do with it anymore.
CI is still broken Anyhow, removing the draft status of this PR. |
That's fallout from your changes. I pushed revert of your commits and that seem to help. Can you try rebasing on latest |
The action thinks that everything in cached but in reality, it's not and hence the missing pkg-config error. |
|
||
/// A bus address. | ||
#[derive(Debug, PartialEq, Eq, Clone)] | ||
pub struct DBusAddr<'a> { |
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 add
DBus
prefix? It's part of zbus so it's clear what address we mean. - Commit log is very lacking in details. What's relationship with existing
Address
etc.
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 relationship, it's a rewrite from scratch.
I use DBus prefix, and Addr, for consistency with rust standard library. Everything address-related uses addr
consistently, and for types, has a prefix. IpAddr, SocketAddr etc. Address (or Addr) would be too common, and would likely conflict with other modules/crates and require a rename.
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 consistency with rust standard library
std lib's context is super generic. That is not the case for zbus.
Address (or Addr) would be too common, and would likely conflict with other modules/crates and require a rename.
As discussed before, the mod hierarchy in Rust makes this a complete non-issue. Users can either import only the parent (or its parent mod) or alias during import. They also can choose not to use imports at all and use the full path.
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.
sigh naming... I have a clear preference for DBusAddr, ToDBusAddr.. over Address, ToAddress. But if you insist, I'll just rename stuff.
@@ -0,0 +1,21 @@ | |||
#![cfg(target_os = "macos")] | |||
|
|||
use crate::{addr::DBusAddr, process::run, Error, Result}; |
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.
zb: add/rewrite raw stream connection
Again, a huge bunch of changes with no details in the commit log of what's going on.
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
@@ -26,7 +26,6 @@ use winapi::{ | |||
}, | |||
}; | |||
|
|||
use crate::Address; |
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 commit log says you're deprecating it but you're in fact dropping it.
- I see potential for further splitting the changes.
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.
Not dropping, you can still use the legacy Address to parse or manipulate Address. But you can't use it to connect anymore. I am fine with removing it now if you prefer.
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 am fine with removing it now if you prefer.
Yes that's also (what I thought) we decided. I do not believe this new DBusAddress
is a new API at all. We should just change Address
to fit our needs. This is not an API typical users use, especially directly.
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 am not sure what you mean by "changing Address to fit our needs".. As I see it, DBusAddr is very different.. there are no simple way to "change" the exisiting code, honestly.
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 addr could be a new zbus_addr crate. It's fairly standalone (only zbus::Error/Result is reused)
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.
Look, we already have a type to represent a dbus address: Address
. This is good and we should continue with that. Now that type has a few issues and you already have solution for solving that and we can totally break API here. i-e merge DBusAddress into Address.
Also addr could be a new zbus_addr crate.
Sure but we'll then not want the Address
API. The user only needs 1 (main) type here and that's what they should have.
Closing this in favor of #556. One big difference between this PR and #556 is that the latter doesn't make it possible to use |
You'd need to give me a few days if you want me to compare our approaches. From a quick glance, it seems you broke the API but didn't solve some of the pending issues, such as address list handling. I find it sad that your main argument to block my proposal was that we shouldn't break API (I really think it was necessary and weak, because addr API isn't really used outside), but then you just did that in your own way and find it more acceptable now, you should have worked with me from there... And the main argument to close my work is: How is that related to this branch? Also the split between address parsing handling and raw stream connection ("add/rewrite raw stream connection") is cleaner here. All in all, did you seriously look at this and compare it with the existing work and your work? |
I gave you several months to address the concerns with this PR and you told me that you won't have the time to address the concerns. So I had to do everything myself cause there was so much in your branch that I disagreed with and I don't like fixing others code. Now that I'm done after
As I told you before, we want to break the API. We're breaking API in multiple places already. As long as the typical user has an easy way to port their code, I'm happy.
It does make it a nice hierarchy, adds guid and makes it possible to add new properties in the future w/o breaking the API. That addresses #476 pretty well.
Pretty sure that can be added on top w/o breaking API. If not, we do a 5.0 at some point.
The main argument is that you didn't finish your work here, despite several months passing by and 4.0 is super late, as it is. So if I address #476 in a separate PR in my own way, this work becomes obsolete, at least for now.
Since it's very difficult to avoid allocations for strings that need % decoding, your branch is still doing that so the issue I describe in the commit log, is relevant. Having said that, looking again at your PR, I got some ideas on how I can avoid most allocations at least by decoding to buffers on the stack for some properties at least. However, I'll attempt that after merging my PR. I want to release tomorrow at latest cause Mon onward, I've to focus almost 100% on work-work. If I manage to finish before then, good. Otherwise, it'll have to wait for next API break. |
Not really. As I told you in my review here, I didn't agree with the overall approach of introducing a secondary address type/hierarchy (which I also said in IM before this PR) so I did at first look into addressing my concerns in this branch but quickly gave up, because I realized I need to start from scratch anyway. Anyway, if you felt strongly enough about your work getting merged, you had more than sufficient time and reminders to get it done in time. Now it's super late. I'm sorry but that's what will always happen if you don't finish the job. |
Address the following shortcomings of zbus <=3 Address implementation:
The new implementation doesn't use hashmap (only hashset for optional validation), and try to avoid unnecessary copies.
Fixes #476.