isolated_stream 2.1.0-dev.1
isolated_stream: ^2.1.0-dev.1 copied to clipboard
A Dart package for running CPU-intensive stream transformations in separate isolates to prevent blocking the main thread.
2.1.0-dev.1 #
- Added
IsolatedWorker<T, E>: long-lived request/response API withcompute(value) -> Future<E>. - Added
concurrency: int?onIsolatedWorker—nullis unbounded,1serializes calls,Ncaps in-flight at N and queues the rest. - Added
idleTimeout+onIdleShutdownonIsolatedWorkerand allIsolatedProcessingStrategyfactories — workers release their isolates after inactivity and transparently re-spawn on the next call. - Changed: sequential and concurrent scheduling is now centralized in an internal
_WorkPolicyprimitive shared byIsolatedWorkerand the stream strategies (no behavior change). - Fixed: in-flight
compute()no longer hangs ondispose()— it now completes with aStateError. - Fixed:
dispose()racing an in-progress isolate spawn no longer leaks isolates or hangs. - Fixed:
Droppable/Restartablestrategies could leave the output stream open forever if the source closed after all events had completed. - Changed:
IsolatedWorkerthrowsArgumentError(notAssertionError) forisolates < 1.
2.0.2 #
- Fixed a memory leak during multiple stream reinitialisations.
2.0.1 #
- Updated documentation
2.0.0 #
- BREAKING CHANGE: Replaced
concurrency, andisolatesparameters with strategy-based API - Added
IsolatedProcessingStrategypattern for better type safety and extensibility - Added
IsolatedProcessingStrategy.concurrent(),.droppable(),.restartable(),.sequential()factories - Improved broadcast stream handling with shared isolates across listeners
- Fixed concurrency tracking issues in isolate boundaries
- Enhanced lazy initialization for better resource management
Migration example:
// Before (v1.x)
stream.isolatedMap(handler, concurrency: 3, isolates: 2)
// After (v2.x)
stream.isolatedMap(
handler,
strategy: IsolatedProcessingStrategy.concurrent(
concurrency: 3,
isolates: 2,
),
);
1.0.0 #
- Initial release
- Added
isolatedMap()extension for streams - Added
IsolatedHandlerabstract class - Support for sync and async transformations
- Configurable concurrency with order preservation
- Isolate pooling for high-throughput scenarios