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

Rework data logging interfaces #78

Merged
merged 36 commits into from
Dec 3, 2023
Merged

Conversation

mhthies
Copy link
Owner

@mhthies mhthies commented Dec 3, 2023

  • Move shc.log.generic to shc.data_logging

  • Move shc.log.in_memory to shc.interfaces.in_memory_data_logging

  • Move shc.log.mysql to shc.interfaces.mysql

  • Rename PersistenceVariable to DataLogVariable and completely rework internal interface and behaviour.

    • Separation of data log subscription (DataLogVariable, LiveDataLogView) from web interface logics (LoggingWebUIView)
    • Race-free retrieval and subscription of data log variables
    • breaking: All existing data logging interfaces (inheritering from PersistenceVariable) need to be adapted
    • See https://smarthomeconnect.readthedocs.io/en/latest/data_logging.html for further information
  • New test infrastructure for basic unit-testing of all data logging interfaces

  • Rename InMemoryPersistenceVariable to InMemoryDataLogVariable

  • Rename MySQLPersistence to MySQLConnector

  • Change interface of MySQLConnector for retrieving non-logging persistence connector objects with new method persistence_variable()

  • Tests and documentation for MySQL interface

  • New database schema for MySQL interface (when used for value persistence without data logging)

…log_sync() to base class with custom exception if not subscribable
... without using the WritableDataLogVariable's complicated logic
…w to subclass it

Also add explit test for WritableDataLogVariable based log variable
@mhthies mhthies force-pushed the feature/stabilize-data-logging branch from 264826f to 428c2cf Compare December 3, 2023 13:32
@mhthies mhthies force-pushed the feature/stabilize-data-logging branch 2 times, most recently from cda0506 to d5d9bca Compare December 3, 2023 14:57
@mhthies mhthies force-pushed the feature/stabilize-data-logging branch from d5d9bca to c244bc9 Compare December 3, 2023 15:01
Copy link

codecov bot commented Dec 3, 2023

Codecov Report

Attention: 85 lines in your changes are missing coverage. Please review.

Comparison is base (27cddbe) 81.36% compared to head (a4b7cad) 83.13%.

Files Patch % Lines
shc/interfaces/mysql.py 75.26% 38 Missing and 8 partials ⚠️
shc/data_logging.py 88.12% 22 Missing and 9 partials ⚠️
shc/interfaces/in_memory_data_logging.py 85.18% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #78      +/-   ##
==========================================
+ Coverage   81.36%   83.13%   +1.76%     
==========================================
  Files          43       42       -1     
  Lines        5389     5526     +137     
  Branches      809      850      +41     
==========================================
+ Hits         4385     4594     +209     
+ Misses        798      714      -84     
- Partials      206      218      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…c and ChartDataSpec

This avoids problems with multiple inheritence (for the 'Generic[T]'
typing) with NamedTuple.
@mhthies mhthies force-pushed the feature/stabilize-data-logging branch from d5f99ab to e15b7d6 Compare December 3, 2023 15:26
... as the test may actually be slowed down by the database operations.
@mhthies mhthies merged commit 8cb1be3 into main Dec 3, 2023
7 checks passed
@mhthies mhthies deleted the feature/stabilize-data-logging branch December 3, 2023 16:29
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.

1 participant