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

ObserveComposite for timestamped data support on server side #1552

Conversation

JaroslawLegierski
Copy link
Contributor

ObserveComposite for timestamped data suport on server side - described in issue #1089.

@sbernard31
Copy link
Contributor

sbernard31 commented Nov 30, 2023

Just to be sure, is it still a draft or should I review it ?

(Rereading myself, I realize that this could be taken the wrong way 😬 , this wasn't aggressive it was just to now if I should take time to review it now OR if this is too soon 😅 )

@JaroslawLegierski
Copy link
Contributor Author

Just to be sure, is it still a draft or should I review it ?

(Rereading myself, I realize that this could be taken the wrong way 😬 , this wasn't aggressive it was just to now if I should take time to review it now OR if this is too soon 😅 )

No Problem 😉 I created it initially as a PoC, however I think it's a good idea to turn it into PR and explain some not clear topics in dedicated issues such as #1554 or during review.

@JaroslawLegierski JaroslawLegierski force-pushed the opl/observe_composite_timestamped_data_support_for_server branch 2 times, most recently from aa5031c to 45ec941 Compare December 12, 2023 08:07
@sbernard31
Copy link
Contributor

@JaroslawLegierski I added some commit about tests.

Second test fails and following #1089 (comment), I think it should pass. Do you agree ?

@JaroslawLegierski
Copy link
Contributor Author

JaroslawLegierski commented Dec 14, 2023

@JaroslawLegierski I added some commit about tests.

Second test fails and following #1089 (comment), I think it should pass. Do you agree ?

As I understand the timestampednodes.getNodes() method should be changed because currently:

"In case of the same path conflict the most recent one is taken. Null timestamp is considered as most recent one."
.... so we should filter out null values ?

Passing assertThat(response.getTimestampedLwM2mNodes()).isEqualTo(timestampednodes); requires encoder modification:

encoder_cannot_encode_null_values

because I don't see value=null in COAP packets , that's right ?

@sbernard31
Copy link
Contributor

Not really.

As explain at #1089 (comment)
if you observe /1/0/1 and /3/0/15 then you should get both resources for each timestamp and no more than that.
I tried to put the null case as example but maybe that was not a so good idea.
Here is more examples, maybe this will be clearer :

// valid  
t1 => { 
    "/1/0/1"     => LwM2mResource
    "/3/0/15"     => LwM2mResource
},
// valid
t2 => { 
    "/1/0/1"     => LwM2mResource
    "/3/0/15"     => null  // case where resource has no value, a single notif answer maybe with NOT_FOUND
},
// invalid  : 3/0/15 is missing
t3 => { 
    "/1/0/1"     => LwM2mResource  
},
// invalid : 3/0/1 should not be here
t4 => { 
    "/1/0/1"     => LwM2mResource
    "/3/0/1"     => LwM2mResource
    "/3/0/15"     => LwM2mResource
}

Passing assertThat(response.getTimestampedLwM2mNodes()).isEqualTo(timestampednodes); requires encoder modification:

Nope, the issue is not at encoder level because you can not encode null value in SenML.

The issue is at decoder level, you change the Decoder API to add list of path which is good. But you don't use it.
In my opinion, it should be used to create the right timestampNodes structure.
The list of path must be used ensure that for each timestamp with have a value for each path and only for this path.
(Maybe TimestampedLwM2mNodes.Builder should be adapted to take optionally a list of Path which will be used to be sure the built structure will be correct)

@JaroslawLegierski
Copy link
Contributor Author

The list of path must be used ensure that for each timestamp with have a value for each path and only for this path.
(Maybe TimestampedLwM2mNodes.Builder should be adapted to take optionally a list of Path which will be used to be sure the built structure will be correct)

Ok - I understand thanks for the clarification. Do you have in mind something like this ?

@sbernard31
Copy link
Contributor

Yep something like this. (but maybe better to add a new constructor with List<LwM2mPath> paths argument instead of a setter like setPaths?

@JaroslawLegierski
Copy link
Contributor Author

Yep something like this. (but maybe better to add a new constructor with List<LwM2mPath> paths argument instead of a setter like setPaths?

OK - I added new constructor in this commit.

@sbernard31 sbernard31 force-pushed the opl/observe_composite_timestamped_data_support_for_server branch from a4c064f to 9f74749 Compare January 9, 2024 14:45
@sbernard31
Copy link
Contributor

sbernard31 commented Jan 9, 2024

(I rebased this on master)

@sbernard31
Copy link
Contributor

I pushed some more modification. I think this is in reviewable stable.
@JaroslawLegierski Let me know if this sounds good to you, then I integrate this in master in squashed in 1 commit.

(Last thing missing, I plan to change ObserveCompositeResponse argument order to be more consistent with other Response but I think this is maybe better to do it after this PR)

@JaroslawLegierski
Copy link
Contributor Author

I pushed some more modification. I think this is in reviewable stable.
@JaroslawLegierski Let me know if this sounds good to you, then I integrate this in master in squashed in 1 commit.

I tested this today and it looks OK. I think that it can be integrated into the master.

@sbernard31
Copy link
Contributor

Ok I will re-read the code one more time. Re-organize commit then integrate it in master.

@sbernard31 sbernard31 force-pushed the opl/observe_composite_timestamped_data_support_for_server branch from e2a3a4b to 666c014 Compare January 15, 2024 16:01
@sbernard31
Copy link
Contributor

sbernard31 commented Jan 15, 2024

I found some cosmetic little issue but also some more real issue.

I think it's good to integrate master now.

@sbernard31
Copy link
Contributor

This is now integrated in master (squashed commit b303aa4)

@sbernard31 sbernard31 closed this Jan 15, 2024
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.

None yet

2 participants