Skip to content
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

WIP: run against dbus-broker bench #23

Closed
wants to merge 7 commits into from

Conversation

elmarco
Copy link
Contributor

@elmarco elmarco commented Jun 26, 2023

This series allows to run busd against dbus-broker benchmark, with:

DBUS_BROKER_TEST_DAEMON=path-to-busd/target/debug/busd dbus-broker/build/test/dbus/bench-connect

The most important change is the introduction of <busconfig> parsing, and then handling of a few command line options.

The test currently hangs after what looks like an initial successful connection. Further investigation needed.

/!\ This branch needs dbus2/zbus#390

@elmarco elmarco changed the title dbus-broker bench WIP: run against dbus-broker bench Jun 26, 2023
@zeenix
Copy link
Collaborator

zeenix commented Jun 27, 2023

@elmarco the config changes are super desirable even w/o dbus-broker tests in mind. Do you think you can clean this up soon?

@zeenix
Copy link
Collaborator

zeenix commented Jun 29, 2023

@elmarco I rebased this branch on latest git main and put it here. I didn't push it to your branch because I had to remove the unmerged zbus API for it to build.

src/bin/busd.rs Outdated
Comment on lines 81 to 89
let address = config
.elements
.iter()
.rev()
.find_map(|e| match e {
config::Element::Listen(l) => Some(l),
_ => None,
})
.unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think BusConfig should provide specific API for each element so user doesn't have to deal with generic elements. It's exposing the detail that config is xml-based IMO.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also bus module should be handling all this work. The main should remain as thin as possible.

elmarco added 7 commits July 4, 2023 15:50
The bus config parsing requires XML.
The tests are from dbus reference implementation. The schema/dtd is a
based on a mix of what is accepted by dbus and dbus-broker.

Some tests are left with FIXME, as they may not fit in the config parser
itself, but rather in the runtime handling of options.

dbus has extra tests which may require installation to run (*.conf.in).
As we need require=false on the following patch.
Atm, we simply handle the last <listen> address!
@jokeyrhyme
Copy link
Contributor

@elmarco howdie, I mucked about today and came up with a slightly different take on the XML configuration file work over in #146

There may or may not be something you like over there, but it's completely up to you :)

@elmarco
Copy link
Contributor Author

elmarco commented Oct 15, 2024

@jokeyrhyme I have lost interest to help with this, I do not understand @zeenix project management.

@elmarco elmarco closed this Oct 15, 2024
@jokeyrhyme
Copy link
Contributor

Oh, no worries, I can pick this up, hopefully this weekend 🤞

@jokeyrhyme jokeyrhyme mentioned this pull request Oct 27, 2024
41 tasks
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Nov 9, 2024
The list of elements idea was inspired by work performed by @elmarco over in dbus2#23 , which brings a lot of benefits that I was trying to provide using explicit low-level readers and writers of XML events: namely that we have access to element sequence (important for "last `<type>` wins" and the correct interpolation of `<include>`). serde offers a [try_from](https://serde.rs/container-attrs.html#try_from) attribute that allows us to abstract this away from the consumer.
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Nov 17, 2024
Implemented by iterating over the `Vec<Element>`, inspired by work by @elmarco , although this version doesn't have all the same features and validations as dbus2#23
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Nov 17, 2024
A little less efficient than @elmarco 's implementation over in dbus2#23
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Nov 19, 2024
The list of elements idea was inspired by work performed by @elmarco over in dbus2#23 , which brings a lot of benefits that I was trying to provide using explicit low-level readers and writers of XML events: namely that we have access to element sequence (important for "last `<type>` wins" and the correct interpolation of `<include>`). serde offers a [try_from](https://serde.rs/container-attrs.html#try_from) attribute that allows us to abstract this away from the consumer.
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Nov 19, 2024
Implemented by iterating over the `Vec<Element>`, inspired by work by @elmarco , although this version doesn't have all the same features and validations as dbus2#23
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Nov 19, 2024
A little less efficient than @elmarco 's implementation over in dbus2#23
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Nov 19, 2024
The list of elements idea was inspired by work performed by @elmarco over in dbus2#23 , which brings a lot of benefits that I was trying to provide using explicit low-level readers and writers of XML events: namely that we have access to element sequence (important for "last `<type>` wins" and the correct interpolation of `<include>`). serde offers a [try_from](https://serde.rs/container-attrs.html#try_from) attribute that allows us to abstract this away from the consumer.
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Nov 19, 2024
Implemented by iterating over the `Vec<Element>`, inspired by work by @elmarco , although this version doesn't have all the same features and validations as dbus2#23
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Nov 19, 2024
A little less efficient than @elmarco 's implementation over in dbus2#23
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Nov 27, 2024
The list of elements idea was inspired by work performed by @elmarco over in dbus2#23 , which brings a lot of benefits that I was trying to provide using explicit low-level readers and writers of XML events: namely that we have access to element sequence (important for "last `<type>` wins" and the correct interpolation of `<include>`). serde offers a [try_from](https://serde.rs/container-attrs.html#try_from) attribute that allows us to abstract this away from the consumer.
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Nov 27, 2024
Implemented by iterating over the `Vec<Element>`, inspired by work by @elmarco , although this version doesn't have all the same features and validations as dbus2#23
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Nov 27, 2024
A little less efficient than @elmarco 's implementation over in dbus2#23
zeenix pushed a commit to jokeyrhyme/busd that referenced this pull request Nov 27, 2024
The list of elements idea was inspired by work performed by @elmarco over in dbus2#23 , which brings a lot of benefits that I was trying to provide using explicit low-level readers and writers of XML events: namely that we have access to element sequence (important for "last `<type>` wins" and the correct interpolation of `<include>`). serde offers a [try_from](https://serde.rs/container-attrs.html#try_from) attribute that allows us to abstract this away from the consumer.
zeenix pushed a commit to jokeyrhyme/busd that referenced this pull request Nov 27, 2024
Implemented by iterating over the `Vec<Element>`, inspired by work by @elmarco , although this version doesn't have all the same features and validations as dbus2#23
zeenix pushed a commit to jokeyrhyme/busd that referenced this pull request Nov 27, 2024
A little less efficient than @elmarco 's implementation over in dbus2#23
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Nov 30, 2024
This is inspired by @elmarco 's work over in dbus2#23

Importantly, by starting with this intermediate representation,
we can preserve the intended order of elements
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Dec 7, 2024
This is inspired by @elmarco 's work over in dbus2#23

Importantly, by starting with this intermediate representation,
we can preserve the intended order of elements
jokeyrhyme added a commit to jokeyrhyme/busd that referenced this pull request Dec 9, 2024
We can deserialize an XML file using the "serde" and "quick-xml" crates.
Creating a struct type with nested structs within is a direct
approach that works well with `#[derive(Deserialize)]`. However, the
result isn't optimal for consumption, and also makes it very difficult
to implement aspects of the business logic that are sensitive to the
order of certain XML elements, e.g. `<bus>`, `<include>`, etc.

So our approach is to first deserialize into a `Vec<Element>` (inspired
by @elmarco 's work over in dbus2#23 ). Importantly, by starting with this
intermediate representation, we can preserve the XML author's intention
regarding the order of elements.

Then we replace any `<include>` and `<includedir>` elements with the
parsed contents the XML files to which they refer, further replacing any
`<include>` and `<includedir>` elements within those.

Finally, we can make one final iteration over the `Vec<Element>` to
produce the final optimally-structured `Config`.

Fixes dbus2#78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants