@milaboratories/pl-model-middle-layer 1.8.16 → 1.8.17

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.
@@ -1,4 +1,5 @@
1
- import { BinaryPartitionedDataInfo, JsonDataInfo, JsonPartitionedDataInfo, ParquetChunk, ParquetPartitionedDataInfo, PColumnSpec, PObjectId } from '@milaboratories/pl-model-common';
1
+ import { Base64Encoded, BinaryPartitionedDataInfo, JsonDataInfo, JsonPartitionedDataInfo, ParquetChunk, ParquetPartitionedDataInfo, PColumnSpec, PObjectId } from '@milaboratories/pl-model-common';
2
+ import { HttpAuthorizationToken, ObjectStoreUrl, PemCertificate } from './http_helpers';
2
3
  /** Abstract identifier of a data blob that can be requested from the storage backend */
3
4
  export type PFrameBlobId = string;
4
5
  /** Path of the file containing requested data (blob). This path is returned by
@@ -15,6 +16,31 @@ export type PFrameDataSource = {
15
16
  /** Returns raw blob data given the blob id from {@link DataInfo}. */
16
17
  resolveBlobContent(blobId: PFrameBlobId): Promise<Uint8Array>;
17
18
  };
19
+ /** Parquet HTTP(S) server connection settings, {@link HttpHelpers.createHttpServer} */
20
+ export type ParquetServerConfig = {
21
+ /** URL of the parquet HTTP(S) server */
22
+ url: ObjectStoreUrl;
23
+ /** Authorization token for Bearer scheme */
24
+ authToken?: HttpAuthorizationToken;
25
+ /** CA certificate of HTTPS server */
26
+ caCert?: Base64Encoded<PemCertificate>;
27
+ };
28
+ /** Data source allows PFrame to retrieve the data blobs for columns with assigned data info. */
29
+ export interface PFrameDataSourceV2 {
30
+ /**
31
+ * PFrame may notify storage backend about its plans to use particular blobs in the future.
32
+ * Storage backend will do its best to preload specified blob so the subsequent
33
+ * {@link resolveBlob} will quickly return preloaded file path.
34
+ */
35
+ preloadBlob(blobIds: PFrameBlobId[]): Promise<void>;
36
+ /** Returns raw blob data given the blob id from {@link DataInfo}. */
37
+ resolveBlobContent(blobId: PFrameBlobId): Promise<Uint8Array>;
38
+ /**
39
+ * Parquet HTTP(S) server connection settings, {@link HttpHelpers.createHttpServer}
40
+ * When not provided, parquet BlobIds would be treated as local file paths.
41
+ */
42
+ parquetServer?: ParquetServerConfig;
43
+ }
18
44
  /**
19
45
  * Union type representing all possible data storage formats for PColumn data.
20
46
  * The specific format used depends on data size, access patterns, and performance requirements.
@@ -24,12 +50,15 @@ export type PFrameDataSource = {
24
50
  export type DataInfo<Blob> = JsonDataInfo | JsonPartitionedDataInfo<Blob> | BinaryPartitionedDataInfo<Blob> | ParquetPartitionedDataInfo<ParquetChunk<Blob>>;
25
51
  /** API exposed by PFrames library allowing to create and provide data for
26
52
  * PFrame objects */
27
- export interface PFrameFactoryAPIV2 {
53
+ export interface PFrameFactoryAPIV3 extends Disposable {
28
54
  /** Associates data source with this PFrame */
29
55
  setDataSource(dataSource: PFrameDataSource): void;
30
- /** Adds PColumn without spec */
56
+ /** Adds PColumn without data info */
31
57
  addColumnSpec(columnId: PObjectId, columnSpec: PColumnSpec): void;
32
- /** Associates data info with cpecific column */
58
+ /**
59
+ * Assign data info to the specified PColumn.
60
+ * For parquet data info, schema resolution via network is performed during this call.
61
+ */
33
62
  setColumnData(columnId: PObjectId, dataInfo: DataInfo<PFrameBlobId>, options?: {
34
63
  signal?: AbortSignal;
35
64
  }): Promise<void>;
@@ -39,9 +68,9 @@ export interface PFrameFactoryAPIV2 {
39
68
  }
40
69
  /** API exposed by PFrames library allowing to create and provide data for
41
70
  * PFrame objects */
42
- export interface PFrameFactoryAPIV3 extends Disposable {
71
+ export interface PFrameFactoryAPIV4 extends Disposable {
43
72
  /** Associates data source with this PFrame */
44
- setDataSource(dataSource: PFrameDataSource): void;
73
+ setDataSource(dataSource: PFrameDataSourceV2): void;
45
74
  /** Adds PColumn without data info */
46
75
  addColumnSpec(columnId: PObjectId, columnSpec: PColumnSpec): void;
47
76
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"api_factory.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api/api_factory.ts"],"names":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S,EACnB,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,EAChC,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GACA,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;wEACoE;IACpE,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -2,31 +2,7 @@ import { FindColumnsRequest, FindColumnsResponse } from './find_columns';
2
2
  import { DeleteColumnFromColumnsRequest, DeleteColumnFromColumnsResponse } from './delete_column';
3
3
  import { PColumnInfo, PColumnSpec, PObjectId, UniqueValuesRequest, UniqueValuesResponse } from '@milaboratories/pl-model-common';
4
4
  import { CreateTableRequestV3 } from './create_table';
5
- import { PTableV6, PTableV7 } from './table';
6
- /** Read interface exposed by PFrames library */
7
- export interface PFrameReadAPIV8 {
8
- /**
9
- * Finds columns given filtering criteria on column name, annotations etc.
10
- * and a set of qualified axes specs to find only columns with compatible
11
- * axes spec.
12
- *
13
- * Only column specs are used, this method will work even for columns
14
- * with no assigned data.
15
- * */
16
- findColumns(request: FindColumnsRequest): Promise<FindColumnsResponse>;
17
- /** To be reviewed in the future */
18
- deleteColumn(request: DeleteColumnFromColumnsRequest): Promise<DeleteColumnFromColumnsResponse>;
19
- /** Retrieve single column spec */
20
- getColumnSpec(columnId: PObjectId): Promise<PColumnSpec>;
21
- /** Retrieve information about all columns currently added to the PFrame */
22
- listColumns(): Promise<PColumnInfo[]>;
23
- /** Calculates data for the table and returns an object to access it */
24
- createTable(request: CreateTableRequestV3): PTableV6;
25
- /** Calculate set of unique values for a specific axis for the filtered set of records */
26
- getUniqueValues(request: UniqueValuesRequest, ops?: {
27
- signal?: AbortSignal;
28
- }): Promise<UniqueValuesResponse>;
29
- }
5
+ import { PTableV7 } from './table';
30
6
  /** Read interface exposed by PFrames library */
31
7
  export interface PFrameReadAPIV9 {
32
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"api_read.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api/api_read.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,oBAAoB,GAAG,QAAQ,CAAC;IAErD,yFAAyF;IACzF,eAAe,CACb,OAAO,EAAE,mBAAmB,EAC5B,GAAG,CAAC,EAAE;QACJ,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GACA,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAClC"}
@@ -1,10 +1,10 @@
1
- import type { PFrameFactoryAPIV2, PFrameFactoryAPIV3 } from './api_factory';
2
- import type { PFrameReadAPIV8, PFrameReadAPIV9 } from './api_read';
1
+ import type { PFrameFactoryAPIV3, PFrameFactoryAPIV4 } from './api_factory';
2
+ import type { PFrameReadAPIV9 } from './api_read';
3
3
  import type { Logger } from './common';
4
- export interface PFrameV9 extends PFrameFactoryAPIV2, PFrameReadAPIV8 {
5
- }
6
4
  export interface PFrameV10 extends PFrameFactoryAPIV3, PFrameReadAPIV9 {
7
5
  }
6
+ export interface PFrameV11 extends PFrameFactoryAPIV4, PFrameReadAPIV9 {
7
+ }
8
8
  export type PFrameOptions = {
9
9
  /** Path to directory where PFrame can create temporary files */
10
10
  spillPath: string;
@@ -27,4 +27,20 @@ export interface PFrameFactory {
27
27
  */
28
28
  pprofDump: () => Promise<Uint8Array>;
29
29
  }
30
+ /** List of PFrame management functions exposed by PFrame module */
31
+ export interface PFrameFactoryV2 {
32
+ /**
33
+ * Create a new PFrame instance.
34
+ * @warning Use concurrency limiting to avoid OOM crashes when multiple instances are simultaneously in use.
35
+ */
36
+ createPFrame(options: PFrameOptions): PFrameV11;
37
+ /**
38
+ * Dump active allocations from all PFrames instances in pprof format.
39
+ * The result of this function should be saved as `profile.pb.gz`.
40
+ * Use {@link https://pprof.me/} or {@link https://www.speedscope.app/}
41
+ * to view the allocation flamechart.
42
+ * @warning This method will always reject on Windows!
43
+ */
44
+ pprofDump: () => Promise<Uint8Array>;
45
+ }
30
46
  //# sourceMappingURL=pframe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pframe.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api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;IACH,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC;IAEhD;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;CACtC;AAED,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC;IAEhD;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;CACtC"}
@@ -1,58 +1,4 @@
1
1
  import { PTableColumnId, PTableColumnSpec, PTableRecordFilter, PTableShape, PTableSorting, PTableVector, TableRange } from '@milaboratories/pl-model-common';
2
- /**
3
- * Table view returned as a result of create table operation.
4
- *
5
- * PTable can be thought as having a composite primary key, consisting of axes,
6
- * and a set of data columns derived from PColumn values.
7
- * */
8
- export interface PTableV6 {
9
- /**
10
- * Returns ordered array of table axes specs (primary key "columns" in SQL
11
- * terms) and data column specs (regular "columns" in SQL terms).
12
- *
13
- * Data for a specific table column can be retrieved using unified indexing
14
- * corresponding to elements in this array.
15
- *
16
- * Axes are always listed first.
17
- * */
18
- getSpec(): PTableColumnSpec[];
19
- /** Transforms unified column identifiers into unified indices of columns. */
20
- getColumnIndices(columnIds: PTableColumnId[]): number[];
21
- /**
22
- * Get PTable disk footprint in bytes
23
- * Warning: This call materializes the join.
24
- */
25
- getFootprint(ops?: {
26
- withPredecessors?: boolean;
27
- signal?: AbortSignal;
28
- }): Promise<number>;
29
- /**
30
- * Unified table shape
31
- * Warning: This call materializes the join.
32
- */
33
- getShape(ops?: {
34
- signal?: AbortSignal;
35
- }): Promise<PTableShape>;
36
- /**
37
- * Retrieve the data from the table. To retrieve only data required, it can be
38
- * sliced both horizontally ({@link columnIndices}) and vertically
39
- * ({@link range}).
40
- * This call materializes the join.
41
- *
42
- * @param columnIndices unified indices of columns to be retrieved
43
- * @param range optionally limit the range of records to retrieve
44
- * */
45
- getData(columnIndices: number[], ops?: {
46
- range?: TableRange;
47
- signal?: AbortSignal;
48
- }): Promise<PTableVector[]>;
49
- /** Filters the table and returns new PTable instance */
50
- filter(request: PTableRecordFilter[]): PTableV6;
51
- /** Sorts the table and returns new PTable instance. */
52
- sort(request: PTableSorting[]): PTableV6;
53
- /** Deallocates all underlying resources */
54
- dispose(): void;
55
- }
56
2
  /**
57
3
  * Table view returned as a result of create table operation.
58
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api/table.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,UAAU,EACX,MAAM,iCAAiC,CAAC;AAEzC;;;;;KAKK;AACL,MAAM,WAAW,QAAQ;IACvB;;;;;;;;SAQK;IACL,OAAO,IAAI,gBAAgB,EAAE,CAAC;IAE9B,6EAA6E;IAC7E,gBAAgB,CAAC,SAAS,EAAE,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC;IAExD;;;OAGG;IACH,YAAY,CAAC,GAAG,CAAC,EAAE;QACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE;QACb,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEzB;;;;;;;;SAQK;IACL,OAAO,CACL,aAAa,EAAE,MAAM,EAAE,EACvB,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,UAAU,CAAC;QACnB,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GACA,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IAE3B,wDAAwD;IACxD,MAAM,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,QAAQ,CAAC;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CAAC;AAEzC;;;;;KAKK;AACL,MAAM,WAAW,QAAS,SAAQ,UAAU;IAC1C;;;;;;;;SAQK;IACL,OAAO,IAAI,gBAAgB,EAAE,CAAC;IAE9B,6EAA6E;IAC7E,gBAAgB,CAAC,SAAS,EAAE,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC;IAExD;;;OAGG;IACH,YAAY,CAAC,GAAG,CAAC,EAAE;QACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE;QACb,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEzB;;;;;;;;SAQK;IACL,OAAO,CACL,aAAa,EAAE,MAAM,EAAE,EACvB,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,UAAU,CAAC;QACnB,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GACA,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IAE3B,wDAAwD;IACxD,MAAM,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,QAAQ,CAAC;IAEhD,uDAAuD;IACvD,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,QAAQ,CAAC;IAEzC,2CAA2C;IAC3C,OAAO,IAAI,IAAI,CAAC;CACjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-model-middle-layer",
3
- "version": "1.8.16",
3
+ "version": "1.8.17",
4
4
  "description": "Common model between middle layer and non-block UI code",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -1,4 +1,5 @@
1
1
  import {
2
+ Base64Encoded,
2
3
  BinaryPartitionedDataInfo,
3
4
  JsonDataInfo,
4
5
  JsonPartitionedDataInfo,
@@ -7,6 +8,12 @@ import {
7
8
  PColumnSpec,
8
9
  PObjectId,
9
10
  } from '@milaboratories/pl-model-common';
11
+ import {
12
+ HttpHelpers,
13
+ HttpAuthorizationToken,
14
+ ObjectStoreUrl,
15
+ PemCertificate,
16
+ } from './http_helpers';
10
17
 
11
18
  /** Abstract identifier of a data blob that can be requested from the storage backend */
12
19
  export type PFrameBlobId = string;
@@ -29,6 +36,37 @@ export type PFrameDataSource = {
29
36
  resolveBlobContent(blobId: PFrameBlobId): Promise<Uint8Array>;
30
37
  };
31
38
 
39
+ /** Parquet HTTP(S) server connection settings, {@link HttpHelpers.createHttpServer} */
40
+ export type ParquetServerConfig = {
41
+ /** URL of the parquet HTTP(S) server */
42
+ url: ObjectStoreUrl;
43
+
44
+ /** Authorization token for Bearer scheme */
45
+ authToken?: HttpAuthorizationToken;
46
+
47
+ /** CA certificate of HTTPS server */
48
+ caCert?: Base64Encoded<PemCertificate>;
49
+ };
50
+
51
+ /** Data source allows PFrame to retrieve the data blobs for columns with assigned data info. */
52
+ export interface PFrameDataSourceV2 {
53
+ /**
54
+ * PFrame may notify storage backend about its plans to use particular blobs in the future.
55
+ * Storage backend will do its best to preload specified blob so the subsequent
56
+ * {@link resolveBlob} will quickly return preloaded file path.
57
+ */
58
+ preloadBlob(blobIds: PFrameBlobId[]): Promise<void>;
59
+
60
+ /** Returns raw blob data given the blob id from {@link DataInfo}. */
61
+ resolveBlobContent(blobId: PFrameBlobId): Promise<Uint8Array>;
62
+
63
+ /**
64
+ * Parquet HTTP(S) server connection settings, {@link HttpHelpers.createHttpServer}
65
+ * When not provided, parquet BlobIds would be treated as local file paths.
66
+ */
67
+ parquetServer?: ParquetServerConfig;
68
+ }
69
+
32
70
  /**
33
71
  * Union type representing all possible data storage formats for PColumn data.
34
72
  * The specific format used depends on data size, access patterns, and performance requirements.
@@ -43,14 +81,17 @@ export type DataInfo<Blob> =
43
81
 
44
82
  /** API exposed by PFrames library allowing to create and provide data for
45
83
  * PFrame objects */
46
- export interface PFrameFactoryAPIV2 {
84
+ export interface PFrameFactoryAPIV3 extends Disposable {
47
85
  /** Associates data source with this PFrame */
48
86
  setDataSource(dataSource: PFrameDataSource): void;
49
87
 
50
- /** Adds PColumn without spec */
88
+ /** Adds PColumn without data info */
51
89
  addColumnSpec(columnId: PObjectId, columnSpec: PColumnSpec): void;
52
90
 
53
- /** Associates data info with cpecific column */
91
+ /**
92
+ * Assign data info to the specified PColumn.
93
+ * For parquet data info, schema resolution via network is performed during this call.
94
+ */
54
95
  setColumnData(
55
96
  columnId: PObjectId,
56
97
  dataInfo: DataInfo<PFrameBlobId>,
@@ -66,9 +107,9 @@ export interface PFrameFactoryAPIV2 {
66
107
 
67
108
  /** API exposed by PFrames library allowing to create and provide data for
68
109
  * PFrame objects */
69
- export interface PFrameFactoryAPIV3 extends Disposable {
110
+ export interface PFrameFactoryAPIV4 extends Disposable {
70
111
  /** Associates data source with this PFrame */
71
- setDataSource(dataSource: PFrameDataSource): void;
112
+ setDataSource(dataSource: PFrameDataSourceV2): void;
72
113
 
73
114
  /** Adds PColumn without data info */
74
115
  addColumnSpec(columnId: PObjectId, columnSpec: PColumnSpec): void;
@@ -8,40 +8,7 @@ import {
8
8
  UniqueValuesResponse
9
9
  } from '@milaboratories/pl-model-common';
10
10
  import { CreateTableRequestV3 } from './create_table';
11
- import { PTableV6, PTableV7 } from './table';
12
-
13
- /** Read interface exposed by PFrames library */
14
- export interface PFrameReadAPIV8 {
15
- /**
16
- * Finds columns given filtering criteria on column name, annotations etc.
17
- * and a set of qualified axes specs to find only columns with compatible
18
- * axes spec.
19
- *
20
- * Only column specs are used, this method will work even for columns
21
- * with no assigned data.
22
- * */
23
- findColumns(request: FindColumnsRequest): Promise<FindColumnsResponse>;
24
-
25
- /** To be reviewed in the future */
26
- deleteColumn(request: DeleteColumnFromColumnsRequest): Promise<DeleteColumnFromColumnsResponse>;
27
-
28
- /** Retrieve single column spec */
29
- getColumnSpec(columnId: PObjectId): Promise<PColumnSpec>;
30
-
31
- /** Retrieve information about all columns currently added to the PFrame */
32
- listColumns(): Promise<PColumnInfo[]>;
33
-
34
- /** Calculates data for the table and returns an object to access it */
35
- createTable(request: CreateTableRequestV3): PTableV6;
36
-
37
- /** Calculate set of unique values for a specific axis for the filtered set of records */
38
- getUniqueValues(
39
- request: UniqueValuesRequest,
40
- ops?: {
41
- signal?: AbortSignal,
42
- }
43
- ): Promise<UniqueValuesResponse>;
44
- }
11
+ import { PTableV7 } from './table';
45
12
 
46
13
  /** Read interface exposed by PFrames library */
47
14
  export interface PFrameReadAPIV9 {
@@ -1,11 +1,11 @@
1
- import type { PFrameFactoryAPIV2, PFrameFactoryAPIV3 } from './api_factory';
2
- import type { PFrameReadAPIV8, PFrameReadAPIV9 } from './api_read';
1
+ import type { PFrameFactoryAPIV3, PFrameFactoryAPIV4 } from './api_factory';
2
+ import type { PFrameReadAPIV9 } from './api_read';
3
3
  import type { Logger } from './common';
4
4
 
5
- export interface PFrameV9 extends PFrameFactoryAPIV2, PFrameReadAPIV8 {}
6
-
7
5
  export interface PFrameV10 extends PFrameFactoryAPIV3, PFrameReadAPIV9 {}
8
6
 
7
+ export interface PFrameV11 extends PFrameFactoryAPIV4, PFrameReadAPIV9 {}
8
+
9
9
  export type PFrameOptions = {
10
10
  /** Path to directory where PFrame can create temporary files */
11
11
  spillPath: string;
@@ -30,3 +30,21 @@ export interface PFrameFactory {
30
30
  */
31
31
  pprofDump: () => Promise<Uint8Array>;
32
32
  };
33
+
34
+ /** List of PFrame management functions exposed by PFrame module */
35
+ export interface PFrameFactoryV2 {
36
+ /**
37
+ * Create a new PFrame instance.
38
+ * @warning Use concurrency limiting to avoid OOM crashes when multiple instances are simultaneously in use.
39
+ */
40
+ createPFrame(options: PFrameOptions): PFrameV11;
41
+
42
+ /**
43
+ * Dump active allocations from all PFrames instances in pprof format.
44
+ * The result of this function should be saved as `profile.pb.gz`.
45
+ * Use {@link https://pprof.me/} or {@link https://www.speedscope.app/}
46
+ * to view the allocation flamechart.
47
+ * @warning This method will always reject on Windows!
48
+ */
49
+ pprofDump: () => Promise<Uint8Array>;
50
+ };
@@ -8,71 +8,6 @@ import {
8
8
  TableRange
9
9
  } from '@milaboratories/pl-model-common';
10
10
 
11
- /**
12
- * Table view returned as a result of create table operation.
13
- *
14
- * PTable can be thought as having a composite primary key, consisting of axes,
15
- * and a set of data columns derived from PColumn values.
16
- * */
17
- export interface PTableV6 {
18
- /**
19
- * Returns ordered array of table axes specs (primary key "columns" in SQL
20
- * terms) and data column specs (regular "columns" in SQL terms).
21
- *
22
- * Data for a specific table column can be retrieved using unified indexing
23
- * corresponding to elements in this array.
24
- *
25
- * Axes are always listed first.
26
- * */
27
- getSpec(): PTableColumnSpec[];
28
-
29
- /** Transforms unified column identifiers into unified indices of columns. */
30
- getColumnIndices(columnIds: PTableColumnId[]): number[];
31
-
32
- /**
33
- * Get PTable disk footprint in bytes
34
- * Warning: This call materializes the join.
35
- */
36
- getFootprint(ops?: {
37
- withPredecessors?: boolean,
38
- signal?: AbortSignal,
39
- }): Promise<number>;
40
-
41
- /**
42
- * Unified table shape
43
- * Warning: This call materializes the join.
44
- */
45
- getShape(ops?: {
46
- signal?: AbortSignal,
47
- }): Promise<PTableShape>;
48
-
49
- /**
50
- * Retrieve the data from the table. To retrieve only data required, it can be
51
- * sliced both horizontally ({@link columnIndices}) and vertically
52
- * ({@link range}).
53
- * This call materializes the join.
54
- *
55
- * @param columnIndices unified indices of columns to be retrieved
56
- * @param range optionally limit the range of records to retrieve
57
- * */
58
- getData(
59
- columnIndices: number[],
60
- ops?: {
61
- range?: TableRange,
62
- signal?: AbortSignal,
63
- },
64
- ): Promise<PTableVector[]>;
65
-
66
- /** Filters the table and returns new PTable instance */
67
- filter(request: PTableRecordFilter[]): PTableV6;
68
-
69
- /** Sorts the table and returns new PTable instance. */
70
- sort(request: PTableSorting[]): PTableV6;
71
-
72
- /** Deallocates all underlying resources */
73
- dispose(): void;
74
- }
75
-
76
11
  /**
77
12
  * Table view returned as a result of create table operation.
78
13
  *