| 355 | * @since 2.0.0 |
| 356 | */ |
| 357 | export const bounded = <A = never, E = never>( |
| 358 | capacity: number |
| 359 | ): Effect.Effect<TxQueue<A, E>> => |
| 360 | Effect.gen(function*() { |
| 361 | const items = yield* TxChunk.empty<A>() |
| 362 | const stateRef = yield* TxRef.make<State<A, E>>({ _tag: "Open" }) |
| 363 | |
| 364 | const txQueue = Object.create(TxQueueProto) |
| 365 | txQueue.strategy = "bounded" |
| 366 | txQueue.capacity = capacity |
| 367 | txQueue.items = items |
| 368 | txQueue.stateRef = stateRef |
| 369 | return txQueue |
| 370 | }).pipe(Effect.tx) |
| 371 | |
| 372 | /** |
| 373 | * Creates a new unbounded `TxQueue` with unlimited capacity. |