|
Ran
|
Jobs
3
|
Files
659
|
Run time
35s
|
Badge
README BADGES
|
push
github
Changing the network model (#924) ## Problem Agama's network model is heavily inspired by [nmstate](https://github.com/nmstate/nmstate/blob/c9fd1e80d/rust/src/lib/ifaces/ethernet.rs#L64). Connections are represented [by an enum](https://github.com/openSUSE/agama/blob/<a class=hub.com/jcronenberg/agama/commit/<a class="double-link" href="https://git"><a class=hub.com/jcronenberg/agama/commit/2bc452b39e4460122ab52c5a72ee0d1dfe154cec">2bc452b39/rust/agama-dbus-server/src/network/model.rs#L220) and each variant contains a struct which depends on the type (e.g., the [WirelessConnection](https://github.com/openSUSE/agama/blob/2bc452b39e4460122ab52c5a72ee0d1dfe154cec/rust/agama-dbus-server/src/network/model.rs#L542) struct). Those structs have a `base` field that points to a [BaseConnection struct](https://github.com/openSUSE/agama/blob/master/rust/agama-dbus-server/src/network/model.rs#L328) which holds the common fields for all connection types. And that's perfectly fine. However, we decided to introduce some methods to hide the fact that the common information lives in a separate `struct`. We could say it is for encapsulation reasons, but I don't know whether it is a good idea. Even we created some *getters* and *setters* for those fields, adding quite some [boilerplate](https://github.com/openSUSE/agama/blob/master/rust/agama-dbus-server/src/network/model.rs#L264-L299) [code](https://github.com/openSUSE/agama/blob/master/rust/agama-dbus-server/src/network/model.rs#L318-L324) Additionally, until we introduced the `ConnectionBuilder` (in #885), creating a new connection with some custom data (like an id and a UUID) was not straightforward because you needed to make the `BaseConnection` first (see [this example](https://github.com/openSUSE/agama/blob/2bc452b39e4460122ab52c5a72ee0d1dfe154cec/rust/agama-dbus-server/src/network/model.rs#L136-L141). ## Proposal Although I am not 100% sure whether it is a better idea, I am exploring the possibility of using a simpler layout to represent a connection. In this case, we would use a ... (continued)
1413 of 2163 branches covered (0.0%)
Branch coverage included in aggregate %.
100 of 130 new or added lines in 9 files covered. (76.92%)
142 existing lines in 6 files now uncovered.16004 of 21132 relevant lines covered (75.73%)
21.21 hits per line
| ID | Job ID | Ran | Files | Coverage | |
|---|---|---|---|---|---|
| 1 | web - 7247180758.1 | 0 |
73.86 |
GitHub Action Run | |
| 1 | service - 7247180737.1 | 0 |
84.88 |
GitHub Action Run | |
| 1 | rust - 7222306500.1 | 0 |
41.17 |
GitHub Action Run |