@fluidframework/matrix 2.0.0-dev.6.4.0.191515 → 2.0.0-dev.7.2.0.203917
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/CHANGELOG.md +52 -0
- package/api-extractor.json +13 -1
- package/api-report/matrix.api.md +121 -0
- package/dist/handletable.js +2 -2
- package/dist/handletable.js.map +1 -1
- package/dist/matrix-alpha.d.ts +143 -0
- package/dist/matrix-beta.d.ts +143 -0
- package/dist/matrix-public.d.ts +143 -0
- package/dist/matrix-untrimmed.d.ts +143 -0
- package/dist/matrix.d.ts +3 -1
- package/dist/matrix.d.ts.map +1 -1
- package/dist/matrix.js +27 -23
- package/dist/matrix.js.map +1 -1
- package/dist/ops.js +1 -1
- package/dist/ops.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/permutationvector.d.ts.map +1 -1
- package/dist/permutationvector.js +17 -16
- package/dist/permutationvector.js.map +1 -1
- package/dist/sparsearray2d.d.ts +5 -5
- package/dist/sparsearray2d.d.ts.map +1 -1
- package/dist/sparsearray2d.js +3 -7
- package/dist/sparsearray2d.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/handletable.js +2 -2
- package/lib/handletable.js.map +1 -1
- package/lib/matrix.d.ts +3 -1
- package/lib/matrix.d.ts.map +1 -1
- package/lib/matrix.js +27 -23
- package/lib/matrix.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/permutationvector.d.ts.map +1 -1
- package/lib/permutationvector.js +17 -16
- package/lib/permutationvector.js.map +1 -1
- package/lib/sparsearray2d.d.ts +5 -5
- package/lib/sparsearray2d.d.ts.map +1 -1
- package/lib/sparsearray2d.js +3 -7
- package/lib/sparsearray2d.js.map +1 -1
- package/package.json +26 -27
- package/src/matrix.ts +17 -6
- package/src/packageVersion.ts +1 -1
- package/src/permutationvector.ts +1 -0
- package/src/sparsearray2d.ts +3 -7
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { IChannel } from '@fluidframework/datastore-definitions';
|
|
2
|
+
import { IChannelAttributes } from '@fluidframework/datastore-definitions';
|
|
3
|
+
import { IChannelFactory } from '@fluidframework/datastore-definitions';
|
|
4
|
+
import { IChannelServices } from '@fluidframework/datastore-definitions';
|
|
5
|
+
import { IChannelStorageService } from '@fluidframework/datastore-definitions';
|
|
6
|
+
import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
|
|
7
|
+
import { IFluidSerializer } from '@fluidframework/shared-object-base';
|
|
8
|
+
import { IJSONSegment } from '@fluidframework/merge-tree';
|
|
9
|
+
import { IMatrixConsumer } from '@tiny-calc/nano';
|
|
10
|
+
import { IMatrixProducer } from '@tiny-calc/nano';
|
|
11
|
+
import { IMatrixReader } from '@tiny-calc/nano';
|
|
12
|
+
import { IMatrixWriter } from '@tiny-calc/nano';
|
|
13
|
+
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
14
|
+
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
15
|
+
import { Serializable } from '@fluidframework/datastore-definitions';
|
|
16
|
+
import { SharedObject } from '@fluidframework/shared-object-base';
|
|
17
|
+
import { SummarySerializer } from '@fluidframework/shared-object-base';
|
|
18
|
+
|
|
19
|
+
export declare interface IRevertible {
|
|
20
|
+
revert(): any;
|
|
21
|
+
discard(): any;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export declare interface IUndoConsumer {
|
|
25
|
+
pushToCurrentOperation(revertible: IRevertible): any;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A matrix cell value may be undefined (indicating an empty cell) or any serializable type,
|
|
30
|
+
* excluding null. (However, nulls may be embedded inside objects and arrays.)
|
|
31
|
+
*/
|
|
32
|
+
export declare type MatrixItem<T> = Serializable<Exclude<T, null>> | undefined;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A SharedMatrix holds a rectangular 2D array of values. Supported operations
|
|
36
|
+
* include setting values and inserting/removing rows and columns.
|
|
37
|
+
*
|
|
38
|
+
* Matrix values may be any Fluid serializable type, which is the set of JSON
|
|
39
|
+
* serializable types extended to include IFluidHandles.
|
|
40
|
+
*
|
|
41
|
+
* Fluid's SharedMatrix implementation works equally well for dense and sparse
|
|
42
|
+
* matrix data and physically stores data in Z-order to leverage CPU caches and
|
|
43
|
+
* prefetching when reading in either row or column major order. (See README.md
|
|
44
|
+
* for more details.)
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export declare class SharedMatrix<T = any> extends SharedObject implements IMatrixProducer<MatrixItem<T>>, IMatrixReader<MatrixItem<T>>, IMatrixWriter<MatrixItem<T>> {
|
|
49
|
+
id: string;
|
|
50
|
+
private readonly consumers;
|
|
51
|
+
static getFactory(): SharedMatrixFactory;
|
|
52
|
+
private readonly rows;
|
|
53
|
+
private readonly cols;
|
|
54
|
+
private cells;
|
|
55
|
+
private pending;
|
|
56
|
+
constructor(runtime: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes);
|
|
57
|
+
private undo?;
|
|
58
|
+
/**
|
|
59
|
+
* Subscribes the given IUndoConsumer to the matrix.
|
|
60
|
+
*/
|
|
61
|
+
openUndo(consumer: IUndoConsumer): void;
|
|
62
|
+
private get rowHandles();
|
|
63
|
+
private get colHandles();
|
|
64
|
+
/**
|
|
65
|
+
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}
|
|
66
|
+
*/
|
|
67
|
+
static create<T>(runtime: IFluidDataStoreRuntime, id?: string): SharedMatrix<T>;
|
|
68
|
+
openMatrix(consumer: IMatrixConsumer<MatrixItem<T>>): IMatrixReader<MatrixItem<T>>;
|
|
69
|
+
closeMatrix(consumer: IMatrixConsumer<MatrixItem<T>>): void;
|
|
70
|
+
get rowCount(): number;
|
|
71
|
+
get colCount(): number;
|
|
72
|
+
getCell(row: number, col: number): MatrixItem<T>;
|
|
73
|
+
get matrixProducer(): IMatrixProducer<MatrixItem<T>>;
|
|
74
|
+
setCell(row: number, col: number, value: MatrixItem<T>): void;
|
|
75
|
+
setCells(rowStart: number, colStart: number, colCount: number, values: readonly MatrixItem<T>[]): void;
|
|
76
|
+
private setCellCore;
|
|
77
|
+
private sendSetCellOp;
|
|
78
|
+
private submitVectorMessage;
|
|
79
|
+
private submitColMessage;
|
|
80
|
+
insertCols(colStart: number, count: number): void;
|
|
81
|
+
removeCols(colStart: number, count: number): void;
|
|
82
|
+
private submitRowMessage;
|
|
83
|
+
insertRows(rowStart: number, count: number): void;
|
|
84
|
+
removeRows(rowStart: number, count: number): void;
|
|
85
|
+
/* Excluded from this release type: _undoRemoveRows */
|
|
86
|
+
/* Excluded from this release type: _undoRemoveCols */
|
|
87
|
+
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
|
|
88
|
+
/**
|
|
89
|
+
* Runs serializer on the GC data for this SharedMatrix.
|
|
90
|
+
* All the IFluidHandle's stored in the cells represent routes to other objects.
|
|
91
|
+
*/
|
|
92
|
+
protected processGCDataCore(serializer: SummarySerializer): void;
|
|
93
|
+
/**
|
|
94
|
+
* Advances the 'localSeq' counter for the cell data operation currently being queued.
|
|
95
|
+
*
|
|
96
|
+
* Do not use with 'submitColMessage()/submitRowMessage()' as these helpers + the MergeTree will
|
|
97
|
+
* automatically advance 'localSeq'.
|
|
98
|
+
*/
|
|
99
|
+
private nextLocalSeq;
|
|
100
|
+
protected submitLocalMessage(message: any, localOpMetadata?: any): void;
|
|
101
|
+
protected didAttach(): void;
|
|
102
|
+
protected onConnect(): void;
|
|
103
|
+
private rebasePosition;
|
|
104
|
+
protected reSubmitCore(content: any, localOpMetadata: unknown): void;
|
|
105
|
+
protected onDisconnect(): void;
|
|
106
|
+
/**
|
|
107
|
+
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
|
|
108
|
+
*/
|
|
109
|
+
protected loadCore(storage: IChannelStorageService): Promise<void>;
|
|
110
|
+
protected processCore(rawMessage: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
|
|
111
|
+
private readonly onRowDelta;
|
|
112
|
+
private readonly onColDelta;
|
|
113
|
+
private readonly onRowHandlesRecycled;
|
|
114
|
+
private readonly onColHandlesRecycled;
|
|
115
|
+
/**
|
|
116
|
+
* Returns true if the latest pending write to the cell indicated by the given row/col handles
|
|
117
|
+
* matches the given 'localSeq'.
|
|
118
|
+
*
|
|
119
|
+
* A return value of `true` indicates that there are no later local operations queued that will
|
|
120
|
+
* clobber the write op at the given 'localSeq'. This includes later ops that overwrite the cell
|
|
121
|
+
* with a different value as well as row/col removals that might recycled the given row/col handles.
|
|
122
|
+
*/
|
|
123
|
+
private isLatestPendingWrite;
|
|
124
|
+
toString(): string;
|
|
125
|
+
/**
|
|
126
|
+
* {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
|
|
127
|
+
*/
|
|
128
|
+
protected applyStashedOp(content: any): unknown;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export declare class SharedMatrixFactory implements IChannelFactory {
|
|
132
|
+
static Type: string;
|
|
133
|
+
static readonly Attributes: IChannelAttributes;
|
|
134
|
+
get type(): string;
|
|
135
|
+
get attributes(): IChannelAttributes;
|
|
136
|
+
/**
|
|
137
|
+
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
|
|
138
|
+
*/
|
|
139
|
+
load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IChannel>;
|
|
140
|
+
create(document: IFluidDataStoreRuntime, id: string): IChannel;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export { }
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { IChannel } from '@fluidframework/datastore-definitions';
|
|
2
|
+
import { IChannelAttributes } from '@fluidframework/datastore-definitions';
|
|
3
|
+
import { IChannelFactory } from '@fluidframework/datastore-definitions';
|
|
4
|
+
import { IChannelServices } from '@fluidframework/datastore-definitions';
|
|
5
|
+
import { IChannelStorageService } from '@fluidframework/datastore-definitions';
|
|
6
|
+
import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
|
|
7
|
+
import { IFluidSerializer } from '@fluidframework/shared-object-base';
|
|
8
|
+
import { IJSONSegment } from '@fluidframework/merge-tree';
|
|
9
|
+
import { IMatrixConsumer } from '@tiny-calc/nano';
|
|
10
|
+
import { IMatrixProducer } from '@tiny-calc/nano';
|
|
11
|
+
import { IMatrixReader } from '@tiny-calc/nano';
|
|
12
|
+
import { IMatrixWriter } from '@tiny-calc/nano';
|
|
13
|
+
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
14
|
+
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
15
|
+
import { Serializable } from '@fluidframework/datastore-definitions';
|
|
16
|
+
import { SharedObject } from '@fluidframework/shared-object-base';
|
|
17
|
+
import { SummarySerializer } from '@fluidframework/shared-object-base';
|
|
18
|
+
|
|
19
|
+
export declare interface IRevertible {
|
|
20
|
+
revert(): any;
|
|
21
|
+
discard(): any;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export declare interface IUndoConsumer {
|
|
25
|
+
pushToCurrentOperation(revertible: IRevertible): any;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A matrix cell value may be undefined (indicating an empty cell) or any serializable type,
|
|
30
|
+
* excluding null. (However, nulls may be embedded inside objects and arrays.)
|
|
31
|
+
*/
|
|
32
|
+
export declare type MatrixItem<T> = Serializable<Exclude<T, null>> | undefined;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A SharedMatrix holds a rectangular 2D array of values. Supported operations
|
|
36
|
+
* include setting values and inserting/removing rows and columns.
|
|
37
|
+
*
|
|
38
|
+
* Matrix values may be any Fluid serializable type, which is the set of JSON
|
|
39
|
+
* serializable types extended to include IFluidHandles.
|
|
40
|
+
*
|
|
41
|
+
* Fluid's SharedMatrix implementation works equally well for dense and sparse
|
|
42
|
+
* matrix data and physically stores data in Z-order to leverage CPU caches and
|
|
43
|
+
* prefetching when reading in either row or column major order. (See README.md
|
|
44
|
+
* for more details.)
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export declare class SharedMatrix<T = any> extends SharedObject implements IMatrixProducer<MatrixItem<T>>, IMatrixReader<MatrixItem<T>>, IMatrixWriter<MatrixItem<T>> {
|
|
49
|
+
id: string;
|
|
50
|
+
private readonly consumers;
|
|
51
|
+
static getFactory(): SharedMatrixFactory;
|
|
52
|
+
private readonly rows;
|
|
53
|
+
private readonly cols;
|
|
54
|
+
private cells;
|
|
55
|
+
private pending;
|
|
56
|
+
constructor(runtime: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes);
|
|
57
|
+
private undo?;
|
|
58
|
+
/**
|
|
59
|
+
* Subscribes the given IUndoConsumer to the matrix.
|
|
60
|
+
*/
|
|
61
|
+
openUndo(consumer: IUndoConsumer): void;
|
|
62
|
+
private get rowHandles();
|
|
63
|
+
private get colHandles();
|
|
64
|
+
/**
|
|
65
|
+
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}
|
|
66
|
+
*/
|
|
67
|
+
static create<T>(runtime: IFluidDataStoreRuntime, id?: string): SharedMatrix<T>;
|
|
68
|
+
openMatrix(consumer: IMatrixConsumer<MatrixItem<T>>): IMatrixReader<MatrixItem<T>>;
|
|
69
|
+
closeMatrix(consumer: IMatrixConsumer<MatrixItem<T>>): void;
|
|
70
|
+
get rowCount(): number;
|
|
71
|
+
get colCount(): number;
|
|
72
|
+
getCell(row: number, col: number): MatrixItem<T>;
|
|
73
|
+
get matrixProducer(): IMatrixProducer<MatrixItem<T>>;
|
|
74
|
+
setCell(row: number, col: number, value: MatrixItem<T>): void;
|
|
75
|
+
setCells(rowStart: number, colStart: number, colCount: number, values: readonly MatrixItem<T>[]): void;
|
|
76
|
+
private setCellCore;
|
|
77
|
+
private sendSetCellOp;
|
|
78
|
+
private submitVectorMessage;
|
|
79
|
+
private submitColMessage;
|
|
80
|
+
insertCols(colStart: number, count: number): void;
|
|
81
|
+
removeCols(colStart: number, count: number): void;
|
|
82
|
+
private submitRowMessage;
|
|
83
|
+
insertRows(rowStart: number, count: number): void;
|
|
84
|
+
removeRows(rowStart: number, count: number): void;
|
|
85
|
+
/** @internal */ _undoRemoveRows(rowStart: number, spec: IJSONSegment): void;
|
|
86
|
+
/** @internal */ _undoRemoveCols(colStart: number, spec: IJSONSegment): void;
|
|
87
|
+
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
|
|
88
|
+
/**
|
|
89
|
+
* Runs serializer on the GC data for this SharedMatrix.
|
|
90
|
+
* All the IFluidHandle's stored in the cells represent routes to other objects.
|
|
91
|
+
*/
|
|
92
|
+
protected processGCDataCore(serializer: SummarySerializer): void;
|
|
93
|
+
/**
|
|
94
|
+
* Advances the 'localSeq' counter for the cell data operation currently being queued.
|
|
95
|
+
*
|
|
96
|
+
* Do not use with 'submitColMessage()/submitRowMessage()' as these helpers + the MergeTree will
|
|
97
|
+
* automatically advance 'localSeq'.
|
|
98
|
+
*/
|
|
99
|
+
private nextLocalSeq;
|
|
100
|
+
protected submitLocalMessage(message: any, localOpMetadata?: any): void;
|
|
101
|
+
protected didAttach(): void;
|
|
102
|
+
protected onConnect(): void;
|
|
103
|
+
private rebasePosition;
|
|
104
|
+
protected reSubmitCore(content: any, localOpMetadata: unknown): void;
|
|
105
|
+
protected onDisconnect(): void;
|
|
106
|
+
/**
|
|
107
|
+
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
|
|
108
|
+
*/
|
|
109
|
+
protected loadCore(storage: IChannelStorageService): Promise<void>;
|
|
110
|
+
protected processCore(rawMessage: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
|
|
111
|
+
private readonly onRowDelta;
|
|
112
|
+
private readonly onColDelta;
|
|
113
|
+
private readonly onRowHandlesRecycled;
|
|
114
|
+
private readonly onColHandlesRecycled;
|
|
115
|
+
/**
|
|
116
|
+
* Returns true if the latest pending write to the cell indicated by the given row/col handles
|
|
117
|
+
* matches the given 'localSeq'.
|
|
118
|
+
*
|
|
119
|
+
* A return value of `true` indicates that there are no later local operations queued that will
|
|
120
|
+
* clobber the write op at the given 'localSeq'. This includes later ops that overwrite the cell
|
|
121
|
+
* with a different value as well as row/col removals that might recycled the given row/col handles.
|
|
122
|
+
*/
|
|
123
|
+
private isLatestPendingWrite;
|
|
124
|
+
toString(): string;
|
|
125
|
+
/**
|
|
126
|
+
* {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
|
|
127
|
+
*/
|
|
128
|
+
protected applyStashedOp(content: any): unknown;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export declare class SharedMatrixFactory implements IChannelFactory {
|
|
132
|
+
static Type: string;
|
|
133
|
+
static readonly Attributes: IChannelAttributes;
|
|
134
|
+
get type(): string;
|
|
135
|
+
get attributes(): IChannelAttributes;
|
|
136
|
+
/**
|
|
137
|
+
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
|
|
138
|
+
*/
|
|
139
|
+
load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IChannel>;
|
|
140
|
+
create(document: IFluidDataStoreRuntime, id: string): IChannel;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export { }
|
package/dist/matrix.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { IUndoConsumer } from "./types";
|
|
|
14
14
|
* A matrix cell value may be undefined (indicating an empty cell) or any serializable type,
|
|
15
15
|
* excluding null. (However, nulls may be embedded inside objects and arrays.)
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export type MatrixItem<T> = Serializable<Exclude<T, null>> | undefined;
|
|
18
18
|
/**
|
|
19
19
|
* A SharedMatrix holds a rectangular 2D array of values. Supported operations
|
|
20
20
|
* include setting values and inserting/removing rows and columns.
|
|
@@ -26,6 +26,8 @@ export declare type MatrixItem<T> = Serializable<Exclude<T, null>> | undefined;
|
|
|
26
26
|
* matrix data and physically stores data in Z-order to leverage CPU caches and
|
|
27
27
|
* prefetching when reading in either row or column major order. (See README.md
|
|
28
28
|
* for more details.)
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
29
31
|
*/
|
|
30
32
|
export declare class SharedMatrix<T = any> extends SharedObject implements IMatrixProducer<MatrixItem<T>>, IMatrixReader<MatrixItem<T>>, IMatrixWriter<MatrixItem<T>> {
|
|
31
33
|
id: string;
|
package/dist/matrix.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../src/matrix.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,kBAAkB,EAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,gBAAgB,EAGhB,YAAY,EACZ,iBAAiB,EACjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAKN,YAAY,EACZ,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAIhD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAwBxC;;;GAGG;AAEH,
|
|
1
|
+
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../src/matrix.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC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,gBAAgB,CAAQ,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY;IAuB5E,gBAAgB,CAAQ,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY;IAuB5E,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,gBAAgB,GAAG,qBAAqB;IAiB5E;;;OAGG;IACH,SAAS,CAAC,iBAAiB,CAAC,UAAU,EAAE,iBAAiB;IAQzD;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAUpB,SAAS,CAAC,kBAAkB,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,GAAG;IAoBhE,SAAS,CAAC,SAAS;IASnB,SAAS,CAAC,SAAS;IAWnB,OAAO,CAAC,cAAc;IAmBtB,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAqD7D,SAAS,CAAC,YAAY;IAEtB;;OAEG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB;IAyBxD,SAAS,CAAC,WAAW,CACpB,UAAU,EAAE,yBAAyB,EACrC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,OAAO;IA+DzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAQzB;IAGF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAQzB;IAEF,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAKnC;IAEF,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAKnC;IAEF;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IAiBrB,QAAQ;IAoBf;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO;CA0D/C"}
|
package/dist/matrix.js
CHANGED
|
@@ -28,8 +28,13 @@ const undoprovider_1 = require("./undoprovider");
|
|
|
28
28
|
* matrix data and physically stores data in Z-order to leverage CPU caches and
|
|
29
29
|
* prefetching when reading in either row or column major order. (See README.md
|
|
30
30
|
* for more details.)
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
31
33
|
*/
|
|
32
34
|
class SharedMatrix extends shared_object_base_1.SharedObject {
|
|
35
|
+
static getFactory() {
|
|
36
|
+
return new runtime_1.SharedMatrixFactory();
|
|
37
|
+
}
|
|
33
38
|
constructor(runtime, id, attributes) {
|
|
34
39
|
super(id, runtime, attributes, "fluid_matrix_");
|
|
35
40
|
this.id = id;
|
|
@@ -60,11 +65,8 @@ class SharedMatrix extends shared_object_base_1.SharedObject {
|
|
|
60
65
|
this.pending.clearCols(/* colStart: */ colHandle, /* colCount: */ 1);
|
|
61
66
|
}
|
|
62
67
|
};
|
|
63
|
-
this.rows = new permutationvector_1.PermutationVector("rows" /* rows */, this.logger, runtime, this.onRowDelta, this.onRowHandlesRecycled);
|
|
64
|
-
this.cols = new permutationvector_1.PermutationVector("cols" /* cols */, this.logger, runtime, this.onColDelta, this.onColHandlesRecycled);
|
|
65
|
-
}
|
|
66
|
-
static getFactory() {
|
|
67
|
-
return new runtime_1.SharedMatrixFactory();
|
|
68
|
+
this.rows = new permutationvector_1.PermutationVector("rows" /* SnapshotPath.rows */, this.logger, runtime, this.onRowDelta, this.onRowHandlesRecycled);
|
|
69
|
+
this.cols = new permutationvector_1.PermutationVector("cols" /* SnapshotPath.cols */, this.logger, runtime, this.onColDelta, this.onColHandlesRecycled);
|
|
68
70
|
}
|
|
69
71
|
/**
|
|
70
72
|
* Subscribes the given IUndoConsumer to the matrix.
|
|
@@ -207,7 +209,7 @@ class SharedMatrix extends shared_object_base_1.SharedObject {
|
|
|
207
209
|
}
|
|
208
210
|
}
|
|
209
211
|
submitColMessage(message) {
|
|
210
|
-
this.submitVectorMessage(this.cols, this.rows, "cols" /* cols */, message);
|
|
212
|
+
this.submitVectorMessage(this.cols, this.rows, "cols" /* SnapshotPath.cols */, message);
|
|
211
213
|
}
|
|
212
214
|
insertCols(colStart, count) {
|
|
213
215
|
this.submitColMessage(this.cols.insert(colStart, count));
|
|
@@ -216,7 +218,7 @@ class SharedMatrix extends shared_object_base_1.SharedObject {
|
|
|
216
218
|
this.submitColMessage(this.cols.remove(colStart, count));
|
|
217
219
|
}
|
|
218
220
|
submitRowMessage(message) {
|
|
219
|
-
this.submitVectorMessage(this.rows, this.cols, "rows" /* rows */, message);
|
|
221
|
+
this.submitVectorMessage(this.rows, this.cols, "rows" /* SnapshotPath.rows */, message);
|
|
220
222
|
}
|
|
221
223
|
insertRows(rowStart, count) {
|
|
222
224
|
this.submitRowMessage(this.rows.insert(rowStart, count));
|
|
@@ -266,9 +268,9 @@ class SharedMatrix extends shared_object_base_1.SharedObject {
|
|
|
266
268
|
}
|
|
267
269
|
summarizeCore(serializer) {
|
|
268
270
|
const builder = new runtime_utils_1.SummaryTreeBuilder();
|
|
269
|
-
builder.addWithStats("rows" /* rows */, this.rows.summarize(this.runtime, this.handle, serializer));
|
|
270
|
-
builder.addWithStats("cols" /* cols */, this.cols.summarize(this.runtime, this.handle, serializer));
|
|
271
|
-
builder.addBlob("cells" /* cells */, serializer.stringify([this.cells.snapshot(), this.pending.snapshot()], this.handle));
|
|
271
|
+
builder.addWithStats("rows" /* SnapshotPath.rows */, this.rows.summarize(this.runtime, this.handle, serializer));
|
|
272
|
+
builder.addWithStats("cols" /* SnapshotPath.cols */, this.cols.summarize(this.runtime, this.handle, serializer));
|
|
273
|
+
builder.addBlob("cells" /* SnapshotPath.cells */, serializer.stringify([this.cells.snapshot(), this.pending.snapshot()], this.handle));
|
|
272
274
|
return builder.getSummaryTree();
|
|
273
275
|
}
|
|
274
276
|
/**
|
|
@@ -328,10 +330,10 @@ class SharedMatrix extends shared_object_base_1.SharedObject {
|
|
|
328
330
|
}
|
|
329
331
|
reSubmitCore(content, localOpMetadata) {
|
|
330
332
|
switch (content.target) {
|
|
331
|
-
case "cols" /* cols */:
|
|
333
|
+
case "cols" /* SnapshotPath.cols */:
|
|
332
334
|
this.submitColMessage(this.cols.regeneratePendingOp(content, localOpMetadata));
|
|
333
335
|
break;
|
|
334
|
-
case "rows" /* rows */:
|
|
336
|
+
case "rows" /* SnapshotPath.rows */:
|
|
335
337
|
this.submitRowMessage(this.rows.regeneratePendingOp(content, localOpMetadata));
|
|
336
338
|
break;
|
|
337
339
|
default: {
|
|
@@ -358,9 +360,9 @@ class SharedMatrix extends shared_object_base_1.SharedObject {
|
|
|
358
360
|
*/
|
|
359
361
|
async loadCore(storage) {
|
|
360
362
|
try {
|
|
361
|
-
await this.rows.load(this.runtime, new runtime_utils_1.ObjectStoragePartition(storage, "rows" /* rows */), this.serializer);
|
|
362
|
-
await this.cols.load(this.runtime, new runtime_utils_1.ObjectStoragePartition(storage, "cols" /* cols */), this.serializer);
|
|
363
|
-
const [cellData, pendingCliSeqData] = await (0, serialization_1.deserializeBlob)(storage, "cells" /* cells */, this.serializer);
|
|
363
|
+
await this.rows.load(this.runtime, new runtime_utils_1.ObjectStoragePartition(storage, "rows" /* SnapshotPath.rows */), this.serializer);
|
|
364
|
+
await this.cols.load(this.runtime, new runtime_utils_1.ObjectStoragePartition(storage, "cols" /* SnapshotPath.cols */), this.serializer);
|
|
365
|
+
const [cellData, pendingCliSeqData] = await (0, serialization_1.deserializeBlob)(storage, "cells" /* SnapshotPath.cells */, this.serializer);
|
|
364
366
|
this.cells = sparsearray2d_1.SparseArray2D.load(cellData);
|
|
365
367
|
this.pending = sparsearray2d_1.SparseArray2D.load(pendingCliSeqData);
|
|
366
368
|
}
|
|
@@ -372,10 +374,10 @@ class SharedMatrix extends shared_object_base_1.SharedObject {
|
|
|
372
374
|
const msg = (0, shared_object_base_1.parseHandles)(rawMessage, this.serializer);
|
|
373
375
|
const contents = msg.contents;
|
|
374
376
|
switch (contents.target) {
|
|
375
|
-
case "cols" /* cols */:
|
|
377
|
+
case "cols" /* SnapshotPath.cols */:
|
|
376
378
|
this.cols.applyMsg(msg, local);
|
|
377
379
|
break;
|
|
378
|
-
case "rows" /* rows */:
|
|
380
|
+
case "rows" /* SnapshotPath.rows */:
|
|
379
381
|
this.rows.applyMsg(msg, local);
|
|
380
382
|
break;
|
|
381
383
|
default: {
|
|
@@ -450,10 +452,12 @@ class SharedMatrix extends shared_object_base_1.SharedObject {
|
|
|
450
452
|
* {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
|
|
451
453
|
*/
|
|
452
454
|
applyStashedOp(content) {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
const
|
|
455
|
+
const parsedContent = (0, shared_object_base_1.parseHandles)(content, this.serializer);
|
|
456
|
+
if (parsedContent.target === "cols" /* SnapshotPath.cols */ ||
|
|
457
|
+
parsedContent.target === "rows" /* SnapshotPath.rows */) {
|
|
458
|
+
const op = parsedContent;
|
|
459
|
+
const currentVector = parsedContent.target === "cols" /* SnapshotPath.cols */ ? this.cols : this.rows;
|
|
460
|
+
const oppositeVector = parsedContent.target === "cols" /* SnapshotPath.cols */ ? this.rows : this.cols;
|
|
457
461
|
const metadata = currentVector.applyStashedOp(op);
|
|
458
462
|
const localSeq = currentVector.getCollabWindow().localSeq;
|
|
459
463
|
const oppositeWindow = oppositeVector.getCollabWindow();
|
|
@@ -462,8 +466,8 @@ class SharedMatrix extends shared_object_base_1.SharedObject {
|
|
|
462
466
|
return metadata;
|
|
463
467
|
}
|
|
464
468
|
else {
|
|
465
|
-
(0, core_utils_1.assert)(
|
|
466
|
-
const setOp =
|
|
469
|
+
(0, core_utils_1.assert)(parsedContent.type === ops_1.MatrixOp.set, 0x2da /* "Unknown SharedMatrix 'op' type." */);
|
|
470
|
+
const setOp = parsedContent;
|
|
467
471
|
const rowHandle = this.rows.getAllocatedHandle(setOp.row);
|
|
468
472
|
const colHandle = this.cols.getAllocatedHandle(setOp.col);
|
|
469
473
|
const rowsRefSeq = this.rows.getCollabWindow().currentSeq;
|