docs.rs failed to build dataseries-0.1.6
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
dataseries
data-series functions support for data-series and time-series.
functions
union
Continuous time series union between 2 series. Left and right data can be absent (left and right only cases).
1 3 10 20
Left: |-----|-----|------------------|-
130 120 95 160
12 15
Right: |------|--------
105 110
1 3 10 12 15 20
Expected: |-----|-----|----|------|------|-
130,∅ 120,∅ 95,∅ 95,105 95,110 160,110
examples
simple
A simple example of union between 2 timeseries
intersection
An intersection implementation using the union function.
eventual consistency and conflict resolution
The crdt example provides an example of the conflict-free replicated data type resolution based on data-series union.
The VersionedValue defines the version (here a timestamp) to solve the conflict by taking the maximum version. The maximum is defined through the trait Ord and used inside the given function used by union.
The below example uses TimestampMicros to version the data and solve conflict by taking the highest version of a value.
/// Interval can be encoded by using 2 Datapoints with a [`None`] last datapoint value to mark the end of each interval
let s1 = of_iter;
let s2 = of_iter;
// Solves conflict by taking always the maximum version
let actual = s1
.union
.;
let expected = vec!;