-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP Simplified action queueing implementation.
Based on #916. Implements and closes #910.
- Loading branch information
1 parent
4f55451
commit 010f9fc
Showing
4 changed files
with
56 additions
and
27 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
kotlin/workflow-runtime/src/main/java/com/squareup/workflow/internal/PendingUpdate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.squareup.workflow.internal | ||
|
||
/** | ||
* TODO write documentation | ||
*/ | ||
internal typealias PendingUpdate = () -> Any? | ||
|
||
interface PendingUpdateSink { | ||
/** | ||
* Enqueues [update] and suspends until the update has been accepted for execution. | ||
* | ||
* Use this method to accept backpressure from the runtime when there is contention. | ||
*/ | ||
suspend fun update(update: PendingUpdate) | ||
|
||
/** | ||
* Enqueues [update] and returns immediately. | ||
* | ||
* Use this method for updates triggered from non-coroutine contexts, such as UI events. | ||
*/ | ||
fun enqueueUpdate(update: PendingUpdate) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters