Optimized data aggregation.

- All aggregation use only the raw data as input.
- Only produce aggregated data that will show in a chart (less work after clearing the sensor_data_aggr table).
- Adding version handling of data aggregation to secure that the peer has up to date data.
- New db version: 6 - Adding sensor.aggr_version(int, default=1), will clear sensor_data_aggr for local sensors


Former-commit-id: cbf5a890a5058791b443e975048db13f6ac4c9fe
This commit is contained in:
Daniel Collin 2016-02-02 14:21:56 +01:00
parent a6f8cf872a
commit ea5c991824
10 changed files with 121 additions and 136 deletions

View file

@ -46,6 +46,12 @@
<exec executable="sqlite3">
<arg line="hal.db 'DELETE FROM sensor_data_aggr'" />
</exec>
<!-- update all internal sensors aggregation version to indicate for peers that they need to re-sync all data -->
<exec executable="sqlite3">
<arg line="hal.db 'UPDATE sensor SET aggr_version = aggr_version+1) WHERE id = (SELECT sensor.id FROM user, sensor WHERE user.external == 0 AND sensor.user_id = user.id)'" />
</exec>
</target>
<!--clean all build paths-->
@ -58,12 +64,12 @@
<!--build product code-->
<target name="build" depends="build-dependencies">
<mkdir dir="${buildDir}" />
<javac srcdir="${srcDir}" destdir="${buildDir}" fork="yes">
<javac srcdir="${srcDir}" destdir="${buildDir}" debug="yes" fork="yes">
<include name="**/*.java" />
<exclude name="se/hal/tts/GoogleTTSClient.java" />
<classpath refid="classpath.build" />
</javac>
<javac srcdir="${testDir}" destdir="${buildDir}" fork="yes">
<javac srcdir="${testDir}" destdir="${buildDir}" debug="yes" fork="yes">
<include name="**/*.java" />
<exclude name="se/hal/test/JarvisSyntersizerTest.java" />
<classpath refid="classpath.build" />