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

Class KeyedPoolImpl

packages/effect/src/internal/keyedPool.ts:39–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39class 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
56type MapValue<A, E> = Complete<A, E> | Pending<A, E>
57

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected