@fluidframework/matrix 2.0.0-dev.7.4.0.217212 → 2.0.0-dev.7.4.0.221926
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 +4 -0
- package/README.md +39 -0
- package/api-extractor.json +0 -3
- package/api-report/matrix.api.md +17 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/matrix-alpha.d.ts +207 -34
- package/dist/matrix-beta.d.ts +20 -0
- package/dist/matrix-public.d.ts +20 -0
- package/dist/matrix-untrimmed.d.ts +69 -8
- package/dist/matrix.cjs +173 -43
- package/dist/matrix.cjs.map +1 -1
- package/dist/matrix.d.ts +65 -6
- package/dist/matrix.d.ts.map +1 -1
- package/dist/ops.cjs +1 -0
- package/dist/ops.cjs.map +1 -1
- package/dist/ops.d.ts +5 -1
- package/dist/ops.d.ts.map +1 -1
- package/dist/packageVersion.cjs +1 -1
- package/dist/packageVersion.cjs.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +2 -2
- package/lib/handlecache.d.ts +2 -2
- package/lib/handlecache.d.ts.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/matrix-alpha.d.ts +207 -34
- package/lib/matrix-beta.d.ts +20 -0
- package/lib/matrix-public.d.ts +20 -0
- package/lib/matrix-untrimmed.d.ts +69 -8
- package/lib/matrix.d.ts +67 -8
- package/lib/matrix.d.ts.map +1 -1
- package/lib/matrix.mjs +173 -43
- package/lib/matrix.mjs.map +1 -1
- package/lib/ops.d.ts +5 -1
- package/lib/ops.d.ts.map +1 -1
- package/lib/ops.mjs +1 -0
- package/lib/ops.mjs.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.mjs +1 -1
- package/lib/packageVersion.mjs.map +1 -1
- package/lib/permutationvector.d.ts +3 -3
- package/lib/permutationvector.d.ts.map +1 -1
- package/lib/runtime.d.ts +1 -1
- package/lib/runtime.d.ts.map +1 -1
- package/lib/runtime.mjs +1 -1
- package/lib/runtime.mjs.map +1 -1
- package/lib/serialization.d.ts.map +1 -1
- package/lib/sparsearray2d.d.ts.map +1 -1
- package/lib/types.d.ts +2 -2
- package/lib/types.mjs.map +1 -1
- package/lib/undoprovider.d.ts +4 -4
- package/lib/undoprovider.d.ts.map +1 -1
- package/matrix.test-files.tar +0 -0
- package/package.json +22 -28
- package/src/index.ts +1 -1
- package/src/matrix.ts +280 -57
- package/src/ops.ts +5 -0
- package/src/packageVersion.ts +1 -1
- package/src/runtime.ts +1 -1
- package/src/types.ts +2 -2
package/dist/matrix.d.ts
CHANGED
|
@@ -2,18 +2,45 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { IEventThisPlaceHolder } from "@fluidframework/core-interfaces";
|
|
5
6
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
6
7
|
import { IFluidDataStoreRuntime, IChannelStorageService, Serializable, IChannelAttributes } from "@fluidframework/datastore-definitions";
|
|
7
|
-
import { IFluidSerializer, SharedObject, SummarySerializer } from "@fluidframework/shared-object-base";
|
|
8
|
+
import { IFluidSerializer, ISharedObjectEvents, SharedObject, SummarySerializer } from "@fluidframework/shared-object-base";
|
|
8
9
|
import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
|
|
9
10
|
import { IMatrixProducer, IMatrixConsumer, IMatrixReader, IMatrixWriter } from "@tiny-calc/nano";
|
|
10
11
|
import { IJSONSegment } from "@fluidframework/merge-tree";
|
|
11
12
|
import { SharedMatrixFactory } from "./runtime";
|
|
12
13
|
import { IUndoConsumer } from "./types";
|
|
14
|
+
/**
|
|
15
|
+
* Events emitted by Shared Matrix.
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
18
|
+
export interface ISharedMatrixEvents<T> extends ISharedObjectEvents {
|
|
19
|
+
/**
|
|
20
|
+
* This event is only emitted when the SetCell Resolution Policy is First Write Win(FWW).
|
|
21
|
+
* This is emitted when two clients race and send changes without observing each other changes,
|
|
22
|
+
* the changes that gets sequenced last would be rejected, and only client who's changes rejected
|
|
23
|
+
* would be notified via this event, with expectation that it will merge its changes back by
|
|
24
|
+
* accounting new information (state from winner of the race).
|
|
25
|
+
*
|
|
26
|
+
* @remarks Listener parameters:
|
|
27
|
+
*
|
|
28
|
+
* - `row` - Row number at which conflict happened.
|
|
29
|
+
*
|
|
30
|
+
* - `col` - Col number at which conflict happened.
|
|
31
|
+
*
|
|
32
|
+
* - `currentValue` - The current value of the cell.
|
|
33
|
+
*
|
|
34
|
+
* - `conflictingValue` - The value that this client tried to set in the cell and got ignored due to conflict.
|
|
35
|
+
*
|
|
36
|
+
* - `target` - The {@link SharedMatrix} itself.
|
|
37
|
+
*/
|
|
38
|
+
(event: "conflict", listener: (row: number, col: number, currentValue: MatrixItem<T>, conflictingValue: MatrixItem<T>, target: IEventThisPlaceHolder) => void): any;
|
|
39
|
+
}
|
|
13
40
|
/**
|
|
14
41
|
* A matrix cell value may be undefined (indicating an empty cell) or any serializable type,
|
|
15
42
|
* excluding null. (However, nulls may be embedded inside objects and arrays.)
|
|
16
|
-
* @
|
|
43
|
+
* @alpha
|
|
17
44
|
*/
|
|
18
45
|
export type MatrixItem<T> = Serializable<Exclude<T, null>> | undefined;
|
|
19
46
|
/**
|
|
@@ -27,17 +54,29 @@ export type MatrixItem<T> = Serializable<Exclude<T, null>> | undefined;
|
|
|
27
54
|
* matrix data and physically stores data in Z-order to leverage CPU caches and
|
|
28
55
|
* prefetching when reading in either row or column major order. (See README.md
|
|
29
56
|
* for more details.)
|
|
30
|
-
* @
|
|
57
|
+
* @alpha
|
|
31
58
|
*/
|
|
32
|
-
export declare class SharedMatrix<T = any> extends SharedObject implements IMatrixProducer<MatrixItem<T>>, IMatrixReader<MatrixItem<T>>, IMatrixWriter<MatrixItem<T>> {
|
|
59
|
+
export declare class SharedMatrix<T = any> extends SharedObject<ISharedMatrixEvents<T>> implements IMatrixProducer<MatrixItem<T>>, IMatrixReader<MatrixItem<T>>, IMatrixWriter<MatrixItem<T>> {
|
|
33
60
|
id: string;
|
|
34
61
|
private readonly consumers;
|
|
35
62
|
static getFactory(): SharedMatrixFactory;
|
|
36
63
|
private readonly rows;
|
|
37
64
|
private readonly cols;
|
|
38
65
|
private cells;
|
|
39
|
-
private pending;
|
|
40
|
-
|
|
66
|
+
private readonly pending;
|
|
67
|
+
private cellLastWriteTracker;
|
|
68
|
+
private setCellLwwToFwwPolicySwitchOpSeqNumber;
|
|
69
|
+
private userSwitchedSetCellPolicy;
|
|
70
|
+
private reentrantCount;
|
|
71
|
+
/**
|
|
72
|
+
* Constructor for the Shared Matrix
|
|
73
|
+
* @param runtime - DataStore runtime.
|
|
74
|
+
* @param id - id of the dds
|
|
75
|
+
* @param attributes - channel attributes
|
|
76
|
+
* @param _isSetCellConflictResolutionPolicyFWW - Conflict resolution for Matrix set op is First Writer Win in case of
|
|
77
|
+
* race condition. Client can still overwrite values in case of no race.
|
|
78
|
+
*/
|
|
79
|
+
constructor(runtime: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes, _isSetCellConflictResolutionPolicyFWW?: boolean);
|
|
41
80
|
private undo?;
|
|
42
81
|
/**
|
|
43
82
|
* Subscribes the given IUndoConsumer to the matrix.
|
|
@@ -53,12 +92,22 @@ export declare class SharedMatrix<T = any> extends SharedObject implements IMatr
|
|
|
53
92
|
closeMatrix(consumer: IMatrixConsumer<MatrixItem<T>>): void;
|
|
54
93
|
get rowCount(): number;
|
|
55
94
|
get colCount(): number;
|
|
95
|
+
isSetCellConflictResolutionPolicyFWW(): boolean;
|
|
56
96
|
getCell(row: number, col: number): MatrixItem<T>;
|
|
57
97
|
get matrixProducer(): IMatrixProducer<MatrixItem<T>>;
|
|
58
98
|
setCell(row: number, col: number, value: MatrixItem<T>): void;
|
|
59
99
|
setCells(rowStart: number, colStart: number, colCount: number, values: readonly MatrixItem<T>[]): void;
|
|
60
100
|
private setCellCore;
|
|
61
101
|
private sendSetCellOp;
|
|
102
|
+
/**
|
|
103
|
+
* This makes sure that the code inside the callback is not reentrant. We need to do that because we raise notifications
|
|
104
|
+
* to the consumers telling about these changes and they can try to change the matrix while listening to those notifications
|
|
105
|
+
* which can make the shared matrix to be in bad state. For example, we are raising notification for a setCell changes and
|
|
106
|
+
* a consumer tries to delete that row/col on receiving that notification which can lead to this matrix trying to setCell in
|
|
107
|
+
* a deleted row/col.
|
|
108
|
+
* @param callback - code that needs to protected against reentrancy.
|
|
109
|
+
*/
|
|
110
|
+
private protectAgainstReentrancy;
|
|
62
111
|
private submitVectorMessage;
|
|
63
112
|
private submitColMessage;
|
|
64
113
|
insertCols(colStart: number, count: number): void;
|
|
@@ -91,11 +140,21 @@ export declare class SharedMatrix<T = any> extends SharedObject implements IMatr
|
|
|
91
140
|
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
|
|
92
141
|
*/
|
|
93
142
|
protected loadCore(storage: IChannelStorageService): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Tells whether the setCell op should be applied or not based on First Write Win policy. It assumes
|
|
145
|
+
* we are in FWW mode.
|
|
146
|
+
*/
|
|
147
|
+
private shouldSetCellBasedOnFWW;
|
|
94
148
|
protected processCore(rawMessage: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
|
|
95
149
|
private readonly onRowDelta;
|
|
96
150
|
private readonly onColDelta;
|
|
97
151
|
private readonly onRowHandlesRecycled;
|
|
98
152
|
private readonly onColHandlesRecycled;
|
|
153
|
+
/**
|
|
154
|
+
* Api to switch Set Op policy from Last Writer Win to First Writer Win. It only switches from LWW to FWW
|
|
155
|
+
* and not from FWW to LWW. The next SetOp which is sent will communicate this policy to other clients.
|
|
156
|
+
*/
|
|
157
|
+
switchSetCellPolicy(): void;
|
|
99
158
|
/**
|
|
100
159
|
* Returns true if the latest pending write to the cell indicated by the given row/col handles
|
|
101
160
|
* matches the given 'localSeq'.
|
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;AAKH,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,
|
|
1
|
+
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../src/matrix.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,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,EAChB,mBAAmB,EAGnB,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;AA0BxC;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,CAAE,SAAQ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}
|
package/dist/ops.cjs
CHANGED
|
@@ -10,5 +10,6 @@ var MatrixOp;
|
|
|
10
10
|
MatrixOp[MatrixOp["spliceCols"] = 0] = "spliceCols";
|
|
11
11
|
MatrixOp[MatrixOp["spliceRows"] = 1] = "spliceRows";
|
|
12
12
|
MatrixOp[MatrixOp["set"] = 2] = "set";
|
|
13
|
+
MatrixOp[MatrixOp["changeSetCellPolicy"] = 3] = "changeSetCellPolicy";
|
|
13
14
|
})(MatrixOp || (exports.MatrixOp = MatrixOp = {}));
|
|
14
15
|
//# sourceMappingURL=ops.cjs.map
|
package/dist/ops.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops.cjs","sourceRoot":"","sources":["../src/ops.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,IAAY,
|
|
1
|
+
{"version":3,"file":"ops.cjs","sourceRoot":"","sources":["../src/ops.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,IAAY,QAKX;AALD,WAAY,QAAQ;IACnB,mDAAU,CAAA;IACV,mDAAU,CAAA;IACV,qCAAG,CAAA;IACH,qEAAmB,CAAA;AACpB,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Serializable } from \"@fluidframework/datastore-definitions\";\n\nexport enum MatrixOp {\n\tspliceCols,\n\tspliceRows,\n\tset,\n\tchangeSetCellPolicy,\n}\n\nexport interface IMatrixMsg {\n\ttype: MatrixOp;\n}\n\nexport interface IMatrixSpliceMsg extends IMatrixMsg {\n\ttype: MatrixOp.spliceCols | MatrixOp.spliceRows;\n\tstart: number;\n\tcount: number;\n}\n\nexport interface IMatrixCellMsg extends IMatrixMsg {\n\ttype: MatrixOp.set;\n\trow: number;\n\tcol: number;\n\tvalue: Serializable;\n}\n\nexport interface IMatrixSwitchSetCellPolicy extends IMatrixMsg {\n\ttype: MatrixOp.changeSetCellPolicy;\n}\n"]}
|
package/dist/ops.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ import { Serializable } from "@fluidframework/datastore-definitions";
|
|
|
6
6
|
export declare enum MatrixOp {
|
|
7
7
|
spliceCols = 0,
|
|
8
8
|
spliceRows = 1,
|
|
9
|
-
set = 2
|
|
9
|
+
set = 2,
|
|
10
|
+
changeSetCellPolicy = 3
|
|
10
11
|
}
|
|
11
12
|
export interface IMatrixMsg {
|
|
12
13
|
type: MatrixOp;
|
|
@@ -22,4 +23,7 @@ export interface IMatrixCellMsg extends IMatrixMsg {
|
|
|
22
23
|
col: number;
|
|
23
24
|
value: Serializable;
|
|
24
25
|
}
|
|
26
|
+
export interface IMatrixSwitchSetCellPolicy extends IMatrixMsg {
|
|
27
|
+
type: MatrixOp.changeSetCellPolicy;
|
|
28
|
+
}
|
|
25
29
|
//# sourceMappingURL=ops.d.ts.map
|
package/dist/ops.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../src/ops.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE,oBAAY,QAAQ;IACnB,UAAU,IAAA;IACV,UAAU,IAAA;IACV,GAAG,IAAA;
|
|
1
|
+
{"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../src/ops.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAErE,oBAAY,QAAQ;IACnB,UAAU,IAAA;IACV,UAAU,IAAA;IACV,GAAG,IAAA;IACH,mBAAmB,IAAA;CACnB;AAED,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,QAAQ,CAAC;CACf;AAED,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IACnD,IAAI,EAAE,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAe,SAAQ,UAAU;IACjD,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,YAAY,CAAC;CACpB;AAED,MAAM,WAAW,0BAA2B,SAAQ,UAAU;IAC7D,IAAI,EAAE,QAAQ,CAAC,mBAAmB,CAAC;CACnC"}
|
package/dist/packageVersion.cjs
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/matrix";
|
|
11
|
-
exports.pkgVersion = "2.0.0-dev.7.4.0.
|
|
11
|
+
exports.pkgVersion = "2.0.0-dev.7.4.0.221926";
|
|
12
12
|
//# sourceMappingURL=packageVersion.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.cjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,wBAAwB,CAAC;AACnC,QAAA,UAAU,GAAG,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/matrix\";\nexport const pkgVersion = \"2.0.0-dev.7.4.0.
|
|
1
|
+
{"version":3,"file":"packageVersion.cjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,wBAAwB,CAAC;AACnC,QAAA,UAAU,GAAG,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/matrix\";\nexport const pkgVersion = \"2.0.0-dev.7.4.0.221926\";\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/matrix";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-dev.7.4.0.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-dev.7.4.0.221926";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/runtime.cjs
CHANGED
|
@@ -9,7 +9,7 @@ const packageVersion_1 = require("./packageVersion.cjs");
|
|
|
9
9
|
const matrix_1 = require("./matrix.cjs");
|
|
10
10
|
/**
|
|
11
11
|
* {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedMatrix}.
|
|
12
|
-
* @
|
|
12
|
+
* @alpha
|
|
13
13
|
*/
|
|
14
14
|
class SharedMatrixFactory {
|
|
15
15
|
get type() {
|
package/dist/runtime.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.cjs","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,yDAA8C;AAC9C,yCAAwC;AAExC;;;GAGG;AACH,MAAa,mBAAmB;IAS/B,IAAW,IAAI;QACd,OAAO,mBAAmB,CAAC,IAAI,CAAC;IACjC,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,mBAAmB,CAAC,UAAU,CAAC;IACvC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,MAAM,GAAG,IAAI,qBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;QACzD,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC;IACf,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,MAAM,GAAG,IAAI,qBAAY,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/D,MAAM,CAAC,eAAe,EAAE,CAAC;QACzB,OAAO,MAAM,CAAC;IACf,CAAC;;AAnCF,kDAoCC;AAnCc,wBAAI,GAAG,gDAAgD,CAAC;AAE/C,8BAAU,GAAuB;IACvD,IAAI,EAAE,mBAAmB,CAAC,IAAI;IAC9B,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,2BAAU;CAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n\tIChannel,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { SharedMatrix } from \"./matrix\";\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedMatrix}.\n * @
|
|
1
|
+
{"version":3,"file":"runtime.cjs","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,yDAA8C;AAC9C,yCAAwC;AAExC;;;GAGG;AACH,MAAa,mBAAmB;IAS/B,IAAW,IAAI;QACd,OAAO,mBAAmB,CAAC,IAAI,CAAC;IACjC,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,mBAAmB,CAAC,UAAU,CAAC;IACvC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,MAAM,GAAG,IAAI,qBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;QACzD,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC;IACf,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,MAAM,GAAG,IAAI,qBAAY,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/D,MAAM,CAAC,eAAe,EAAE,CAAC;QACzB,OAAO,MAAM,CAAC;IACf,CAAC;;AAnCF,kDAoCC;AAnCc,wBAAI,GAAG,gDAAgD,CAAC;AAE/C,8BAAU,GAAuB;IACvD,IAAI,EAAE,mBAAmB,CAAC,IAAI;IAC9B,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,2BAAU;CAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n\tIChannel,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { SharedMatrix } from \"./matrix\";\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedMatrix}.\n * @alpha\n */\nexport class SharedMatrixFactory implements IChannelFactory {\n\tpublic static Type = \"https://graph.microsoft.com/types/sharedmatrix\";\n\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: SharedMatrixFactory.Type,\n\t\tsnapshotFormatVersion: \"0.1\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\tpublic get type() {\n\t\treturn SharedMatrixFactory.Type;\n\t}\n\n\tpublic get attributes() {\n\t\treturn SharedMatrixFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<IChannel> {\n\t\tconst matrix = new SharedMatrix(runtime, id, attributes);\n\t\tawait matrix.load(services);\n\t\treturn matrix;\n\t}\n\n\tpublic create(document: IFluidDataStoreRuntime, id: string): IChannel {\n\t\tconst matrix = new SharedMatrix(document, id, this.attributes);\n\t\tmatrix.initializeLocal();\n\t\treturn matrix;\n\t}\n}\n"]}
|
package/dist/runtime.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { IChannelAttributes, IFluidDataStoreRuntime, IChannelServices, IChannel, IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
6
6
|
/**
|
|
7
7
|
* {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedMatrix}.
|
|
8
|
-
* @
|
|
8
|
+
* @alpha
|
|
9
9
|
*/
|
|
10
10
|
export declare class SharedMatrixFactory implements IChannelFactory {
|
|
11
11
|
static Type: string;
|
package/dist/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// TODO: We temporarily duplicate these contracts from 'framework/undo-redo' to unblock development\n// of SharedMatrix undo while we decide on the correct layering for undo.\n\n/**\n * @
|
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// TODO: We temporarily duplicate these contracts from 'framework/undo-redo' to unblock development\n// of SharedMatrix undo while we decide on the correct layering for undo.\n\n/**\n * @alpha\n */\nexport interface IRevertible {\n\trevert();\n\tdiscard();\n}\n\n/**\n * @alpha\n */\nexport interface IUndoConsumer {\n\tpushToCurrentOperation(revertible: IRevertible);\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* @
|
|
6
|
+
* @alpha
|
|
7
7
|
*/
|
|
8
8
|
export interface IRevertible {
|
|
9
9
|
revert(): any;
|
|
10
10
|
discard(): any;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* @
|
|
13
|
+
* @alpha
|
|
14
14
|
*/
|
|
15
15
|
export interface IUndoConsumer {
|
|
16
16
|
pushToCurrentOperation(revertible: IRevertible): any;
|
package/lib/handlecache.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IVectorConsumer } from "@tiny-calc/nano";
|
|
6
|
-
import { Handle } from "./handletable";
|
|
7
|
-
import { PermutationVector } from "./permutationvector";
|
|
6
|
+
import { Handle } from "./handletable.mjs";
|
|
7
|
+
import { PermutationVector } from "./permutationvector.mjs";
|
|
8
8
|
/**
|
|
9
9
|
* Used by PermutationVector to cache position -\> handle lookups.
|
|
10
10
|
*
|
package/lib/handlecache.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlecache.d.ts","sourceRoot":"","sources":["../src/handlecache.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"handlecache.d.ts","sourceRoot":"","sources":["../src/handlecache.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAKI,EAAE,eAAe,EAAE,MAAM,iBAAiB;OAC1C,EAAE,MAAM,EAAiB;OACzB,EAAE,iBAAiB,EAAsB;AAGhD;;;;;GAKG;AACH,qBAAa,WAAY,YAAW,eAAe,CAAC,MAAM,CAAC;aAI9B,MAAM,EAAE,iBAAiB;IAHrD,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,KAAK,CAAK;gBAEU,MAAM,EAAE,iBAAiB;IAErD;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAIhB;;;;;;;OAOG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM;IAajC,8EAA8E;IACvE,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAajD,0EAA0E;IAC1E,OAAO,CAAC,UAAU;IAiBlB,OAAO,CAAC,SAAS;IA4BjB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI;CAoB9E"}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { SharedMatrix, MatrixItem } from "./matrix";
|
|
6
|
-
export { SharedMatrixFactory } from "./runtime";
|
|
7
|
-
export { IUndoConsumer, IRevertible } from "./types";
|
|
5
|
+
export { ISharedMatrixEvents, SharedMatrix, MatrixItem } from "./matrix.mjs";
|
|
6
|
+
export { SharedMatrixFactory } from "./runtime.mjs";
|
|
7
|
+
export { IUndoConsumer, IRevertible } from "./types.mjs";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,mBAAmB,EAAE,YAAY,EAAE,UAAU,EAAE;OACjD,EAAE,mBAAmB,EAAE;OAIvB,EAAE,aAAa,EAAE,WAAW,EAAE"}
|
package/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAuB,YAAY,EAAc;OACjD,EAAE,mBAAmB,EAAE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { ISharedMatrixEvents, SharedMatrix, MatrixItem } from \"./matrix\";\nexport { SharedMatrixFactory } from \"./runtime\";\n\n// TODO: We temporarily duplicate these contracts from 'framework/undo-redo' to unblock development\n// of SharedMatrix undo while we decide on the correct layering for undo.\nexport { IUndoConsumer, IRevertible } from \"./types\";\n"]}
|
package/lib/matrix-alpha.d.ts
CHANGED
|
@@ -1,41 +1,214 @@
|
|
|
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 { IEventThisPlaceHolder } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
|
|
8
|
+
import { IFluidSerializer } from '@fluidframework/shared-object-base';
|
|
9
|
+
import { IJSONSegment } from '@fluidframework/merge-tree';
|
|
1
10
|
import { IMatrixConsumer } from '@tiny-calc/nano';
|
|
2
11
|
import { IMatrixProducer } from '@tiny-calc/nano';
|
|
3
12
|
import { IMatrixReader } from '@tiny-calc/nano';
|
|
4
13
|
import { IMatrixWriter } from '@tiny-calc/nano';
|
|
5
14
|
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
15
|
+
import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
|
|
16
|
+
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
17
|
+
import { Serializable } from '@fluidframework/datastore-definitions';
|
|
18
|
+
import { SharedObject } from '@fluidframework/shared-object-base';
|
|
19
|
+
import { SummarySerializer } from '@fluidframework/shared-object-base';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @alpha
|
|
23
|
+
*/
|
|
24
|
+
export declare interface IRevertible {
|
|
25
|
+
revert(): any;
|
|
26
|
+
discard(): any;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Events emitted by Shared Matrix.
|
|
31
|
+
* @alpha
|
|
32
|
+
*/
|
|
33
|
+
export declare interface ISharedMatrixEvents<T> extends ISharedObjectEvents {
|
|
34
|
+
/**
|
|
35
|
+
* This event is only emitted when the SetCell Resolution Policy is First Write Win(FWW).
|
|
36
|
+
* This is emitted when two clients race and send changes without observing each other changes,
|
|
37
|
+
* the changes that gets sequenced last would be rejected, and only client who's changes rejected
|
|
38
|
+
* would be notified via this event, with expectation that it will merge its changes back by
|
|
39
|
+
* accounting new information (state from winner of the race).
|
|
40
|
+
*
|
|
41
|
+
* @remarks Listener parameters:
|
|
42
|
+
*
|
|
43
|
+
* - `row` - Row number at which conflict happened.
|
|
44
|
+
*
|
|
45
|
+
* - `col` - Col number at which conflict happened.
|
|
46
|
+
*
|
|
47
|
+
* - `currentValue` - The current value of the cell.
|
|
48
|
+
*
|
|
49
|
+
* - `conflictingValue` - The value that this client tried to set in the cell and got ignored due to conflict.
|
|
50
|
+
*
|
|
51
|
+
* - `target` - The {@link SharedMatrix} itself.
|
|
52
|
+
*/
|
|
53
|
+
(event: "conflict", listener: (row: number, col: number, currentValue: MatrixItem<T>, conflictingValue: MatrixItem<T>, target: IEventThisPlaceHolder) => void): any;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @alpha
|
|
58
|
+
*/
|
|
59
|
+
export declare interface IUndoConsumer {
|
|
60
|
+
pushToCurrentOperation(revertible: IRevertible): any;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* A matrix cell value may be undefined (indicating an empty cell) or any serializable type,
|
|
65
|
+
* excluding null. (However, nulls may be embedded inside objects and arrays.)
|
|
66
|
+
* @alpha
|
|
67
|
+
*/
|
|
68
|
+
export declare type MatrixItem<T> = Serializable<Exclude<T, null>> | undefined;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* A SharedMatrix holds a rectangular 2D array of values. Supported operations
|
|
72
|
+
* include setting values and inserting/removing rows and columns.
|
|
73
|
+
*
|
|
74
|
+
* Matrix values may be any Fluid serializable type, which is the set of JSON
|
|
75
|
+
* serializable types extended to include IFluidHandles.
|
|
76
|
+
*
|
|
77
|
+
* Fluid's SharedMatrix implementation works equally well for dense and sparse
|
|
78
|
+
* matrix data and physically stores data in Z-order to leverage CPU caches and
|
|
79
|
+
* prefetching when reading in either row or column major order. (See README.md
|
|
80
|
+
* for more details.)
|
|
81
|
+
* @alpha
|
|
82
|
+
*/
|
|
83
|
+
export declare class SharedMatrix<T = any> extends SharedObject<ISharedMatrixEvents<T>> implements IMatrixProducer<MatrixItem<T>>, IMatrixReader<MatrixItem<T>>, IMatrixWriter<MatrixItem<T>> {
|
|
84
|
+
id: string;
|
|
85
|
+
private readonly consumers;
|
|
86
|
+
static getFactory(): SharedMatrixFactory;
|
|
87
|
+
private readonly rows;
|
|
88
|
+
private readonly cols;
|
|
89
|
+
private cells;
|
|
90
|
+
private readonly pending;
|
|
91
|
+
private cellLastWriteTracker;
|
|
92
|
+
private setCellLwwToFwwPolicySwitchOpSeqNumber;
|
|
93
|
+
private userSwitchedSetCellPolicy;
|
|
94
|
+
private reentrantCount;
|
|
95
|
+
/**
|
|
96
|
+
* Constructor for the Shared Matrix
|
|
97
|
+
* @param runtime - DataStore runtime.
|
|
98
|
+
* @param id - id of the dds
|
|
99
|
+
* @param attributes - channel attributes
|
|
100
|
+
* @param _isSetCellConflictResolutionPolicyFWW - Conflict resolution for Matrix set op is First Writer Win in case of
|
|
101
|
+
* race condition. Client can still overwrite values in case of no race.
|
|
102
|
+
*/
|
|
103
|
+
constructor(runtime: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes, _isSetCellConflictResolutionPolicyFWW?: boolean);
|
|
104
|
+
private undo?;
|
|
105
|
+
/**
|
|
106
|
+
* Subscribes the given IUndoConsumer to the matrix.
|
|
107
|
+
*/
|
|
108
|
+
openUndo(consumer: IUndoConsumer): void;
|
|
109
|
+
private get rowHandles();
|
|
110
|
+
private get colHandles();
|
|
111
|
+
/**
|
|
112
|
+
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}
|
|
113
|
+
*/
|
|
114
|
+
static create<T>(runtime: IFluidDataStoreRuntime, id?: string): SharedMatrix<T>;
|
|
115
|
+
openMatrix(consumer: IMatrixConsumer<MatrixItem<T>>): IMatrixReader<MatrixItem<T>>;
|
|
116
|
+
closeMatrix(consumer: IMatrixConsumer<MatrixItem<T>>): void;
|
|
117
|
+
get rowCount(): number;
|
|
118
|
+
get colCount(): number;
|
|
119
|
+
isSetCellConflictResolutionPolicyFWW(): boolean;
|
|
120
|
+
getCell(row: number, col: number): MatrixItem<T>;
|
|
121
|
+
get matrixProducer(): IMatrixProducer<MatrixItem<T>>;
|
|
122
|
+
setCell(row: number, col: number, value: MatrixItem<T>): void;
|
|
123
|
+
setCells(rowStart: number, colStart: number, colCount: number, values: readonly MatrixItem<T>[]): void;
|
|
124
|
+
private setCellCore;
|
|
125
|
+
private sendSetCellOp;
|
|
126
|
+
/**
|
|
127
|
+
* This makes sure that the code inside the callback is not reentrant. We need to do that because we raise notifications
|
|
128
|
+
* to the consumers telling about these changes and they can try to change the matrix while listening to those notifications
|
|
129
|
+
* which can make the shared matrix to be in bad state. For example, we are raising notification for a setCell changes and
|
|
130
|
+
* a consumer tries to delete that row/col on receiving that notification which can lead to this matrix trying to setCell in
|
|
131
|
+
* a deleted row/col.
|
|
132
|
+
* @param callback - code that needs to protected against reentrancy.
|
|
133
|
+
*/
|
|
134
|
+
private protectAgainstReentrancy;
|
|
135
|
+
private submitVectorMessage;
|
|
136
|
+
private submitColMessage;
|
|
137
|
+
insertCols(colStart: number, count: number): void;
|
|
138
|
+
removeCols(colStart: number, count: number): void;
|
|
139
|
+
private submitRowMessage;
|
|
140
|
+
insertRows(rowStart: number, count: number): void;
|
|
141
|
+
removeRows(rowStart: number, count: number): void;
|
|
142
|
+
/***/ _undoRemoveRows(rowStart: number, spec: IJSONSegment): void;
|
|
143
|
+
/***/ _undoRemoveCols(colStart: number, spec: IJSONSegment): void;
|
|
144
|
+
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
|
|
145
|
+
/**
|
|
146
|
+
* Runs serializer on the GC data for this SharedMatrix.
|
|
147
|
+
* All the IFluidHandle's stored in the cells represent routes to other objects.
|
|
148
|
+
*/
|
|
149
|
+
protected processGCDataCore(serializer: SummarySerializer): void;
|
|
150
|
+
/**
|
|
151
|
+
* Advances the 'localSeq' counter for the cell data operation currently being queued.
|
|
152
|
+
*
|
|
153
|
+
* Do not use with 'submitColMessage()/submitRowMessage()' as these helpers + the MergeTree will
|
|
154
|
+
* automatically advance 'localSeq'.
|
|
155
|
+
*/
|
|
156
|
+
private nextLocalSeq;
|
|
157
|
+
protected submitLocalMessage(message: any, localOpMetadata?: any): void;
|
|
158
|
+
protected didAttach(): void;
|
|
159
|
+
protected onConnect(): void;
|
|
160
|
+
private rebasePosition;
|
|
161
|
+
protected reSubmitCore(content: any, localOpMetadata: unknown): void;
|
|
162
|
+
protected onDisconnect(): void;
|
|
163
|
+
/**
|
|
164
|
+
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
|
|
165
|
+
*/
|
|
166
|
+
protected loadCore(storage: IChannelStorageService): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Tells whether the setCell op should be applied or not based on First Write Win policy. It assumes
|
|
169
|
+
* we are in FWW mode.
|
|
170
|
+
*/
|
|
171
|
+
private shouldSetCellBasedOnFWW;
|
|
172
|
+
protected processCore(rawMessage: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
|
|
173
|
+
private readonly onRowDelta;
|
|
174
|
+
private readonly onColDelta;
|
|
175
|
+
private readonly onRowHandlesRecycled;
|
|
176
|
+
private readonly onColHandlesRecycled;
|
|
177
|
+
/**
|
|
178
|
+
* Api to switch Set Op policy from Last Writer Win to First Writer Win. It only switches from LWW to FWW
|
|
179
|
+
* and not from FWW to LWW. The next SetOp which is sent will communicate this policy to other clients.
|
|
180
|
+
*/
|
|
181
|
+
switchSetCellPolicy(): void;
|
|
182
|
+
/**
|
|
183
|
+
* Returns true if the latest pending write to the cell indicated by the given row/col handles
|
|
184
|
+
* matches the given 'localSeq'.
|
|
185
|
+
*
|
|
186
|
+
* A return value of `true` indicates that there are no later local operations queued that will
|
|
187
|
+
* clobber the write op at the given 'localSeq'. This includes later ops that overwrite the cell
|
|
188
|
+
* with a different value as well as row/col removals that might recycled the given row/col handles.
|
|
189
|
+
*/
|
|
190
|
+
private isLatestPendingWrite;
|
|
191
|
+
toString(): string;
|
|
192
|
+
/**
|
|
193
|
+
* {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
|
|
194
|
+
*/
|
|
195
|
+
protected applyStashedOp(content: any): unknown;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedMatrix}.
|
|
200
|
+
* @alpha
|
|
201
|
+
*/
|
|
202
|
+
export declare class SharedMatrixFactory implements IChannelFactory {
|
|
203
|
+
static Type: string;
|
|
204
|
+
static readonly Attributes: IChannelAttributes;
|
|
205
|
+
get type(): string;
|
|
206
|
+
get attributes(): IChannelAttributes;
|
|
207
|
+
/**
|
|
208
|
+
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
|
|
209
|
+
*/
|
|
210
|
+
load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IChannel>;
|
|
211
|
+
create(document: IFluidDataStoreRuntime, id: string): IChannel;
|
|
212
|
+
}
|
|
40
213
|
|
|
41
214
|
export { }
|
package/lib/matrix-beta.d.ts
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
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 { IEventThisPlaceHolder } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
|
|
8
|
+
import { IFluidSerializer } from '@fluidframework/shared-object-base';
|
|
9
|
+
import { IJSONSegment } from '@fluidframework/merge-tree';
|
|
1
10
|
import { IMatrixConsumer } from '@tiny-calc/nano';
|
|
2
11
|
import { IMatrixProducer } from '@tiny-calc/nano';
|
|
3
12
|
import { IMatrixReader } from '@tiny-calc/nano';
|
|
4
13
|
import { IMatrixWriter } from '@tiny-calc/nano';
|
|
5
14
|
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
15
|
+
import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
|
|
16
|
+
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
17
|
+
import { Serializable } from '@fluidframework/datastore-definitions';
|
|
18
|
+
import { SharedObject } from '@fluidframework/shared-object-base';
|
|
19
|
+
import { SummarySerializer } from '@fluidframework/shared-object-base';
|
|
6
20
|
|
|
7
21
|
/* Excluded from this release type: IChannel */
|
|
8
22
|
|
|
@@ -14,6 +28,8 @@ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions'
|
|
|
14
28
|
|
|
15
29
|
/* Excluded from this release type: IChannelStorageService */
|
|
16
30
|
|
|
31
|
+
/* Excluded from this release type: IEventThisPlaceHolder */
|
|
32
|
+
|
|
17
33
|
/* Excluded from this release type: IFluidDataStoreRuntime */
|
|
18
34
|
|
|
19
35
|
/* Excluded from this release type: IFluidSerializer */
|
|
@@ -22,6 +38,10 @@ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions'
|
|
|
22
38
|
|
|
23
39
|
/* Excluded from this release type: IRevertible */
|
|
24
40
|
|
|
41
|
+
/* Excluded from this release type: ISharedMatrixEvents */
|
|
42
|
+
|
|
43
|
+
/* Excluded from this release type: ISharedObjectEvents */
|
|
44
|
+
|
|
25
45
|
/* Excluded from this release type: ISummaryTreeWithStats */
|
|
26
46
|
|
|
27
47
|
/* Excluded from this release type: IUndoConsumer */
|