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

Function dropping

packages/effect/src/TxQueue.ts:447–460  ·  view source on GitHub ↗
(
  capacity: number
)

Source from the content-addressed store, hash-verified

445 * @since 2.0.0
446 */
447export const dropping = <A = never, E = never>(
448 capacity: number
449): Effect.Effect<TxQueue<A, E>> =>
450 Effect.gen(function*() {
451 const items = yield* TxChunk.empty<A>()
452 const stateRef = yield* TxRef.make<State<A, E>>({ _tag: "Open" })
453
454 const txQueue = Object.create(TxQueueProto)
455 txQueue.strategy = "dropping"
456 txQueue.capacity = capacity
457 txQueue.items = items
458 txQueue.stateRef = stateRef
459 return txQueue
460 }).pipe(Effect.tx)
461
462/**
463 * Creates a new sliding `TxQueue` with the specified capacity that evicts old items when full.

Callers

nothing calls this directly

Calls 2

pipeMethod · 0.65
makeMethod · 0.65

Tested by

no test coverage detected