Skip to content

Add AsyncMap util function.#6

Open
sam-fredrickson wants to merge 1 commit intonegrel:masterfrom
sam-fredrickson:async-map
Open

Add AsyncMap util function.#6
sam-fredrickson wants to merge 1 commit intonegrel:masterfrom
sam-fredrickson:async-map

Conversation

@sam-fredrickson
Copy link
Contributor

AsyncMap is similar to Map, except that it operates on iter.Seq[T] instead of []T, and the order of the output sequence is decoupled from the input sequence; outputs are delivered as soon as they finish.

Unlike other utility functions, AsyncMap operates in the context of a "parent" nursery, and spawns a nested nursery in which the actual processing occurs. The nested nursery will use the parent one as its context by default, but of course this can be overriden via WithContext.

The output sequence is backed by a channel, and by default is unbuffered, but the new option WithOutputBuffer lets a buffer size be set.

Add more tests.

Extend the doc string.

Handle context cancellation when sending outputs.

Simplify using nested Block.

Add Context parameter to transform func.

Use parent nursery as default context for nested block.

Doc string updates

AsyncMap improvements

Allow buffered outputs

Add tests for buffered output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant