<A>(item: A): <E>(
self: Pool<A, E>
) => Effect.Effect<void, never, Scope.Scope>
<A, E>(self: Pool<A, E>, item: A): Effect.Effect<void, never, Scope.Scope>Invalidates the specified item so the pool can remove it and reallocate the item, lazily if needed.
When to use
Use to prevent a pooled item from being reused after it becomes unsuitable, such as a stale connection or a resource that failed a health check.
Gotchas
The item is matched with strict equality. Passing an equivalent but different object instance does nothing.
export const const invalidate: {
<A>(item: A): <E>(
self: Pool<A, E>
) => Effect.Effect<void, never, Scope.Scope>
<A, E>(
self: Pool<A, E>,
item: A
): Effect.Effect<void, never, Scope.Scope>
}
Invalidates the specified item so the pool can remove it and reallocate the
item, lazily if needed.
When to use
Use to prevent a pooled item from being reused after it becomes unsuitable,
such as a stale connection or a resource that failed a health check.
Gotchas
The item is matched with strict equality. Passing an equivalent but different
object instance does nothing.
invalidate: {
<function (type parameter) A in <A>(item: A): <E>(self: Pool<A, E>) => Effect.Effect<void, never, Scope.Scope>A>(item: Aitem: function (type parameter) A in <A>(item: A): <E>(self: Pool<A, E>) => Effect.Effect<void, never, Scope.Scope>A): <function (type parameter) E in <E>(self: Pool<A, E>): Effect.Effect<void, never, Scope.Scope>E>(self: Pool<A, E>(parameter) self: {
config: Config<A, E>;
state: State<A, E>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
self: interface Pool<in out A, in out E = never>A Pool<A, E> is a pool of items of type A, each of which may be
associated with the acquisition and release of resources. An attempt to get
an item A from a pool may fail with an error of type E.
When to use
Use when you need to share a bounded set of scoped resources across fibers
while the pool manages acquisition, reuse, and release.
Pool<function (type parameter) A in <A>(item: A): <E>(self: Pool<A, E>) => Effect.Effect<void, never, Scope.Scope>A, function (type parameter) E in <E>(self: Pool<A, E>): Effect.Effect<void, never, Scope.Scope>E>) => import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<void, never, import ScopeScope.Scope>
<function (type parameter) A in <A, E>(self: Pool<A, E>, item: A): Effect.Effect<void, never, Scope.Scope>A, function (type parameter) E in <A, E>(self: Pool<A, E>, item: A): Effect.Effect<void, never, Scope.Scope>E>(self: Pool<A, E>(parameter) self: {
config: Config<A, E>;
state: State<A, E>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
self: interface Pool<in out A, in out E = never>A Pool<A, E> is a pool of items of type A, each of which may be
associated with the acquisition and release of resources. An attempt to get
an item A from a pool may fail with an error of type E.
When to use
Use when you need to share a bounded set of scoped resources across fibers
while the pool manages acquisition, reuse, and release.
Pool<function (type parameter) A in <A, E>(self: Pool<A, E>, item: A): Effect.Effect<void, never, Scope.Scope>A, function (type parameter) E in <A, E>(self: Pool<A, E>, item: A): Effect.Effect<void, never, Scope.Scope>E>, item: Aitem: function (type parameter) A in <A, E>(self: Pool<A, E>, item: A): Effect.Effect<void, never, Scope.Scope>A): import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<void, never, import ScopeScope.Scope>
} = import dualdual(2, <function (type parameter) A in <A, E>(self: Pool<A, E>, item: A): Effect.Effect<void, never, Scope.Scope>A, function (type parameter) E in <A, E>(self: Pool<A, E>, item: A): Effect.Effect<void, never, Scope.Scope>E>(self: Pool<A, E>(parameter) self: {
config: Config<A, E>;
state: State<A, E>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
self: interface Pool<in out A, in out E = never>A Pool<A, E> is a pool of items of type A, each of which may be
associated with the acquisition and release of resources. An attempt to get
an item A from a pool may fail with an error of type E.
When to use
Use when you need to share a bounded set of scoped resources across fibers
while the pool manages acquisition, reuse, and release.
Pool<function (type parameter) A in <A, E>(self: Pool<A, E>, item: A): Effect.Effect<void, never, Scope.Scope>A, function (type parameter) E in <A, E>(self: Pool<A, E>, item: A): Effect.Effect<void, never, Scope.Scope>E>, item: Aitem: function (type parameter) A in <A, E>(self: Pool<A, E>, item: A): Effect.Effect<void, never, Scope.Scope>A): import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<void, never, import ScopeScope.Scope> =>
import EffectEffect.suspend(() => {
if (self: Pool<A, E>(parameter) self: {
config: Config<A, E>;
state: State<A, E>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
self.Pool<A, E>.state: State<A, E>(property) Pool<A, E>.state: {
scope: Scope.Scope;
isShuttingDown: boolean;
semaphore: Semaphore.Semaphore;
resizeSemaphore: Semaphore.Semaphore;
items: Set<PoolItem<A, E>>;
available: Set<PoolItem<A, E>>;
availableLatch: Latch.Latch;
invalidated: Set<PoolItem<A, E>>;
waiters: number;
}
state.State<A, E>.isShuttingDown: booleanisShuttingDown) return import EffectEffect.void
for (const const poolItem: PoolItem<A, E>const poolItem: {
exit: Exit.Exit<A, E>;
finalizer: Effect.Effect<void>;
refCount: number;
disableReclaim: boolean;
}
poolItem of self: Pool<A, E>(parameter) self: {
config: Config<A, E>;
state: State<A, E>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
self.Pool<A, E>.state: State<A, E>(property) Pool<A, E>.state: {
scope: Scope.Scope;
isShuttingDown: boolean;
semaphore: Semaphore.Semaphore;
resizeSemaphore: Semaphore.Semaphore;
items: Set<PoolItem<A, E>>;
available: Set<PoolItem<A, E>>;
availableLatch: Latch.Latch;
invalidated: Set<PoolItem<A, E>>;
waiters: number;
}
state.State<A, E>.items: Set<PoolItem<A, E>>items) {
if (const poolItem: PoolItem<A, E>const poolItem: {
exit: Exit.Exit<A, E>;
finalizer: Effect.Effect<void>;
refCount: number;
disableReclaim: boolean;
}
poolItem.PoolItem<A, E>.exit: Exit.Exit<A, E>exit._tag === "Success" && const poolItem: PoolItem<A, E>const poolItem: {
exit: Exit.Exit<A, E>;
finalizer: Effect.Effect<void>;
refCount: number;
disableReclaim: boolean;
}
poolItem.PoolItem<A, E>.exit: Exit.Exit<A, E>(property) PoolItem<A, E>.exit: {
_tag: "Success";
value: A;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
exit.value === item: Aitem) {
const poolItem: PoolItem<A, E>const poolItem: {
exit: Exit.Exit<A, E>;
finalizer: Effect.Effect<void>;
refCount: number;
disableReclaim: boolean;
}
poolItem.PoolItem<A, E>.disableReclaim: booleandisableReclaim = true
return import EffectEffect.uninterruptible(const invalidatePoolItem: <A, E>(
self: Pool<A, E>,
poolItem: PoolItem<A, E>
) => Effect.Effect<void>
invalidatePoolItem(self: Pool<A, E>(parameter) self: {
config: Config<A, E>;
state: State<A, E>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
self, const poolItem: PoolItem<A, E>const poolItem: {
exit: Exit.Exit<A, E>;
finalizer: Effect.Effect<void>;
refCount: number;
disableReclaim: boolean;
}
poolItem))
}
}
return import EffectEffect.void
}))