WaveBeans / wavebeans

Audio Processing. On scale.
https://wavebeans.io
Apache License 2.0
24 stars 0 forks source link

Table sink #35

Closed asubb closed 4 years ago

asubb commented 4 years ago

Table Sink allows you to store the sample data in memory and keep it queriable. In fact it forms some sort of timeseries database, the time is the key, the value is the sample-entity value. All tables are named.

API may look like this

val stream = someSampleStream()
stream.toTable("mySamples")

To avoid excessive memory usage need to support retain by time strategy.

val stream = someSampleStream()
stream.toTable("mySamples", 120.sec)

No other or custom strategies at the moment. However need to keep that in mind.

Query language

Query language is kept simple, and allows to query the data by time range, for example the following API may work:

Table.byName<Sample>("mySamples")
  .last(60.sec)
  .byTime { it >"2020/01/01 12:00" && it < "2020/01/01 13:00" }

Query forms a stream which might be processed as a regular BeanStream<T>.

asubb commented 4 years ago

Implementation https://github.com/WaveBeans/wavebeans/pull/37