-
Notifications
You must be signed in to change notification settings - Fork 1
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
Align Terminology of VSS model classes / public API #94
Conversation
VssProperty -> VssNode close eclipse-kuksa#70
The VssNode interface is already a good name for the defined VssSpecification properties.
The VssSpecification (renamed to VssNode) now also has additional properties defined. The property type was not checked before when generating the vss node attributes like the UUID. This resulted into a duplicated generation of the "child" + "parent" properties.
The Definition wording is kinda redundant with what VSS means (Specification). So the annotation name was changed to something it is actually responsible for: Triggering the generation of Models.
# Conflicts: # vss-core/src/main/java/org/eclipse/kuksa/vsscore/annotation/VssDefinition.kt # vss-core/src/main/java/org/eclipse/kuksa/vsscore/model/VssSpecification.kt # vss-core/src/main/kotlin/org/eclipse/kuksa/vsscore/annotation/VssDefinition.kt # vss-core/src/main/kotlin/org/eclipse/kuksa/vsscore/annotation/VssModelGenerator.kt # vss-core/src/main/kotlin/org/eclipse/kuksa/vsscore/model/VssNode.kt # vss-core/src/main/kotlin/org/eclipse/kuksa/vsscore/model/VssSpecification.kt # vss-core/src/test/java/org/eclipse/kuksa/vsscore/model/VssSpecificationTest.kt # vss-core/src/test/kotlin/org/eclipse/kuksa/vsscore/model/VssNodeTest.kt # vss-core/src/test/kotlin/org/eclipse/kuksa/vsscore/model/VssSpecificationTest.kt
The "Property" name was not a good reflection of the combination of the variables vssPath + Field (grpc). This model is not replaced with explicit *Request classes. BREAKING CHANGE: The API for fetch / subscribe / update did change. The input for these methods are now wrapped via "DataBrokerRequest" classes e.g. "FetchRequest", "UpdateRequest". For generated VSS models the classes "VssNodeFetchRequest" etc. should be used. - The Property model was removed in favor of DataBrokerRequest
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.
Short functional test was Ok
kuksa-sdk/src/main/kotlin/org/eclipse/kuksa/connectivity/databroker/DataBrokerConnection.kt
Outdated
Show resolved
Hide resolved
...sdk/src/main/kotlin/org/eclipse/kuksa/connectivity/databroker/request/VssNodeFetchRequest.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/org/eclipse/kuksa/connectivity/databroker/request/VssNodeSubscribeRequest.kt
Outdated
Show resolved
Hide resolved
...dk/src/main/kotlin/org/eclipse/kuksa/connectivity/databroker/request/VssNodeUpdateRequest.kt
Outdated
Show resolved
Hide resolved
kuksa-sdk/src/main/kotlin/org/eclipse/kuksa/connectivity/databroker/listener/VssPathListener.kt
Outdated
Show resolved
Hide resolved
vss-processor-plugin/src/main/java/org/eclipse/kuksa/vssprocessor/plugin/VssProcessorPlugin.kt
Outdated
Show resolved
Hide resolved
@SebastianSchildt and @eriksven Maybe you can also have a short look at this - not from a technical perspective but from the perspective of a user who knows VSS and wants to use our SDK :D You don't need to take a closer look at the source code only however the samples in the samples project resp. in the quickstart.md can give an understanding on how it is now looking. |
The VSS related changes seems sensible to me. I remember, I stumbled a bit when in existing code I saw something that seemed to listen to "onSpecificationChanged" or something. That I assume looks "nicer" now. As I am not fluent at all with the API I cannot really give an in-depth comment, but just from "reading" the examples in Quickstart, I like the new style better. From "VSS" perspective, no ideas how Kotlin evangelist feel about it. I would assume, when this is merged, we do a new Maven release, and the also adapt the companion? |
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.
Minor smallish findings. Functionality-wise still looks good.
...rc/main/kotlin/org/eclipse/kuksa/connectivity/databroker/subscription/VssNodePathListener.kt
Outdated
Show resolved
Hide resolved
kuksa-sdk/src/main/kotlin/org/eclipse/kuksa/extension/vss/VssLeafBooleanExtension.kt
Outdated
Show resolved
Hide resolved
To stick more to the VSS terminology the VssLeaf was renamed to VssSignal. In addition a VssBranch interface was introduced to clearly separate them from VssSignals.
@@ -68,8 +68,8 @@ void connectInsecure(String host, int port) { | |||
```kotlin | |||
fun fetch() { | |||
lifecycleScope.launch { | |||
val property = Property("Vehicle.Speed", listOf(Field.FIELD_VALUE)) | |||
val response = dataBrokerConnection?.fetch(property) ?: return@launch | |||
val request = FetchRequest("Vehicle.Speed", Field.FIELD_VALUE) |
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.
Could we call this GetRequest as in the gRPC kuksa.val.v1 interface exposed by the databroker? (https://github.com/eclipse/kuksa.val/blob/master/proto/kuksa/val/v1/val.proto).
In the same way, I would prefer get() instead of fetch().
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 @eriksven! No strong opinion here. This was also something I thought about but decided against. We definitely want to align with the VSS terminology but not necessarily with the Kuksa gRPC one because the definition there may not fit with every other environment (Android in this case) like you already mentioned in your comment. :)
It basically just comes down to the consistent semantic we decided in the Android API here.
- GET (and SET) implies a really simple logic -> no overhead when retrieving or setting the information
- FETCH implies a more complex process like some other object will take care of the Request for you and asynchronously returns the data at some point.
That the "Request" + "Subscribe" naming fits with the gRPC one is basically just a coincidence.^^
I hope I made the reasoning a bit understandable.
@@ -78,20 +78,20 @@ fun fetch() { | |||
|
|||
fun update() { | |||
lifecycleScope.launch { | |||
val property = Property("Vehicle.Speed", listOf(Field.FIELD_VALUE)) | |||
val request = UpdateRequest("Vehicle.Speed", Field.FIELD_VALUE) |
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.
Maybe use SetRequest and Set() to align with Kuksa.val.v1 API.
Thanks for the PR and the changes which bring this closer to the terminology used within VSS. I also like to use Signal and Branch instead of Leaf. I added two comments to get closer to terminology of the gRPC interface exposed by the KUKSA databroker which has get() and set(). But I am unsure whether this makes sense in Android/Kotlin terminology. Sorry, for the delayed reaction on my side. |
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
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.
Some Tests in VssNodeTest and VssNodeCopyTest seem to fail reliably leading to the failed build.
The filter was wrongly added to the method.
fixed |
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
close #70
Renaming:
VssDefinition (Annotation) -> VssModelGenerator
VssNode (Any node with vss childs / parents) -> VssNode
VssSpecification (Any node + vss information) -> Removed / merged with VssNode
VssProperty (Leaf) -> VssLeaf
VssSpecificationListener -> VssNodeListener
PropertyListener -> VssPathListener
SpecificationPropertyListener -> VssNodePathListener
Property -> Removed / Replaced with:
Checked:
Tested:
It is easy to miss naming like "property" etc. in the documentation / guides and so on. So please have a good look also.
BREAKING CHANGE: The API for fetch / subscribe / update did change.
The input for these methods are now wrapped via "DataBrokerRequest"
classes e.g. "FetchRequest", "UpdateRequest". For generated VSS models
the classes "VssNodeFetchRequest" etc. should be used.