libtcspc.Batch¶
- final class libtcspc.Batch(event_type, *, buffer_provider=None, batch_size=None)[source]¶
Bases:
NodeProcessor that groups events into fixed-size buckets.
Collects every
batch_sizeevents ofevent_typeinto a bucket obtained from the buffer provider, and emits the bucket as aBucketEventonce full. Batching does not perform time-based flushing, so it can introduce arbitrary latency on real-time event streams; for that reason, intermediate buffering of real-time streams is usually unnecessary and inadvisable.- Parameters:
event_type (EventType) – The event type to batch. The input event set must consist only of this type.
buffer_provider (BucketSource or None) – Source of buckets used to hold each batch. If
None, a defaultRecyclingBucketSourceforevent_typeis used.batch_size (int or Param[int] or None) – Number of events to collect in each bucket. Defaults to
65536.
Notes
Events handled:
Events matching
event_type: collected intoBucketEvent; emitted when the bucket is full.All other event types: rejected at graph build time.
End of input: emit any partially-filled bucket, then pass through.
See also
- tcspc::batch()
The underlying C++ factory function.