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

Removed all references to Ack in docs #1043

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions kyo-prelude/shared/src/main/scala/kyo/Emit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ object Emit:
* @param acc
* The initial accumulator value
* @param f
* The folding function that takes the current accumulator and emitted value, and returns a tuple of the new accumulator and an
* Ack to control further emissions
* The folding function that takes the current accumulator and emitted value, and returns an updated accumulator
* @param v
* The computation with Emit effect
* @return
Expand Down Expand Up @@ -147,7 +146,7 @@ object Emit:
* @return
* A tuple containing:
* - Maybe[V]: The first emitted value if any (None if no values were emitted)
* - A continuation function that takes an Ack and returns the remaining computation
* - A continuation function that returns the remaining computation
*/
def apply[A: Flat, S](v: A < (Emit[V] & S))(using tag: Tag[Emit[V]], frame: Frame): (Maybe[V], () => A < (Emit[V] & S)) < S =
ArrowEffect.handleFirst(tag, v)(
Expand Down
18 changes: 6 additions & 12 deletions kyo-prelude/shared/src/main/scala/kyo/Poll.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,16 @@ import kyo.kernel.ArrowEffect

/** Represents polling values from a data source with backpressure control.
*
* Poll is used to consume values while maintaining flow control through acknowledgements. Each poll operation takes an Ack that determines
* how many values can be consumed, and returns Maybe[V] indicating whether a value was available.
*
* Key behaviors:
* - Each poll operation requires an Ack value that signals the consumer's readiness to receive more data
* * Key behaviors:
* - Poll returns Maybe[V], where:
* - Present(v) indicates a successful poll with value v
* - Absent indicates the end of the stream (no more values will be available)
* - Once Absent is received, the consumer should stop polling as the stream has terminated
* - Backpressure is maintained through the Ack responses:
* - Continue signals readiness to receive more values
* - Stop indicates the consumer wants to pause receiving values
* Poll is used to consume values. Each poll operation signals readiness to receive data, and returns Maybe[V] indicating whether a value
* was available.
johnhungerford marked this conversation as resolved.
Show resolved Hide resolved
*
* The effect enables building streaming data pipelines with controlled consumption rates. Handlers can process values at their own pace by
* returning appropriate Ack responses, while respecting stream termination signals.
* polling only as needed.
*
* @tparam V
* The type of values being polled from the data source.
Expand Down Expand Up @@ -152,9 +147,8 @@ object Poll:

/** Runs a Poll effect with a single input value, stopping after the first poll operation.
*
* This method provides a single input value to the Poll effect and stops after the first poll. It returns a tuple containing:
* - An Ack value indicating whether to continue or stop
* - A continuation function that can process the Maybe[V] result of the poll
* This method provides a single input value to the Poll effect and stops after the first poll. It returns a continuation function
* that can process the Maybe[V] result of the poll
*
* @param v
* The computation requiring Poll values
Expand Down
Loading