Добавлена ДБ
This commit is contained in:
107
node_modules/effect/dist/cjs/Pool.js
generated
vendored
Normal file
107
node_modules/effect/dist/cjs/Pool.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.makeWithTTL = exports.make = exports.isPool = exports.invalidate = exports.get = exports.PoolTypeId = void 0;
|
||||
var internal = _interopRequireWildcard(require("./internal/pool.js"));
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
/**
|
||||
* @since 2.0.0
|
||||
* @category symbols
|
||||
*/
|
||||
const PoolTypeId = exports.PoolTypeId = internal.PoolTypeId;
|
||||
/**
|
||||
* Returns `true` if the specified value is a `Pool`, `false` otherwise.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @category refinements
|
||||
*/
|
||||
const isPool = exports.isPool = internal.isPool;
|
||||
/**
|
||||
* Makes a new pool of the specified fixed size. The pool is returned in a
|
||||
* `Scope`, which governs the lifetime of the pool. When the pool is shutdown
|
||||
* because the `Scope` is closed, the individual items allocated by the pool
|
||||
* will be released in some unspecified order.
|
||||
*
|
||||
* By setting the `concurrency` parameter, you can control the level of concurrent
|
||||
* access per pool item. By default, the number of permits is set to `1`.
|
||||
*
|
||||
* `targetUtilization` determines when to create new pool items. It is a value
|
||||
* between 0 and 1, where 1 means only create new pool items when all the existing
|
||||
* items are fully utilized.
|
||||
*
|
||||
* A `targetUtilization` of 0.5 will create new pool items when the existing items are
|
||||
* 50% utilized.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @category constructors
|
||||
*/
|
||||
const make = exports.make = internal.make;
|
||||
/**
|
||||
* 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 `Scope`, which governs
|
||||
* the lifetime of the pool. When the pool is shutdown because the `Scope` is
|
||||
* used, the individual items allocated by the pool will be released in some
|
||||
* unspecified order.
|
||||
*
|
||||
* By setting the `concurrency` parameter, you can control the level of concurrent
|
||||
* access per pool item. By default, the number of permits is set to `1`.
|
||||
*
|
||||
* `targetUtilization` determines when to create new pool items. It is a value
|
||||
* between 0 and 1, where 1 means only create new pool items when all the existing
|
||||
* items are fully utilized.
|
||||
*
|
||||
* A `targetUtilization` of 0.5 will create new pool items when the existing items are
|
||||
* 50% utilized.
|
||||
*
|
||||
* The `timeToLiveStrategy` determines how items are invalidated. If set to
|
||||
* "creation", then items are invalidated based on their creation time. If set
|
||||
* to "usage", then items are invalidated based on pool usage.
|
||||
*
|
||||
* By default, the `timeToLiveStrategy` is set to "usage".
|
||||
*
|
||||
* ```ts skip-type-checking
|
||||
* import { createConnection } from "mysql2";
|
||||
* import { Duration, Effect, Pool } from "effect"
|
||||
*
|
||||
* const acquireDBConnection = Effect.acquireRelease(
|
||||
* Effect.sync(() => createConnection('mysql://...')),
|
||||
* (connection) => Effect.sync(() => connection.end(() => {})),
|
||||
* )
|
||||
*
|
||||
* const connectionPool = Effect.flatMap(
|
||||
* Pool.makeWithTTL({
|
||||
* acquire: acquireDBConnection,
|
||||
* min: 10,
|
||||
* max: 20,
|
||||
* timeToLive: Duration.seconds(60)
|
||||
* }),
|
||||
* (pool) => pool.get
|
||||
* )
|
||||
* ```
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @category constructors
|
||||
*/
|
||||
const makeWithTTL = exports.makeWithTTL = internal.makeWithTTL;
|
||||
/**
|
||||
* Retrieves an item from the pool in a scoped effect. Note that if
|
||||
* acquisition fails, then the returned effect will fail for that same reason.
|
||||
* Retrying a failed acquisition attempt will repeat the acquisition attempt.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @category getters
|
||||
*/
|
||||
const get = exports.get = internal.get;
|
||||
/**
|
||||
* Invalidates the specified item. This will cause the pool to eventually
|
||||
* reallocate the item, although this reallocation may occur lazily rather
|
||||
* than eagerly.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @category combinators
|
||||
*/
|
||||
const invalidate = exports.invalidate = internal.invalidate;
|
||||
//# sourceMappingURL=Pool.js.map
|
||||
Reference in New Issue
Block a user