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

Align Terminology of VSS model classes / public API #94

Merged
merged 23 commits into from
Mar 14, 2024

Conversation

Chrylo
Copy link
Contributor

@Chrylo Chrylo commented Mar 6, 2024

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:

interface DataBrokerRequest {
    vssPath: String
    fields: Collection<Field>
}
FetchRequest : DatabrokerRequest
SubscribeRequest : DatabrokerRequest
UpdateRequest : DatabrokerRequest {
    dataPoint: DataPoint
}
VssNodeDataBrokerRequest : DataBrokerRequest<T : Node> {
    vssNode: T
}
VssNodeFetchRequest : VssNodeDataBrokerRequest
VssNodeUpdateRequest : VssNodeDataBrokerRequest 
VssNodeSubscribeRequest : VssNodeDataBrokerRequest

Checked:

  • Tests
  • Diagrams (puml)
  • Main code
  • Guides
  • Kdoc

Tested:

  • Get / Set / Subscribe via Vss paths + generated Models (Tested model Vehicle.Speed)

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.

  • The Property model was removed in favor of DataBrokerRequest

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
Copy link
Contributor

@wba2hi wba2hi left a 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

@wba2hi
Copy link
Contributor

wba2hi commented Mar 7, 2024

@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.

@SebastianSchildt
Copy link
Contributor

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?

Copy link
Contributor

@wba2hi wba2hi left a 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.

docs/QUICKSTART.md Outdated Show resolved Hide resolved
docs/QUICKSTART.md Show resolved Hide resolved
docs/QUICKSTART.md Outdated Show resolved Hide resolved
docs/QUICKSTART.md Outdated Show resolved Hide resolved
docs/QUICKSTART.md Outdated Show resolved Hide resolved
docs/QUICKSTART.md Outdated Show resolved Hide resolved
docs/QUICKSTART.md 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)
Copy link

@eriksven eriksven Mar 13, 2024

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().

Copy link
Contributor Author

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.

  1. GET (and SET) implies a really simple logic -> no overhead when retrieving or setting the information
  2. 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)

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.

@eriksven
Copy link

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.

Copy link
Contributor

@wba2hi wba2hi left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@wba2hi wba2hi left a 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.
@Chrylo
Copy link
Contributor Author

Chrylo commented Mar 14, 2024

Some Tests in VssNodeTest and VssNodeCopyTest seem to fail reliably leading to the failed build.

fixed

Copy link
Contributor

@wba2hi wba2hi left a comment

Choose a reason for hiding this comment

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

LGTM

@wba2hi wba2hi merged commit af19daf into eclipse-kuksa:main Mar 14, 2024
5 checks passed
@wba2hi wba2hi deleted the task-70 branch March 14, 2024 14:41
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.

Align Terminology of Model Classes / Public API
4 participants