Skip to content

hybrid time series buffer #75

@cboulay

Description

@cboulay

This is a proposal for a generalized buffer class that operates as follows:

  • When add_message(message) is called, the new message is merely appended to a deque
  • Synchronization between the deque and a circular buffer occurs...
    • Upon every add_message `if self._update_strategy == "immediate"
    • Upon some add_message calls elif self._update_strategy == "threshold" and len(q) > threshold
    • Upon get_data if self._update_strategy == "on_demand"
  • When get_data(...) is called, it may synchronize the buffers (see previous point) then it will return a message with the requested data.
    • The data may be a view of the buffer if the requested interval was contiguous

Compared to a deque-only buffer, this has more efficient reads and minimal copies, especially when reads are less frequent than inserts or reads are likely to have overlaps.
Compared to a circular-only buffer, this has faster insertions.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions