-
Couldn't load subscription status.
- Fork 2
Open
Description
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 adeque - Synchronization between the
dequeand a circular buffer occurs...- Upon every
add_message`if self._update_strategy == "immediate" - Upon some
add_messagecallselif self._update_strategy == "threshold" and len(q) > threshold - Upon
get_dataif self._update_strategy == "on_demand"
- Upon every
- 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