libtcspc.AcquireFullBuckets¶
- final class libtcspc.AcquireFullBuckets(event_type, reader, buffer_provider, batch_size, access_tag)[source]¶
Bases:
NodeSource processor that acquires data into fixed-size buckets while also delivering real-time read-only views.
Like
Acquire, this plugs a pull-based data source into a libtcspc processing graph: on each iteration the processor obtains an empty bucket from the buffer provider, calls the reader to fill it, and collects the data into fixed-size buckets. UnlikeAcquire, it has two outputs:live: a read-onlyConstBucketEventview of the data read on each individual read, delivered immediately (typically used for live display).batch: a fullBucketEventbucket emitted wheneverbatch_sizeelements have been collected, plus any partial final bucket on flush (typically used for saving to disk).
The
liveviews are zero-copy when the buffer provider supplies shared-view-capable buckets, so they must not be modified.The acquisition runs until the reader signals end of stream (by returning
None), the reader raises an exception, or the acquisition is halted via theAcquireAccessorretrieved from theExecutionContextusingaccess_tag. Halting is asynchronous: thehalt()call returns immediately, but the acquisition may continue briefly. Wait for graph execution to finish before tearing down resources used by the reader.- Parameters:
event_type (EventType) – Element type of the acquired data (typically a byte or integer type). Each emitted bucket holds a contiguous array of this type.
reader (AcquisitionReader or Param[PyAcquisitionReader]) – Object that fills supplied buffers with acquired data on each call. Pass an
AcquisitionReaderinstance (such asNullReader) to use a built-in C++-side reader, or wrap a Python callable in a runtimeParamof typePyAcquisitionReaderto bind it at execution time.buffer_provider (BucketSource or Param[PyBucketSource] or None) – Source of buckets used to hold each batch. If
None, a defaultRecyclingBucketSourceforevent_typeis used. A runtimeParamof typePyBucketSourcebinds a Python bucket source at execution time. The buffer provider must support shared views unless theliveoutput is connected to aSinkAll.batch_size (int or Param[int] or None) – Number of elements collected in each full bucket. Smaller values reduce latency; larger values reduce per-read overhead. Defaults to
65536. Must be positive.access_tag (AccessTag) – Tag used to retrieve an
AcquireAccessor(which provideshalt()) from theExecutionContextat runtime.
Notes
Events handled:
This processor has no input events; it is a source.
Emits
ConstBucketEventofevent_typeon theliveoutput for each non-empty read, andBucketEventofevent_typeon thebatchoutput whenever a full bucket is collected.End of input is initiated when the reader returns
None, whereupon both downstreams are flushed (any partial bucket is emitted onbatchfirst). If halted viaAcquireAccessorbefore end of stream, the downstreams are not flushed and a halt exception is raised.
See also
- tcspc::acquire_full_buckets()
The underlying C++ factory function.
AcquireThe single-output counterpart.
AcquisitionReaderInterface for built-in C++-side readers.
PyAcquisitionReaderInterface for Python-callable readers (used via
Param).AcquireAccessorRuntime accessor providing
halt().