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

Function make

packages/effect/src/Queue.ts:448–468  ·  view source on GitHub ↗
(
  options?: {
    readonly capacity?: number | undefined
    readonly strategy?: "suspend" | "dropping" | "sliding" | undefined
  } | undefined
)

Source from the content-addressed store, hash-verified

446 * @since 4.0.0
447 */
448export const make = <A, E = never>(
449 options?: {
450 readonly capacity?: number | undefined
451 readonly strategy?: "suspend" | "dropping" | "sliding" | undefined
452 } | undefined
453): Effect<Queue<A, E>> =>
454 core.withFiber((fiber) => {
455 const self = Object.create(QueueProto)
456 self.dispatcher = fiber.currentDispatcher
457 self.capacity = options?.capacity ?? Number.POSITIVE_INFINITY
458 self.strategy = options?.strategy ?? "suspend"
459 self.messages = MutableList.make()
460 self.scheduleRunning = false
461 self.state = {
462 _tag: "Open",
463 takers: new Set(),
464 offers: new Set(),
465 awaiters: new Set()
466 }
467 return internalEffect.succeed(self)
468 })
469
470/**
471 * Creates a bounded queue with the specified capacity that uses backpressure strategy.

Callers 4

boundedFunction · 0.70
slidingFunction · 0.70
droppingFunction · 0.70
unboundedFunction · 0.70

Calls 2

makeMethod · 0.65
succeedMethod · 0.45

Tested by

no test coverage detected