-
Notifications
You must be signed in to change notification settings - Fork 18
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
Min/Max Support #79
Min/Max Support #79
Conversation
35c0f83
to
0ec662b
Compare
d1ef401
to
87d1da9
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/databroker-api-v2 #79 +/- ##
=============================================================
+ Coverage 55.33% 58.84% +3.51%
=============================================================
Files 33 33
Lines 14677 15531 +854
=============================================================
+ Hits 8121 9139 +1018
+ Misses 6556 6392 -164 ☔ View full report in Codecov by Sentry. |
87d1da9
to
77d6c11
Compare
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.
should we add some tests?
Some tests coming soon. |
42485a3
to
8565290
Compare
I have now added some test cases, but they do not cover all possible VSS/Databroker Datatypes. We have quite much duplication in code (and tests) due to the strong type checks in Rust, so not that easy to reuse. I think the level of tests are quite reasonable now. |
af8dbb8
to
8328868
Compare
2aecd5c
to
7b47ed9
Compare
8328868
to
671fc59
Compare
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.
Looks good to me, apart from some general comments like why DataValue
does not implement Int8
and Uint8
, are we upcasting values to int32/64
and uint32/64
?
Also looks good unit test coverage for kuksa.val.v2
Thanks Erik :)
Ok(f64::from(*value) < *other_value) | ||
} | ||
pub fn greater_than_equal(&self, other: &DataValue) -> Result<bool, CastError> { | ||
match self.greater_than(other) { |
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.
Just saw that greater_than
function:
kuksa-databroker/databroker/src/types.rs
Line 85 in 671fc59
(DataValue::Int32(value), DataValue::Int32(other_value)) => Ok(value > other_value), |
DataType
kuksa-databroker/databroker/src/types.rs
Line 20 in 671fc59
Int8, |
Even DataValue
does not support all of them:
kuksa-databroker/databroker/src/types.rs
Line 59 in 671fc59
pub enum DataValue { |
What is the reason for that? Is that on purpose?
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.
That is better a question for @argerus. I have some theories - one is that we do not "save" that much memory by using u32 instead of u16/u8 and i32 instead of i8/i16, another is that it simplifies implementation as we do not need to handle that many combinations.
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.
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.
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.
there's no int8 in proto3
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.
That is better a question for @argerus. I have some theories - one is that we do not "save" that much memory by using u32 instead of u16/u8 and i32 instead of i8/i16, another is that it simplifies implementation as we do not need to handle that many combinations.
Exactly. It reduces the combinatorial explosion in the implementation and doesn't really cost anything memory wise since they are all part of the same enum
anyway. Using 32 & 64 bit integers might even be marginally more efficient cpu wise (probably doesn't matter much). And as @lukasmittag mentions, it would need to be converted anyway when using protobuf.
The VSS data type is enforced when setting a value, and is not encoded by the value enum itself. This simplifies setting a value to NotAvailable
as well.
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.
Got it, thanks
671fc59
to
77519df
Compare
Move most to broker.rs Add one checking proto results
50f2ba6
into
eclipse-kuksa:feature/databroker-api-v2
This PR adds the following functionality
min <= value <= max
)Some tests have been performed using a custom VSS JSON file.