@milaboratories/pl-middle-layer 1.37.76 → 1.37.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -39
- package/dist/index.mjs.map +1 -1
- package/dist/pool/driver.d.ts +7 -5
- package/dist/pool/driver.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/pool/driver.ts +55 -48
package/dist/index.mjs
CHANGED
|
@@ -5299,24 +5299,24 @@ class Vc {
|
|
|
5299
5299
|
}
|
|
5300
5300
|
class Uc {
|
|
5301
5301
|
constructor(e, t) {
|
|
5302
|
-
this.
|
|
5302
|
+
this.pTable = e, this.abortController = t;
|
|
5303
5303
|
}
|
|
5304
5304
|
get disposeSignal() {
|
|
5305
5305
|
return this.abortController.signal;
|
|
5306
5306
|
}
|
|
5307
5307
|
[Symbol.dispose]() {
|
|
5308
|
-
this.abortController.abort(), this.
|
|
5308
|
+
this.abortController.abort(), this.pTable.dispose();
|
|
5309
5309
|
}
|
|
5310
5310
|
}
|
|
5311
5311
|
class Dr {
|
|
5312
5312
|
constructor(e, t, r) {
|
|
5313
5313
|
k(this, "pFrames");
|
|
5314
5314
|
k(this, "pTables");
|
|
5315
|
-
k(this, "
|
|
5316
|
-
k(this, "
|
|
5315
|
+
k(this, "frameConcurrencyLimiter");
|
|
5316
|
+
k(this, "tableConcurrencyLimiter");
|
|
5317
5317
|
this.blobDriver = e, this.logger = t, this.spillPath = r;
|
|
5318
5318
|
const n = new Gr(1);
|
|
5319
|
-
this.
|
|
5319
|
+
this.frameConcurrencyLimiter = n, this.tableConcurrencyLimiter = new Gr(1), this.pFrames = new class extends tn {
|
|
5320
5320
|
constructor(o, i, l) {
|
|
5321
5321
|
super(), this.blobDriver = o, this.logger = i, this.spillPath = l;
|
|
5322
5322
|
}
|
|
@@ -5337,22 +5337,17 @@ class Dr {
|
|
|
5337
5337
|
ne().logPFrameRequests && t.info(
|
|
5338
5338
|
`PTable creation (pTableHandle = ${this.calculateParamsKey(o)}): ${JSON.stringify(o, Te)}`
|
|
5339
5339
|
);
|
|
5340
|
-
const l = this.pFrames.getByKey(i), c = new AbortController(), a =
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
const d = await l.pFrame.createTable({
|
|
5344
|
-
src: Be(o.def.src),
|
|
5345
|
-
filters: cr(o.def.filters)
|
|
5346
|
-
}, a);
|
|
5347
|
-
let p = d;
|
|
5348
|
-
if (o.def.sorting.length > 0)
|
|
5349
|
-
try {
|
|
5350
|
-
p = await d.sort(o.def.sorting, a);
|
|
5351
|
-
} finally {
|
|
5352
|
-
d.dispose();
|
|
5353
|
-
}
|
|
5354
|
-
return p;
|
|
5340
|
+
const l = this.pFrames.getByKey(i), c = new AbortController(), a = l.pFrame.createTable({
|
|
5341
|
+
src: Be(o.def.src),
|
|
5342
|
+
filters: cr(o.def.filters)
|
|
5355
5343
|
});
|
|
5344
|
+
let u = a;
|
|
5345
|
+
if (o.def.sorting.length > 0)
|
|
5346
|
+
try {
|
|
5347
|
+
u = a.sort(o.def.sorting);
|
|
5348
|
+
} finally {
|
|
5349
|
+
a.dispose();
|
|
5350
|
+
}
|
|
5356
5351
|
return new Uc(u, c);
|
|
5357
5352
|
}
|
|
5358
5353
|
calculateParamsKey(o) {
|
|
@@ -5379,14 +5374,14 @@ class Dr {
|
|
|
5379
5374
|
), n = this.pFrames.acquire(r);
|
|
5380
5375
|
return t.addOnDestroy(n.unref), n.key;
|
|
5381
5376
|
}
|
|
5382
|
-
createPTable(e, t
|
|
5383
|
-
const
|
|
5377
|
+
createPTable(e, t) {
|
|
5378
|
+
const r = this.createPFrame(oo(e.src), t), n = lr(e, (i) => i.id), o = this.pTables.acquire({ def: n, pFrameHandle: r });
|
|
5384
5379
|
return ne().logPFrameRequests && this.logger.info(
|
|
5385
|
-
`Create PTable call (pFrameHandle = ${
|
|
5386
|
-
lr(e, (
|
|
5380
|
+
`Create PTable call (pFrameHandle = ${r}; pTableHandle = ${JSON.stringify(o)}): ${JSON.stringify(
|
|
5381
|
+
lr(e, (i) => i.spec),
|
|
5387
5382
|
Te
|
|
5388
5383
|
)}`
|
|
5389
|
-
), t.addOnDestroy(
|
|
5384
|
+
), t.addOnDestroy(o.unref), o.key;
|
|
5390
5385
|
}
|
|
5391
5386
|
//
|
|
5392
5387
|
// PFrame istance methods
|
|
@@ -5419,20 +5414,23 @@ class Dr {
|
|
|
5419
5414
|
async calculateTableData(e, t, r, n) {
|
|
5420
5415
|
return ne().logPFrameRequests && this.logger.info(
|
|
5421
5416
|
`Call calculateTableData, handle = ${e}, request = ${JSON.stringify(t, Te)}`
|
|
5422
|
-
), await this.
|
|
5423
|
-
const o = this.pFrames.getByKey(e), i = AbortSignal.any([n, o.disposeSignal].filter((a) => !!a)), l =
|
|
5417
|
+
), await this.frameConcurrencyLimiter.run(async () => {
|
|
5418
|
+
const o = this.pFrames.getByKey(e), i = AbortSignal.any([n, o.disposeSignal].filter((a) => !!a)), l = o.pFrame.createTable({
|
|
5424
5419
|
src: Be(t.src),
|
|
5425
5420
|
filters: cr(t.filters)
|
|
5426
|
-
}
|
|
5421
|
+
});
|
|
5427
5422
|
let c = l;
|
|
5428
5423
|
if (t.sorting.length > 0)
|
|
5429
5424
|
try {
|
|
5430
|
-
c =
|
|
5425
|
+
c = l.sort(t.sorting);
|
|
5431
5426
|
} finally {
|
|
5432
5427
|
l.dispose();
|
|
5433
5428
|
}
|
|
5434
5429
|
try {
|
|
5435
|
-
const a = c.getSpec(), u = await c.getData([...a.keys()],
|
|
5430
|
+
const a = c.getSpec(), u = await c.getData([...a.keys()], {
|
|
5431
|
+
range: r,
|
|
5432
|
+
signal: i
|
|
5433
|
+
});
|
|
5436
5434
|
return a.map((d, p) => ({
|
|
5437
5435
|
spec: d,
|
|
5438
5436
|
data: u[p]
|
|
@@ -5445,27 +5443,35 @@ class Dr {
|
|
|
5445
5443
|
async getUniqueValues(e, t, r) {
|
|
5446
5444
|
return ne().logPFrameRequests && this.logger.info(
|
|
5447
5445
|
`Call getUniqueValues, handle = ${e}, request = ${JSON.stringify(t, Te)}`
|
|
5448
|
-
), await this.
|
|
5446
|
+
), await this.frameConcurrencyLimiter.run(async () => {
|
|
5449
5447
|
const n = this.pFrames.getByKey(e), o = AbortSignal.any([r, n.disposeSignal].filter((i) => !!i));
|
|
5450
5448
|
return await n.pFrame.getUniqueValues({
|
|
5451
5449
|
...t,
|
|
5452
5450
|
filters: cr(t.filters)
|
|
5453
|
-
},
|
|
5451
|
+
}, {
|
|
5452
|
+
signal: o
|
|
5453
|
+
});
|
|
5454
5454
|
});
|
|
5455
5455
|
}
|
|
5456
5456
|
//
|
|
5457
5457
|
// PTable istance methods
|
|
5458
5458
|
//
|
|
5459
|
-
|
|
5460
|
-
|
|
5459
|
+
getSpec(e) {
|
|
5460
|
+
const t = this.pTables.getByKey(e).pTable;
|
|
5461
|
+
return Promise.resolve(t.getSpec());
|
|
5461
5462
|
}
|
|
5462
|
-
async
|
|
5463
|
-
return (await this.pTables.getByKey(e).
|
|
5463
|
+
async getShape(e, t) {
|
|
5464
|
+
return await this.tableConcurrencyLimiter.run(async () => await this.pTables.getByKey(e).pTable.getShape({
|
|
5465
|
+
signal: t
|
|
5466
|
+
}));
|
|
5464
5467
|
}
|
|
5465
5468
|
async getData(e, t, r, n) {
|
|
5466
|
-
return await this.
|
|
5467
|
-
const o = this.pTables.getByKey(e), i =
|
|
5468
|
-
return await
|
|
5469
|
+
return await this.tableConcurrencyLimiter.run(async () => {
|
|
5470
|
+
const o = this.pTables.getByKey(e), i = AbortSignal.any([n, o.disposeSignal].filter((l) => !!l));
|
|
5471
|
+
return await o.pTable.getData(t, {
|
|
5472
|
+
range: r,
|
|
5473
|
+
signal: i
|
|
5474
|
+
});
|
|
5469
5475
|
});
|
|
5470
5476
|
}
|
|
5471
5477
|
}
|