MCPcopy Create free account
hub / github.com/Effect-TS/effect / bufferUnbounded

Function bufferUnbounded

packages/effect/src/internal/stream.ts:1103–1120  ·  view source on GitHub ↗
(self: Stream.Stream<A, E, R>)

Source from the content-addressed store, hash-verified

1101})
1102
1103const bufferUnbounded = <A, E, R>(self: Stream.Stream<A, E, R>): Stream.Stream<A, E, R> => {
1104 const queue = toQueue(self, { strategy: "unbounded" })
1105 return new StreamImpl(
1106 channel.unwrapScoped(
1107 Effect.map(queue, (queue) => {
1108 const process: Channel.Channel<Chunk.Chunk<A>, unknown, E, unknown, void, unknown> = pipe(
1109 core.fromEffect(Queue.take(queue)),
1110 core.flatMap(InternalTake.match({
1111 onEnd: () => core.void,
1112 onFailure: core.failCause,
1113 onSuccess: (value) => core.flatMap(core.write(value), () => process)
1114 }))
1115 )
1116 return process
1117 })
1118 )
1119 )
1120}
1121
1122const bufferSignal = <A, E, R>(
1123 scoped: Effect.Effect<Queue.Queue<readonly [Take.Take<A, E>, Deferred.Deferred<void>]>, never, Scope.Scope>,

Callers 1

stream.tsFile · 0.85

Calls 6

toQueueFunction · 0.85
fromEffectMethod · 0.80
pipeFunction · 0.70
mapMethod · 0.65
takeMethod · 0.65
writeMethod · 0.65

Tested by

no test coverage detected