Config<A, E>Normalized configuration used by a Pool.
When to use
Use as the normalized, read-only description of how a pool acquires, sizes, shares, and resizes its items after construction.
Details
The config stores the acquire effect, size bounds, per-item concurrency, target utilization, and resizing strategy used by the pool implementation.
export interface interface Config<A, E>Normalized configuration used by a Pool.
When to use
Use as the normalized, read-only description of how a pool acquires, sizes,
shares, and resizes its items after construction.
Details
The config stores the acquire effect, size bounds, per-item concurrency,
target utilization, and resizing strategy used by the pool implementation.
Config<function (type parameter) A in Config<A, E>A, function (type parameter) E in Config<A, E>E> {
readonly Config<A, E>.acquire: Effect.Effect<A, E, Scope.Scope>(property) Config<A, E>.acquire: {
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;
}
acquire: import EffectEffect.interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<function (type parameter) A in Config<A, E>A, function (type parameter) E in Config<A, E>E, import ScopeScope.Scope>
readonly Config<A, E>.concurrency: numberconcurrency: number
readonly Config<A, E>.minSize: numberminSize: number
readonly Config<A, E>.maxSize: numbermaxSize: number
readonly Config<A, E>.strategy: Strategy<A, E>(property) Config<A, E>.strategy: {
run: (pool: Pool<A, E>) => Effect.Effect<void>;
onAcquire: (item: PoolItem<A, E>) => Effect.Effect<void>;
reclaim: (pool: Pool<A, E>) => Effect.Effect<PoolItem<A, E> | undefined>;
}
strategy: 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 Config<A, E>A, function (type parameter) E in Config<A, E>E>
readonly Config<A, E>.targetUtilization: numbertargetUtilization: number
}