Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Simple selection of concurrency mode for transformEvents #5

Open
PlugFox opened this issue Jul 7, 2021 · 5 comments
Open

Simple selection of concurrency mode for transformEvents #5

PlugFox opened this issue Jul 7, 2021 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@PlugFox
Copy link
Owner

PlugFox commented Jul 7, 2021

Simple selection of concurrency mode for transformEvents

@PlugFox PlugFox added the enhancement New feature or request label Jul 7, 2021
@PlugFox PlugFox added this to the 8.0.0 milestone Jul 7, 2021
@Aqluse
Copy link

Aqluse commented Jul 7, 2021

Predefined modes you mean? Should it be separate package soon as we probably going to use rxdart for it? Or, you going to do a very limited set of these by your own?

@PlugFox
Copy link
Owner Author

PlugFox commented Jul 7, 2021

@Aqluse
Predefined modes.
You always can override transformEvents to make your own.

Also im try create easy template with StreamIterator or something like this.

@PlugFox
Copy link
Owner Author

PlugFox commented Jul 7, 2021

Maybe use StreamIterator for clear management of the order of event processing

@zs-dima
Copy link
Contributor

zs-dima commented Jul 8, 2021

@PlugFox
Current transformEvents looks good, could be nice to compare with StreamIterator firstly, if it will not complicated some cases:

    final streamEvents = events
        .whereType<StreamEvent>()
        .transform(BlocTransformer(
            (event) => event.events().transform(
                  StreamTransformer<SomeEvent, SomeEvent>.fromHandlers(
                    handleData: (event, sink) => sink.add(event),
                    handleError: (error, stacktrace, sink) => event.onError(error, stacktrace, sink),
                    handleDone: (sink) => event.onDone(),
                  ),
                ),
            maximumConcurrency: 10));

    _callbackEvents = events.whereType<CallbackEvent>();

    final simpleEvents = events.where((event) => event is! StreamEvent && event is! CallbackEvent);

    return MergeStream([
      streamEvents,
      simpleEvents,
    ]).transform(BlocTransformer(next, maximumConcurrency: 10));

it is not clear how StreamIterator could help with similar cases

@PlugFox
Copy link
Owner Author

PlugFox commented Jul 8, 2021

transformEvents is good.

need research how to create simple asyncExpand replacement

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants