MCPcopy
hub / github.com/Effect-TS/effect / queueFromBufferOptionsPush

Function queueFromBufferOptionsPush

packages/effect/src/internal/stream.ts:595–610  ·  view source on GitHub ↗
(
  options?: { readonly bufferSize: "unbounded" } | {
    readonly bufferSize?: number | undefined
    readonly strategy?: "dropping" | "sliding" | undefined
  } | undefined
)

Source from the content-addressed store, hash-verified

593 )
594
595const queueFromBufferOptionsPush = <A, E>(
596 options?: { readonly bufferSize: "unbounded" } | {
597 readonly bufferSize?: number | undefined
598 readonly strategy?: "dropping" | "sliding" | undefined
599 } | undefined
600): Effect.Effect<Queue.Queue<Array<A> | Exit.Exit<void, E>>> => {
601 if (options?.bufferSize === "unbounded" || (options?.bufferSize === undefined && options?.strategy === undefined)) {
602 return Queue.unbounded()
603 }
604 switch (options?.strategy) {
605 case "sliding":
606 return Queue.sliding(options.bufferSize ?? 16)
607 default:
608 return Queue.dropping(options?.bufferSize ?? 16)
609 }
610}
611
612/** @internal */
613export const asyncPush = <A, E = never, R = never>(

Callers 1

asyncPushFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected