| 37 | } |
| 38 | |
| 39 | class KeyedPoolImpl<in K, in out A, out E = never> implements KeyedPool.KeyedPool<K, A, E> { |
| 40 | readonly [KeyedPoolTypeId] = keyedPoolVariance |
| 41 | constructor( |
| 42 | readonly getOrCreatePool: (key: K) => Effect.Effect<Pool.Pool<A, E>>, |
| 43 | readonly activePools: Effect.Effect<Array<Pool.Pool<A, E>>> |
| 44 | ) {} |
| 45 | get(key: K): Effect.Effect<A, E, Scope.Scope> { |
| 46 | return core.flatMap(this.getOrCreatePool(key), pool.get) |
| 47 | } |
| 48 | invalidate(item: A): Effect.Effect<void> { |
| 49 | return core.flatMap(this.activePools, core.forEachSequentialDiscard((pool) => pool.invalidate(item))) |
| 50 | } |
| 51 | pipe() { |
| 52 | return pipeArguments(this, arguments) |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | type MapValue<A, E> = Complete<A, E> | Pending<A, E> |
| 57 |
nothing calls this directly
no outgoing calls
no test coverage detected