Strategy<A, E>Strategy used by a Pool to manage background resizing and item
reclamation.
When to use
Use when defining a custom pool lifecycle policy that needs to run background work, observe acquired items, or choose items for reclamation.
Details
run starts any strategy-specific background work, onAcquire is invoked
when an item is acquired, and reclaim selects an item that can be removed
or replaced.
export interface interface Strategy<A, E>Strategy used by a Pool to manage background resizing and item
reclamation.
When to use
Use when defining a custom pool lifecycle policy that needs to run background
work, observe acquired items, or choose items for reclamation.
Details
run starts any strategy-specific background work, onAcquire is invoked
when an item is acquired, and reclaim selects an item that can be removed
or replaced.
Strategy<function (type parameter) A in Strategy<A, E>A, function (type parameter) E in Strategy<A, E>E> {
readonly Strategy<A, E>.run: (pool: Pool<A, E>) => Effect.Effect<void>run: (pool: Pool<A, E>(parameter) pool: {
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; <…;
}
pool: 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 Strategy<A, E>A, function (type parameter) E in Strategy<A, E>E>) => import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<void>
readonly Strategy<A, E>.onAcquire: (item: PoolItem<A, E>) => Effect.Effect<void>onAcquire: (item: PoolItem<A, E>(parameter) item: {
exit: Exit.Exit<A, E>;
finalizer: Effect.Effect<void>;
refCount: number;
disableReclaim: boolean;
}
item: interface PoolItem<A, E>Internal record for a value managed by a Pool.
When to use
Use when implementing a custom pool Strategy that needs to inspect
acquired items, track reference counts, or return reclaimable items to the
pool.
Details
Each item stores the acquisition Exit, its finalizer, the current
reference count, and whether automatic reclaiming has been disabled because
the item was invalidated.
PoolItem<function (type parameter) A in Strategy<A, E>A, function (type parameter) E in Strategy<A, E>E>) => import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<void>
readonly Strategy<A, E>.reclaim: (pool: Pool<A, E>) => Effect.Effect<PoolItem<A, E> | undefined>reclaim: (pool: Pool<A, E>(parameter) pool: {
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; <…;
}
pool: 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 Strategy<A, E>A, function (type parameter) E in Strategy<A, E>E>) => import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<interface PoolItem<A, E>Internal record for a value managed by a Pool.
When to use
Use when implementing a custom pool Strategy that needs to inspect
acquired items, track reference counts, or return reclaimable items to the
pool.
Details
Each item stores the acquisition Exit, its finalizer, the current
reference count, and whether automatic reclaiming has been disabled because
the item was invalidated.
PoolItem<function (type parameter) A in Strategy<A, E>A, function (type parameter) E in Strategy<A, E>E> | undefined>
}