Delta Of Delta Encoding
This has simple implementation of various ways to encoding timestamps used in time series databases.
Run delta-of-delta-demo to see examples of the output.
Timestamp Encoding
This is the simplest encoding scheme, in this one we just store the timestamps. This is inefficient because the raw bytes of successive timestamps only change a little over time.
This can be used with the timestamp_encode function or used when streaming data with the Encoder class.
Example:
- Input
[1496163646, 1496163676, 1496163706, 1496163735, 1496163765]
- Output
[1496163646, 1496163676, 1496163706, 1496163735, 1496163765]
Delta Encoding
This scheme stores the initial timestamp and the differences between them. This helps because we use less memory to store the delta instead of the whole timestamp
This can be used with the delta_encode function or used when streaming with the DeltaEncoder class.
Example:
- Input
[1496163646, 1496163676, 1496163706, 1496163735, 1496163765]
- Output
[1496163646, +30, +30, +29, +30]
Delta of Delta Encoding
This scheme is based on Facebook's Gorilla time-series database and is also found in Prometheus. In this case we know use the fact that we know that most entries come in at a constant rate (because we are collecting metrics) we only store the delta of the time between this timestamp and the previous timestamp and the time between the previous timestamp and the one before that. Most of the data coming in will be zeros and therefore we will get a high compression rate.
This can be used with the delta_of_delta_encode function or when streaming with the DeltaOfDeltaEncoder.
Example:
- Input
[1496163646, 1496163676, 1496163706, 1496163735, 1496163765]
- Output
[1496163646, +30, 0, -1, +1]
The Encoder and Decoder classes
The Encoder and Decoder classes are stateful encoders and decoder that can be used to handle streaming
timestamps. The Encoder will record your initial timestamp in .initial_timestamp for easy decoding. You
initialize these classes with a timestamp and then as you pass in a new timestamp it will return the
encoded/decoded representation.
The Encoding dataclass
The Encoding data class is a data structure that represents the timestamp stream encoded in some format.
They all have .initial_timestamp property that holds the first timestamp in the series and then a
second property that is a list of the following values. (called .timestamps, .deltas, and
delta_of_deltas respectively).
Metadata
Release files for delta-of-delta 2.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| delta-of-delta-2.0.2.tar.gz | 4.8 kB | Without provenance | Details for delta-of-delta-2.0.2.tar.gz |
Release files / delta-of-delta-2.0.2.tar.gz
| Download URL | delta-of-delta-2.0.2.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
04fc35e9e43de7f86514de4b3df29b69a72bd3790fa3fd40460f0dff01543cc4
|
|
BLAKE2b-256 checksum How to use checksums |
57832716315cecf48fc1f47bdbbdf6e430729ed96597f1ccba05b9878b973d28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.0
|
Security for delta-of-delta 2.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.