Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore coroutine-based API #501

Closed
Egorand opened this issue Aug 30, 2018 · 3 comments
Closed

Explore coroutine-based API #501

Egorand opened this issue Aug 30, 2018 · 3 comments
Milestone

Comments

@Egorand
Copy link
Collaborator

Egorand commented Aug 30, 2018

Coroutines will graduate to stable in Kotlin 1.3, which is currently in pre-release stages. We need a design doc on how Okio will be using coroutines and start sketching out the API.

@Egorand Egorand added this to the 2.1 milestone Aug 30, 2018
@swankjesse swankjesse modified the milestones: 2.1, 2.2 Sep 23, 2018
@zach-klippenstein
Copy link

@swankjesse started a proof-of-concept using NIO's async API in #531, and there's a ton of discussion there. That proposal adds non-blocking variants to only the basic read/write APIs - processing data using BufferedSources full API would require first filling the buffer manually using one of the non-blocking methods, and refilling it as necessary when consumed. I'm not sure how writing would work, since blocking BufferedSink calls will always try to write completed segments before returning, so requiring the caller to always remember to make explicit non-blocking emit calls is kind of awkward.

@bnorm
Copy link
Collaborator

bnorm commented Oct 2, 2019

Not sure where this exploration is currently at, but I've been exploring a coroutine-based API as well in a personal repository.

ianhanniballake added a commit to muzei/muzei that referenced this issue Mar 27, 2021
The okhttp `Call` class supports cancellation. Rather than `execute()` it inline, we use the `await()` helper from `ru.gildor.coroutines:kotlin-coroutines-okhttp` to ensure that cancellation of the coroutine scope managed by WorkManager correctly cancels any inflight Call.

Note that we can't do the same for the call to `string()` as that is a blocking call and okio does not have a non-blocking version as per [this issue](square/okio#501).

Fixes #722
ianhanniballake added a commit to muzei/muzei that referenced this issue Jun 13, 2021
The okhttp `Call` class supports cancellation. Rather than `execute()` it inline, we use the `await()` helper from `ru.gildor.coroutines:kotlin-coroutines-okhttp` to ensure that cancellation of the coroutine scope managed by WorkManager correctly cancels any inflight Call.

Note that we can't do the same for the call to `string()` as that is a blocking call and okio does not have a non-blocking version as per [this issue](square/okio#501).

Fixes #722
@swankjesse swankjesse modified the milestones: Backlog , Icebox Oct 26, 2021
@swankjesse
Copy link
Member

No plans.

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

No branches or pull requests

4 participants