Releases: PlugFox/control
Releases · PlugFox/control
v1.0.0-dev.1
1.0.0-dev.1
Features
- ADDED: Generic
handle<T>()method - now supports return values- Example:
Future<User> fetchUser(String id) => handle<User>(() async { ... return user; }) - Type-safe return values from controller operations
- Works with all concurrency strategies (sequential, concurrent, droppable)
- Example:
Breaking Changes
- REMOVED:
basemodifier fromController,StateController, and concurrency handler mixins- Controllers no longer require
finalorbasein user code - Provides more flexibility for inheritance patterns
- Controllers no longer require
- CHANGED:
Controller.handle()now has a default concurrent implementation- No longer abstract - controllers can be used without choosing a concurrency mixin
- Operations execute concurrently by default
- Provides zone for error catching, HandlerContext, observer notifications, and callbacks
- CHANGED: Concurrency handler mixins simplified to wrap
super.handle()withMutexSequentialControllerHandler- wraps handle with mutex for sequential executionDroppableControllerHandler- wraps handle with mutex and drops new operations if busyConcurrentControllerHandler- deprecated (base behavior is already concurrent)
- CHANGED:
Controller.handle()signature now includeserroranddonecallbacks- Before:
handle(handler, {name, meta}) - After:
handle<T>(handler, {error, done, name, meta})
- Before:
- CHANGED:
DroppableControllerHandlernow returnsnullwhen dropping operations- Handle method returns
Future<T?>to support nullable return values - Dropped operations return
nullinstead of throwing errors - This is the expected behavior for droppable operations
- Handle method returns
Added
- ADDED: Base
handle()implementation inControllerclass- Concurrent execution by default
- Zone-based error catching (including unawaited futures)
- HandlerContext for debugging
- Observer notifications
- Error and done callbacks
- ADDED:
Mutexis now the core primitive for concurrency control- Can be used directly in controllers for custom concurrency patterns
- Sequential and droppable mixins built on top of Mutex
Improved
- IMPROVED: Reduced code complexity
- Concurrency handler mixins reduced from ~300 lines to ~90 lines
- Removed
_ControllerEventQueueclass (no longer needed) - Simplified architecture easier to understand and maintain
- IMPROVED: More flexibility in concurrency control
- Use mixins for simple cases (sequential/droppable)
- Use Mutex directly for custom patterns
- Mix and match strategies in the same controller
Migration Guide
See MIGRATION.md for detailed migration instructions from 0.x to 1.0.0.
Quick migration:
- Remove
basefrom your controller classes ConcurrentControllerHandlercan be removed (controllers are concurrent by default)SequentialControllerHandlerandDroppableControllerHandlerwork the same way- For custom concurrency, use
Mutexdirectly instead of creating custom mixins
v0.2.0
0.2.0
- ADDED:
HandlerContextto handlers, available at zone and observer. - ADDED:
namegetter forController - ADDED:
void onHandler(HandlerContext context)toIControllerObserver - REMOVED:
donegetter fromController
What's Changed
- Feature/proof of concept by @PlugFox in #1
- refactor: alter IController to include handle by @hawkkiller in #2
- Feat/tests by @ziqq in #4
- Add more tests by @ziqq in #5
- Feature/handlers context by @PlugFox in #7
New Contributors
- @PlugFox made their first contribution in #1
- @hawkkiller made their first contribution in #2
- @ziqq made their first contribution in #4
Full Changelog: https://github.com/PlugFox/control/commits/v0.2.0