Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 3807 by
is...@google.com: pause/continue for throttling IO stream
processing
http://code.google.com/p/dart/issues/detail?id=3807
An IO stream consumer (e.g. callback handler of an InputStream) is not able
to throttle / pause the stream,. While processing the data, it is not able
to fire async tasks to e.g. write in a database, wait for the result and
continue the stream with the next entry, because as soon as it fires the
async event, it will receive the next entry. The only option is to keep
track of each Future reference, essentially risking (and reaching) out of
memory errors.
IO callback-driven classes, especially the following callbacks shall be
controlled through a simple pause/continue mechanism:
- DirectoryLister.onFile
- DirectoryLister.onDir
- InputStream.onData
- StringInputStream.onData
- StringInputStream.onLine
The pause() / continue() methods might the callback function's parameter,
but I think it is better to have them on the class level. In the later
case, pauseProcessing() / continueProcessing() could be a longer (more
precise) name for them.
Additional info / related examples in the following thread:
https://groups.google.com/a/dartlang.org/group/misc/browse_thread/thread/2a75f47f15a57d1f#