databay.support.buffers¶
-
class
databay.support.buffers.Buffer(count_threshold: int = None, time_threshold: float = None, custom_controllers: Union[callable, List[callable]] = None, on_reset: callable = None, conjugate_controllers: bool = False)[source]¶ databay.support.buffers.Buffer
Buffers are special built-in Processors. They allow you to temporarily accumulate records before passing them over to outlets.
When processing records (see Processors) a Buffer will figure out whether records should be stored or released. This is done by passing the list of records to Buffer’s internal
callablefunctions called controllers.Each controller performs different types of checks, returning
TrueorFalsedepending on whether records should be released or stored respectively.- Parameters
count_threshold (int) – The number of records stored that when reached will complete the count controller. When set to
Noneit will disable the count controller.Default:Nonetime_threshold (float) – The number of seconds elapsed since the previous release that when reached will complete the time controller. When set to
Noneit will disable the time controller.Default:Nonecustom_controllers (
callableor list[callable]) – List of customcallablecontrollers.Default:Noneon_reset (
callable) – Callback invoked whenresetis called.Default:Noneconjugate_controllers (bool) – Whether to release the records when any controller returns
Trueor to wait for all of them to complete before releasing records.Default:False