import type * as CL from "../Clock/index.js"; import * as HS from "../Collections/Immutable/HashSet/index.js"; import * as Tp from "../Collections/Immutable/Tuple/index.js"; import * as T from "../Effect/index.js"; import * as Ex from "../Exit/index.js"; import * as M from "../Managed/index.js"; import * as Q from "../Queue/index.js"; import * as Ref from "../Ref/index.js"; import * as AT from "./Attempted.js"; import * as STR from "./Strategy.js"; declare abstract class Pool { readonly [T._E]: () => Error; readonly [T._A]: () => Item; } declare abstract class PoolInternal extends Pool { readonly [T._E]: () => Error; readonly [T._A]: () => Item; abstract get(): M.IO; abstract invalidate(item: Item): T.UIO; } export declare function get(self: Pool): M.IO; export declare function invalidate_(self: Pool, item: Item): T.UIO; export declare function invalidate(item: Item): (self: Pool) => T.UIO; export declare type Range = Tp.Tuple<[begin: number, end: number]>; interface State { readonly size: number; readonly free: number; } export declare class DefaultPool extends PoolInternal { readonly creator: M.IO; readonly range: Range; readonly isShuttingDown: Ref.Ref; readonly state: Ref.Ref; readonly items: Q.Queue>; readonly invalidated: Ref.Ref>; readonly track: (exit: Ex.Exit) => T.UIO; constructor(creator: M.IO, range: Range, isShuttingDown: Ref.Ref, state: Ref.Ref, items: Q.Queue>, invalidated: Ref.Ref>, track: (exit: Ex.Exit) => T.UIO); /** * Returns the number of items in the pool in excess of the minimum size. */ excess(): T.UIO; get(): M.IO; /** * Begins pre-allocating pool entries based on minimum pool size. */ initialize(): T.UIO; invalidate(item: A): T.UIO; /** * Shrinks the pool down, but never to less than the minimum size. */ shrink(): T.UIO; allocate(): T.UIO; /** * Gets items from the pool and shuts them down as long as there are items * free, signalling shutdown of the pool if the pool is empty. */ getAndShutdown(): T.UIO; shutdown(): T.UIO; } /** * Creates a pool from a fixed number of pre-allocated items. This method * should only be used when there is no cleanup or release operation * associated with items in the pool. If cleanup or release is required, * then the `make` constructor should be used instead. */ export declare function fromIterable(iterable0: Iterable): M.UIO>>; /** * Makes a new pool of the specified fixed size. The pool is returned in a * `Managed`, which governs the lifetime of the pool. When the pool is * shutdown because the `Managed` is used, the individual items allocated by * the pool will be released in some unspecified order. */ export declare function makeFixed(get: M.Managed, min: number): M.RIO>; /** * Makes a new pool with the specified minimum and maximum sizes and time to * live before a pool whose excess items are not being used will be shrunk * down to the minimum size. The pool is returned in a `Managed`, which * governs the lifetime of the pool. When the pool is shutdown because the * `Managed` is used, the individual items allocated by the pool will be * released in some unspecified order. */ export declare function make(get: M.IO, range: Range, timeToLive: number): M.RIO>; /** * A more powerful variant of `make` that allows specifying a `Strategy` that * describes how a pool whose excess items are not being used will be shrunk * down to the minimum size. */ export declare function makeWith(get: M.Managed, range: Range, strategy: STR.Strategy): M.RIO>; export {}; //# sourceMappingURL=Pool.d.ts.map