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

Quix legacy SERDES support for SDF #208

Merged
merged 7 commits into from
Oct 30, 2023

Conversation

tim-quix
Copy link
Contributor

Legacy Quix SerDes additions

Added/changed several things around serdes to accomodate parsing of Quix legacy (aka pre-header) formats (quixstreams <0.6.0) in a fully backwards-compatible manner.

Quix Deserialization

  • Deserialization now has one universal class, QuixDeserialzer
    • other Quix deserializer classes removed/consolidated
  • You can now handle multiple quix message types upon consume instead of just 1
    • Includes EventData, EventData[], andTimeSeries/ParameterData
    • Ignore list remains the same
    • If your app needs access to different messages in different formats, you will need to do some sort of conversion with SDF manually to properly convert them to the same data structure post-deserialization
  • Legacy formats of ParameterData, EventData, and EventData[] are now supported (<0.6.0) and fully backwards-compatible
    • "Split" messages remain NOT supported
    • Messages with multiple "rows" (lists of entries) are still parsed/handled as individual rows (just like the current SDF format).

Quix Serialization

  • Added two new "Legacy" serializers, QuixLegacyTimeseriesSerializer and QuixLegacyEventSerializer

@tim-quix tim-quix requested a review from daniil-quix October 26, 2023 23:07
@tim-quix tim-quix requested a review from daniil-quix October 27, 2023 16:04
Comment on lines 272 to 285
if as_legacy is None:
as_legacy = True
self.as_legacy = as_legacy
super().__init__(dumps=dumps, dumps_kwargs=dumps_kwargs)
if self.as_legacy:
self._legacy = {
QModelKey.HEADER_NAME: QModelKey.PARAMETERDATA,
QCodecId.HEADER_NAME: QCodecId.JSON_TYPED,
}
else:
self.extra_headers = {
QModelKey.HEADER_NAME: QModelKey.TIMESERIESDATA,
QCodecId.HEADER_NAME: QCodecId.JSON_TYPED,
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you please clarify how does this part play with the descendant classes?

I see it changes self._as_legacy here, but the descendants also change it

Looks like this base class can be replaced by a simple function _as_quix_legacy(value: bytes, model_key: str, codec_id: str) that will wrap the serialized JSON into some envelope

Copy link
Contributor Author

@tim-quix tim-quix Oct 27, 2023

Choose a reason for hiding this comment

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

I have cleaned up the approach (and removed stuff that I thought I cleaned up, sorry, I should have double-checked)...wanted you to feel Halloween in code form apparently, haha!!

While I probably could remove the inheritance if needed, please take a look at my latest commit and see if you are happy with my improved approach...i think it should make a lot more sense now.

Basically, I still have a QuixSerializer base class for the sake of not repeating stuff across both the Timeseries and EventData serializers.

Also, just in case you were wondering what I was doing with the headers, I am basically making sure I do not include the extra_headers if it's in the legacy format (in case that wasn't clear). I want to replicate the original format as closely as possible so the C# client doesn't know any different.

@tim-quix tim-quix requested a review from daniil-quix October 27, 2023 19:30
@tim-quix tim-quix merged commit 52d636c into feature/sdf Oct 30, 2023
4 checks passed
daniil-quix pushed a commit that referenced this pull request Nov 7, 2023
# Legacy Quix SerDes additions
Added/changed several things around serdes to accomodate parsing of Quix legacy (aka pre-header) formats (`quixstreams` <0.6.0) in a fully backwards-compatible manner.

## Quix Deserialization 
- Deserialization now has one universal class, `QuixDeserialzer`
  - other Quix deserializer classes removed/consolidated
- You can now handle multiple quix message types upon consume instead of just 1
  - Includes `EventData`, `EventData[]`,  and`TimeSeries`/`ParameterData` 
  - Ignore list remains the same
  - If your app needs access to different messages in different formats, you will need to do some sort of conversion with SDF manually to properly convert them to the same data structure post-deserialization
- Legacy formats of `ParameterData`, `EventData`, and `EventData[]` are now supported (<0.6.0) and fully backwards-compatible
  - "Split" messages remain NOT supported
  - Messages with multiple "rows" (lists of entries) are still parsed/handled as individual rows (just like the current SDF format).
  
  
## Quix Serialization
- You can now produce legacy messages by passing the boolean argument `is_legacy` (default `True`) to either the `QuixTimeseriesSerealizer` or `QuixEventsSerealizer`
@daniil-quix daniil-quix deleted the feature/sdf-quix-universal-deserializer branch November 14, 2023 17:27
tim-quix pushed a commit that referenced this pull request Nov 14, 2023
…iles-into-state-directory

Add a state management how to
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.

2 participants