@milaboratories/pl-middle-layer 1.27.8 → 1.27.9
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 +128 -120
- package/dist/index.mjs.map +1 -1
- package/dist/pool/driver.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/pool/driver.ts +46 -32
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/pool/driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,yBAAyB,CAAC;AAEhF,OAAO,KAAK,EAAE,aAAa,EAA2B,MAAM,4BAA4B,CAAC;AACzF,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EAEnB,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,IAAI,eAAe,EAC/B,OAAO,EACP,SAAS,EAET,SAAS,EAIT,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAS9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/pool/driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,yBAAyB,CAAC;AAEhF,OAAO,KAAK,EAAE,aAAa,EAA2B,MAAM,4BAA4B,CAAC;AACzF,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,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BAAyB,CAAC,SAAS,CAAC,GAC5C,OAAO,CAAC,0BAA0B,CAAC;IAiCzB,eAAe,CAC1B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IAkBnB,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAKpD,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAK1D,OAAO,CAClB,MAAM,EAAE,YAAY,EACpB,aAAa,EAAE,MAAM,EAAE,EACvB,KAAK,CAAC,EAAE,UAAU,GACjB,OAAO,CAAC,YAAY,EAAE,CAAC;CAM3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-middle-layer",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.9",
|
|
4
4
|
"description": "Pl Middle Layer",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"@milaboratories/pl-drivers": "^1.5.16",
|
|
36
36
|
"@platforma-sdk/block-tools": "^2.5.9",
|
|
37
37
|
"@milaboratories/pl-client": "^2.7.4",
|
|
38
|
-
"@milaboratories/pl-model-middle-layer": "^1.7.2",
|
|
39
38
|
"@milaboratories/pl-model-common": "^1.10.5",
|
|
40
|
-
"@milaboratories/pl-model-
|
|
39
|
+
"@milaboratories/pl-model-middle-layer": "^1.7.2",
|
|
41
40
|
"@milaboratories/pl-tree": "^1.4.23",
|
|
41
|
+
"@milaboratories/pl-model-backend": "^1.0.1",
|
|
42
42
|
"@platforma-sdk/model": "^1.22.18",
|
|
43
|
-
"@milaboratories/
|
|
43
|
+
"@milaboratories/ts-helpers": "^1.1.3",
|
|
44
44
|
"@milaboratories/pl-deployments": "^1.1.3",
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
45
|
+
"@milaboratories/pl-config": "^1.4.0",
|
|
46
|
+
"@platforma-sdk/workflow-tengo": "2.9.10"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"semver": "^7.6.3",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"jest": "^29.7.0",
|
|
56
56
|
"@jest/globals": "^29.7.0",
|
|
57
57
|
"ts-jest": "^29.2.5",
|
|
58
|
-
"@milaboratories/
|
|
59
|
-
"@milaboratories/
|
|
58
|
+
"@milaboratories/eslint-config": "^1.0.1",
|
|
59
|
+
"@milaboratories/platforma-build-configs": "1.0.2"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"type-check": "tsc --noEmit --composite false",
|
package/src/pool/driver.ts
CHANGED
|
@@ -81,6 +81,7 @@ function migrateFilters(filters: PTableRecordFilter[]): PTableRecordSingleValueF
|
|
|
81
81
|
const bigintReplacer = (_: string, v: unknown) => (typeof v === 'bigint' ? v.toString() : v);
|
|
82
82
|
|
|
83
83
|
class PFrameHolder implements PFrameInternal.PFrameDataSource, Disposable {
|
|
84
|
+
public readonly rustPFrame: PFrameInternal.PFrameV2;
|
|
84
85
|
public readonly specPFrame: PFrameInternal.PFrameV2;
|
|
85
86
|
private readonly blobIdToResource = new Map<string, ResourceInfo>();
|
|
86
87
|
private readonly blobHandleComputables = new Map<
|
|
@@ -131,35 +132,43 @@ class PFrameHolder implements PFrameInternal.PFrameDataSource, Disposable {
|
|
|
131
132
|
)).values(),
|
|
132
133
|
];
|
|
133
134
|
|
|
134
|
-
|
|
135
|
+
this.rustPFrame = ((): PFrameInternal.PFrameV2 => {
|
|
135
136
|
try {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
const pFrame = new PFrameRs(getDebugFlags().logPFrameRequests ? logFunc : undefined);
|
|
138
|
+
pFrame.setDataSource(this);
|
|
139
|
+
for (const column of distinct_columns) {
|
|
140
|
+
pFrame.addColumnSpec(column.id, column.spec);
|
|
141
|
+
pFrame.setColumnData(column.id, column.data);
|
|
142
|
+
}
|
|
143
|
+
return pFrame;
|
|
144
|
+
} catch (err: unknown) {
|
|
145
|
+
throw new Error(
|
|
146
|
+
`Rust PFrame creation failed, columns: ${JSON.stringify(distinct_columns)}, error: ${err as Error}`,
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
})();
|
|
150
|
+
|
|
151
|
+
this.specPFrame = ((): PFrameInternal.PFrameV2 => {
|
|
152
|
+
try {
|
|
153
|
+
const pFrame = getDebugFlags().logPFrameRequests ? new PFrame(logFunc) : new PFrame();
|
|
154
|
+
for (const column of distinct_columns) {
|
|
155
|
+
try {
|
|
139
156
|
pFrame.addColumnSpec(column.id, column.spec);
|
|
157
|
+
} catch (err: unknown) {
|
|
158
|
+
throw new Error(
|
|
159
|
+
`Adding column ${column.id} to PFrame failed: ${err as Error}; Spec: ${JSON.stringify(column.spec)}.`,
|
|
160
|
+
);
|
|
140
161
|
}
|
|
141
|
-
return pFrame;
|
|
142
|
-
} else {
|
|
143
|
-
const pFrame = getDebugFlags().logPFrameRequests ? new PFrame(logFunc) : new PFrame();
|
|
144
|
-
for (const column of distinct_columns) {
|
|
145
|
-
try {
|
|
146
|
-
pFrame.addColumnSpec(column.id, column.spec);
|
|
147
|
-
} catch (err: unknown) {
|
|
148
|
-
throw new Error(
|
|
149
|
-
`Adding column ${column.id} to PFrame failed: ${err as Error}; Spec: ${JSON.stringify(column.spec)}.`,
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return pFrame;
|
|
154
162
|
}
|
|
163
|
+
return pFrame;
|
|
155
164
|
} catch (err: unknown) {
|
|
156
165
|
throw new Error(
|
|
157
166
|
`Spec PFrame creation failed, columns: ${JSON.stringify(distinct_columns)}, error: ${err as Error}`,
|
|
158
167
|
);
|
|
159
168
|
}
|
|
160
|
-
};
|
|
169
|
+
})();
|
|
161
170
|
|
|
162
|
-
|
|
171
|
+
this.createDataPFrame = (): PFrameInternal.PFrameV2 => {
|
|
163
172
|
try {
|
|
164
173
|
const pFrame = getDebugFlags().logPFrameRequests ? new PFrame(logFunc) : new PFrame();
|
|
165
174
|
pFrame.setDataSource(this);
|
|
@@ -180,9 +189,6 @@ class PFrameHolder implements PFrameInternal.PFrameDataSource, Disposable {
|
|
|
180
189
|
);
|
|
181
190
|
}
|
|
182
191
|
};
|
|
183
|
-
|
|
184
|
-
this.specPFrame = createSpecPFrame();
|
|
185
|
-
this.createDataPFrame = createDataPFrame;
|
|
186
192
|
}
|
|
187
193
|
|
|
188
194
|
private getOrCreateComputableForBlob(blobId: string) {
|
|
@@ -224,6 +230,7 @@ class PFrameHolder implements PFrameInternal.PFrameDataSource, Disposable {
|
|
|
224
230
|
|
|
225
231
|
[Symbol.dispose](): void {
|
|
226
232
|
for (const computable of this.blobHandleComputables.values()) computable.resetState();
|
|
233
|
+
this.rustPFrame.dispose();
|
|
227
234
|
this.specPFrame.dispose();
|
|
228
235
|
}
|
|
229
236
|
}
|
|
@@ -249,8 +256,9 @@ export class PFrameDriver implements SdkPFrameDriver {
|
|
|
249
256
|
fetchMethod: async (key) => await fsp.readFile(key),
|
|
250
257
|
sizeCalculation: (v) => v.length,
|
|
251
258
|
});
|
|
252
|
-
const concurrencyLimiter = new ConcurrencyLimitingExecutor(1);
|
|
253
259
|
this.blobContentCache = blobContentCache;
|
|
260
|
+
|
|
261
|
+
const concurrencyLimiter = new ConcurrencyLimitingExecutor(1);
|
|
254
262
|
this.concurrencyLimiter = concurrencyLimiter;
|
|
255
263
|
|
|
256
264
|
this.pFrames = new (class extends RefCountResourcePool<InternalPFrameData, PFrameHolder> {
|
|
@@ -366,9 +374,11 @@ export class PFrameDriver implements SdkPFrameDriver {
|
|
|
366
374
|
}]
|
|
367
375
|
: [],
|
|
368
376
|
};
|
|
369
|
-
const responce =
|
|
370
|
-
|
|
371
|
-
|
|
377
|
+
const responce = getDebugFlags().usePFrameRs
|
|
378
|
+
? await this.pFrames.getByKey(handle).rustPFrame.findColumns(iRequest)
|
|
379
|
+
: await this.concurrencyLimiter.run(
|
|
380
|
+
async () => await this.pFrames.getByKey(handle).specPFrame.findColumns(iRequest),
|
|
381
|
+
);
|
|
372
382
|
return {
|
|
373
383
|
hits: responce.hits
|
|
374
384
|
.filter((h) => // only exactly matching columns
|
|
@@ -381,15 +391,19 @@ export class PFrameDriver implements SdkPFrameDriver {
|
|
|
381
391
|
}
|
|
382
392
|
|
|
383
393
|
public async getColumnSpec(handle: PFrameHandle, columnId: PObjectId): Promise<PColumnSpec> {
|
|
384
|
-
return
|
|
385
|
-
|
|
386
|
-
|
|
394
|
+
return getDebugFlags().usePFrameRs
|
|
395
|
+
? await this.pFrames.getByKey(handle).rustPFrame.getColumnSpec(columnId)
|
|
396
|
+
: await this.concurrencyLimiter.run(
|
|
397
|
+
async () => await this.pFrames.getByKey(handle).specPFrame.getColumnSpec(columnId),
|
|
398
|
+
);
|
|
387
399
|
}
|
|
388
400
|
|
|
389
401
|
public async listColumns(handle: PFrameHandle): Promise<PColumnIdAndSpec[]> {
|
|
390
|
-
return
|
|
391
|
-
|
|
392
|
-
|
|
402
|
+
return getDebugFlags().usePFrameRs
|
|
403
|
+
? await this.pFrames.getByKey(handle).rustPFrame.listColumns()
|
|
404
|
+
: await this.concurrencyLimiter.run(
|
|
405
|
+
async () => await this.pFrames.getByKey(handle).specPFrame.listColumns(),
|
|
406
|
+
);
|
|
393
407
|
}
|
|
394
408
|
|
|
395
409
|
public async calculateTableData(
|