@fluidframework/matrix 2.0.0-rc.3.0.2 → 2.0.0-rc.4.0.0
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 +26 -0
- package/api-report/matrix.api.md +9 -73
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +1 -1
- package/dist/matrix.d.ts +64 -15
- package/dist/matrix.d.ts.map +1 -1
- package/dist/matrix.js +21 -25
- package/dist/matrix.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/runtime.d.ts +16 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +9 -2
- package/dist/runtime.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +1 -1
- package/lib/matrix.d.ts +64 -15
- package/lib/matrix.d.ts.map +1 -1
- package/lib/matrix.js +21 -25
- 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/runtime.d.ts +16 -1
- package/lib/runtime.d.ts.map +1 -1
- package/lib/runtime.js +11 -4
- package/lib/runtime.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +30 -22
- package/src/index.ts +2 -2
- package/src/matrix.ts +95 -28
- package/src/packageVersion.ts +1 -1
- package/src/runtime.ts +23 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @fluidframework/matrix
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.4.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Deprecated members of IFluidHandle are split off into new IFluidHandleInternal interface [96872186d0](https://github.com/microsoft/FluidFramework/commit/96872186d0d0f245c1fece7d19b3743e501679b6)
|
|
8
|
+
|
|
9
|
+
Split IFluidHandle into two interfaces, `IFluidHandle` and `IFluidHandleInternal`.
|
|
10
|
+
Code depending on the previously deprecated members of IFluidHandle can access them by using `toFluidHandleInternal` from `@fluidframework/runtime-utils/legacy`.
|
|
11
|
+
|
|
12
|
+
External implementation of the `IFluidHandle` interface are not supported: this change makes the typing better convey this using the `ErasedType` pattern.
|
|
13
|
+
Any existing and previously working, and now broken, external implementations of `IFluidHandle` should still work at runtime, but will need some unsafe type casts to compile.
|
|
14
|
+
Such handle implementation may break in the future and thus should be replaced with use of handles produced by the Fluid Framework client packages.
|
|
15
|
+
|
|
16
|
+
- matrix: SharedMatrix class hidden [96872186d0](https://github.com/microsoft/FluidFramework/commit/96872186d0d0f245c1fece7d19b3743e501679b6)
|
|
17
|
+
|
|
18
|
+
The `SharedMatrix` class has been hidden from the alpha API.
|
|
19
|
+
In its place:
|
|
20
|
+
|
|
21
|
+
- The constant `SharedMatrix` is exposed as the entrypoint for `SharedMatrix` creation. See documentation on `ISharedObjectKind`.
|
|
22
|
+
- The type `SharedMatrix` is aliased to `ISharedMatrix`, which contains matrix's public API. This API has no semantic changes from previous versions.
|
|
23
|
+
|
|
24
|
+
Additionally, `SharedMatrixFactory` has been deprecated. Rather than construct the factory directly, use `SharedMatrix.getFactory()` (e.g. for usage in `DataObject` registries).
|
|
25
|
+
|
|
26
|
+
This change is part of a larger effort to clean up the API surface of various DDSes we have to leak less implementation details. See e.g. #20030.
|
|
27
|
+
Most code which uses `SharedMatrix` should continue to function without changes.
|
|
28
|
+
|
|
3
29
|
## 2.0.0-rc.3.0.0
|
|
4
30
|
|
|
5
31
|
### Major Changes
|
package/api-report/matrix.api.md
CHANGED
|
@@ -8,22 +8,15 @@ import { IChannel } from '@fluidframework/datastore-definitions';
|
|
|
8
8
|
import { IChannelAttributes } from '@fluidframework/datastore-definitions';
|
|
9
9
|
import { IChannelFactory } from '@fluidframework/datastore-definitions';
|
|
10
10
|
import { IChannelServices } from '@fluidframework/datastore-definitions';
|
|
11
|
-
import { IChannelStorageService } from '@fluidframework/datastore-definitions';
|
|
12
11
|
import { IEvent } from '@fluidframework/core-interfaces';
|
|
13
12
|
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
14
13
|
import { IEventThisPlaceHolder } from '@fluidframework/core-interfaces';
|
|
15
14
|
import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
|
|
16
|
-
import { IFluidSerializer } from '@fluidframework/shared-object-base';
|
|
17
|
-
import { IJSONSegment } from '@fluidframework/merge-tree/internal';
|
|
18
|
-
import { IMatrixConsumer } from '@tiny-calc/nano';
|
|
19
15
|
import { IMatrixProducer } from '@tiny-calc/nano';
|
|
20
16
|
import { IMatrixReader } from '@tiny-calc/nano';
|
|
21
17
|
import { IMatrixWriter } from '@tiny-calc/nano';
|
|
22
|
-
import {
|
|
23
|
-
import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
|
|
24
|
-
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
18
|
+
import type { ISharedObjectKind } from '@fluidframework/shared-object-base';
|
|
25
19
|
import { Serializable } from '@fluidframework/datastore-definitions/internal';
|
|
26
|
-
import { SharedObject } from '@fluidframework/shared-object-base/internal';
|
|
27
20
|
|
|
28
21
|
// @alpha (undocumented)
|
|
29
22
|
export interface IRevertible {
|
|
@@ -34,17 +27,15 @@ export interface IRevertible {
|
|
|
34
27
|
}
|
|
35
28
|
|
|
36
29
|
// @alpha (undocumented)
|
|
37
|
-
export interface ISharedMatrix<T = any> extends IEventProvider<ISharedMatrixEvents<T>>, IMatrixProducer<MatrixItem<T>>, IMatrixReader<MatrixItem<T>>, IMatrixWriter<MatrixItem<T
|
|
38
|
-
// (undocumented)
|
|
30
|
+
export interface ISharedMatrix<T = any> extends IEventProvider<ISharedMatrixEvents<T>>, IMatrixProducer<MatrixItem<T>>, IMatrixReader<MatrixItem<T>>, IMatrixWriter<MatrixItem<T>>, IChannel {
|
|
39
31
|
insertCols(colStart: number, count: number): void;
|
|
40
|
-
// (undocumented)
|
|
41
32
|
insertRows(rowStart: number, count: number): void;
|
|
42
|
-
|
|
33
|
+
isSetCellConflictResolutionPolicyFWW(): boolean;
|
|
43
34
|
openUndo(consumer: IUndoConsumer): void;
|
|
44
|
-
// (undocumented)
|
|
45
35
|
removeCols(colStart: number, count: number): void;
|
|
46
|
-
// (undocumented)
|
|
47
36
|
removeRows(rowStart: number, count: number): void;
|
|
37
|
+
setCells(rowStart: number, colStart: number, colCount: number, values: readonly MatrixItem<T>[]): void;
|
|
38
|
+
switchSetCellPolicy(): void;
|
|
48
39
|
}
|
|
49
40
|
|
|
50
41
|
// @alpha
|
|
@@ -62,67 +53,12 @@ export interface IUndoConsumer {
|
|
|
62
53
|
export type MatrixItem<T> = Serializable<Exclude<T, null>> | undefined;
|
|
63
54
|
|
|
64
55
|
// @alpha
|
|
65
|
-
export
|
|
66
|
-
constructor(runtime: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes, _isSetCellConflictResolutionPolicyFWW?: boolean);
|
|
67
|
-
protected applyStashedOp(_content: unknown): void;
|
|
68
|
-
// (undocumented)
|
|
69
|
-
closeMatrix(consumer: IMatrixConsumer<MatrixItem<T>>): void;
|
|
70
|
-
// (undocumented)
|
|
71
|
-
get colCount(): number;
|
|
72
|
-
static create<T>(runtime: IFluidDataStoreRuntime, id?: string): SharedMatrix<T>;
|
|
73
|
-
// (undocumented)
|
|
74
|
-
protected didAttach(): void;
|
|
75
|
-
// (undocumented)
|
|
76
|
-
getCell(row: number, col: number): MatrixItem<T>;
|
|
77
|
-
// (undocumented)
|
|
78
|
-
static getFactory(): SharedMatrixFactory;
|
|
79
|
-
// (undocumented)
|
|
80
|
-
id: string;
|
|
81
|
-
// (undocumented)
|
|
82
|
-
insertCols(colStart: number, count: number): void;
|
|
83
|
-
// (undocumented)
|
|
84
|
-
insertRows(rowStart: number, count: number): void;
|
|
85
|
-
// (undocumented)
|
|
86
|
-
isSetCellConflictResolutionPolicyFWW(): boolean;
|
|
87
|
-
protected loadCore(storage: IChannelStorageService): Promise<void>;
|
|
88
|
-
// (undocumented)
|
|
89
|
-
get matrixProducer(): IMatrixProducer<MatrixItem<T>>;
|
|
90
|
-
// (undocumented)
|
|
91
|
-
protected onConnect(): void;
|
|
92
|
-
// (undocumented)
|
|
93
|
-
protected onDisconnect(): void;
|
|
94
|
-
// (undocumented)
|
|
95
|
-
openMatrix(consumer: IMatrixConsumer<MatrixItem<T>>): IMatrixReader<MatrixItem<T>>;
|
|
96
|
-
openUndo(consumer: IUndoConsumer): void;
|
|
97
|
-
// (undocumented)
|
|
98
|
-
protected processCore(msg: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
|
|
99
|
-
protected processGCDataCore(serializer: IFluidSerializer): void;
|
|
100
|
-
// (undocumented)
|
|
101
|
-
removeCols(colStart: number, count: number): void;
|
|
102
|
-
// (undocumented)
|
|
103
|
-
removeRows(rowStart: number, count: number): void;
|
|
104
|
-
// (undocumented)
|
|
105
|
-
protected reSubmitCore(incoming: unknown, localOpMetadata: unknown): void;
|
|
106
|
-
// (undocumented)
|
|
107
|
-
get rowCount(): number;
|
|
108
|
-
// (undocumented)
|
|
109
|
-
setCell(row: number, col: number, value: MatrixItem<T>): void;
|
|
110
|
-
// (undocumented)
|
|
111
|
-
setCells(rowStart: number, colStart: number, colCount: number, values: readonly MatrixItem<T>[]): void;
|
|
112
|
-
// (undocumented)
|
|
113
|
-
protected submitLocalMessage(message: any, localOpMetadata?: any): void;
|
|
114
|
-
// (undocumented)
|
|
115
|
-
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
|
|
116
|
-
switchSetCellPolicy(): void;
|
|
117
|
-
// (undocumented)
|
|
118
|
-
toString(): string;
|
|
119
|
-
// (undocumented)
|
|
120
|
-
_undoRemoveCols(colStart: number, spec: IJSONSegment): void;
|
|
121
|
-
// (undocumented)
|
|
122
|
-
_undoRemoveRows(rowStart: number, spec: IJSONSegment): void;
|
|
123
|
-
}
|
|
56
|
+
export const SharedMatrix: ISharedObjectKind<ISharedMatrix>;
|
|
124
57
|
|
|
125
58
|
// @alpha
|
|
59
|
+
export type SharedMatrix<T = any> = ISharedMatrix<T>;
|
|
60
|
+
|
|
61
|
+
// @alpha @deprecated
|
|
126
62
|
export class SharedMatrixFactory implements IChannelFactory<ISharedMatrix> {
|
|
127
63
|
// (undocumented)
|
|
128
64
|
static readonly Attributes: IChannelAttributes;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { ISharedMatrixEvents,
|
|
5
|
+
export { ISharedMatrixEvents, ISharedMatrix } from "./matrix.js";
|
|
6
6
|
export { MatrixItem } from "./ops.js";
|
|
7
|
-
export { SharedMatrixFactory } from "./runtime.js";
|
|
7
|
+
export { SharedMatrixFactory, SharedMatrix } from "./runtime.js";
|
|
8
8
|
export { IUndoConsumer, IRevertible } from "./types.js";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAIjE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
var matrix_js_1 = require("./matrix.js");
|
|
9
|
-
Object.defineProperty(exports, "SharedMatrix", { enumerable: true, get: function () { return matrix_js_1.SharedMatrix; } });
|
|
7
|
+
exports.SharedMatrix = exports.SharedMatrixFactory = void 0;
|
|
10
8
|
var runtime_js_1 = require("./runtime.js");
|
|
11
9
|
Object.defineProperty(exports, "SharedMatrixFactory", { enumerable: true, get: function () { return runtime_js_1.SharedMatrixFactory; } });
|
|
10
|
+
Object.defineProperty(exports, "SharedMatrix", { enumerable: true, get: function () { return runtime_js_1.SharedMatrix; } });
|
|
12
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,2CAAiE;AAAxD,iHAAA,mBAAmB,OAAA;AAAE,0GAAA,YAAY,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { ISharedMatrixEvents, ISharedMatrix } from \"./matrix.js\";\nexport { MatrixItem } from \"./ops.js\";\nexport { SharedMatrixFactory, SharedMatrix } from \"./runtime.js\";\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.js\";\n"]}
|
package/dist/legacy.d.ts
CHANGED
package/dist/matrix.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IEvent,
|
|
6
|
-
import { IChannelAttributes, IChannelStorageService, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
|
|
5
|
+
import { IEvent, IEventThisPlaceHolder, type IEventProvider } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { IChannelAttributes, IChannelStorageService, IFluidDataStoreRuntime, type IChannel } from "@fluidframework/datastore-definitions";
|
|
7
7
|
import { IJSONSegment } from "@fluidframework/merge-tree/internal";
|
|
8
8
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
9
9
|
import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
|
|
@@ -11,7 +11,6 @@ import { IFluidSerializer, ISharedObjectEvents } from "@fluidframework/shared-ob
|
|
|
11
11
|
import { SharedObject } from "@fluidframework/shared-object-base/internal";
|
|
12
12
|
import { IMatrixConsumer, IMatrixProducer, IMatrixReader, IMatrixWriter } from "@tiny-calc/nano";
|
|
13
13
|
import { MatrixItem } from "./ops.js";
|
|
14
|
-
import { SharedMatrixFactory } from "./runtime.js";
|
|
15
14
|
import { IUndoConsumer } from "./types.js";
|
|
16
15
|
/**
|
|
17
16
|
* Events emitted by Shared Matrix.
|
|
@@ -35,17 +34,76 @@ export interface ISharedMatrixEvents<T> extends IEvent {
|
|
|
35
34
|
*
|
|
36
35
|
* - `conflictingValue` - The value that this client tried to set in the cell and got ignored due to conflict.
|
|
37
36
|
*
|
|
38
|
-
* - `target` - The {@link
|
|
37
|
+
* - `target` - The {@link ISharedMatrix} itself.
|
|
39
38
|
*/
|
|
40
39
|
(event: "conflict", listener: (row: number, col: number, currentValue: MatrixItem<T>, conflictingValue: MatrixItem<T>, target: IEventThisPlaceHolder) => void): void;
|
|
41
40
|
}
|
|
42
41
|
/** @alpha */
|
|
43
|
-
export interface ISharedMatrix<T = any> extends IEventProvider<ISharedMatrixEvents<T>>, IMatrixProducer<MatrixItem<T>>, IMatrixReader<MatrixItem<T>>, IMatrixWriter<MatrixItem<T
|
|
42
|
+
export interface ISharedMatrix<T = any> extends IEventProvider<ISharedMatrixEvents<T>>, IMatrixProducer<MatrixItem<T>>, IMatrixReader<MatrixItem<T>>, IMatrixWriter<MatrixItem<T>>, IChannel {
|
|
43
|
+
/**
|
|
44
|
+
* Inserts columns into the matrix.
|
|
45
|
+
* @param colStart - Index of the first column to insert.
|
|
46
|
+
* @param count - Number of columns to insert.
|
|
47
|
+
* @remarks
|
|
48
|
+
* Inserting 0 columns is a noop.
|
|
49
|
+
*/
|
|
44
50
|
insertCols(colStart: number, count: number): void;
|
|
51
|
+
/**
|
|
52
|
+
* Removes columns from the matrix.
|
|
53
|
+
* @param colStart - Index of the first column to remove.
|
|
54
|
+
* @param count - Number of columns to remove.
|
|
55
|
+
* @remarks
|
|
56
|
+
* Removing 0 columns is a noop.
|
|
57
|
+
*/
|
|
45
58
|
removeCols(colStart: number, count: number): void;
|
|
59
|
+
/**
|
|
60
|
+
* Inserts rows into the matrix.
|
|
61
|
+
* @param rowStart - Index of the first row to insert.
|
|
62
|
+
* @param count - Number of rows to insert.
|
|
63
|
+
* @remarks
|
|
64
|
+
* Inserting 0 rows is a noop.
|
|
65
|
+
*/
|
|
46
66
|
insertRows(rowStart: number, count: number): void;
|
|
67
|
+
/**
|
|
68
|
+
* Removes rows from the matrix.
|
|
69
|
+
* @param rowStart - Index of the first row to remove.
|
|
70
|
+
* @param count - Number of rows to remove.
|
|
71
|
+
* @remarks
|
|
72
|
+
* Removing 0 rows is a noop.
|
|
73
|
+
*/
|
|
47
74
|
removeRows(rowStart: number, count: number): void;
|
|
75
|
+
/**
|
|
76
|
+
* Sets a range of cells in the matrix.
|
|
77
|
+
* Cells are set in consecutive columns between `colStart` and `colStart + colCount - 1`.
|
|
78
|
+
* When `values` has larger size than `colCount`, the extra values are inserted in subsequent rows
|
|
79
|
+
* a la text-wrapping.
|
|
80
|
+
* @param rowStart - Index of the row to start setting cells.
|
|
81
|
+
* @param colStart - Index of the column to start setting cells.
|
|
82
|
+
* @param colCount - Number of columns to set before wrapping to subsequent rows (if `values` has more items)
|
|
83
|
+
* @param values - Values to insert.
|
|
84
|
+
* @remarks
|
|
85
|
+
* This is not currently more efficient than calling `setCell` for each cell.
|
|
86
|
+
*/
|
|
87
|
+
setCells(rowStart: number, colStart: number, colCount: number, values: readonly MatrixItem<T>[]): void;
|
|
88
|
+
/**
|
|
89
|
+
* Attach an {@link IUndoConsumer} to the matrix.
|
|
90
|
+
* @param consumer - Undo consumer which will receive revertibles from the matrix.
|
|
91
|
+
*/
|
|
48
92
|
openUndo(consumer: IUndoConsumer): void;
|
|
93
|
+
/**
|
|
94
|
+
* Whether the current conflict resolution policy is first-write win (FWW).
|
|
95
|
+
* See {@link ISharedMatrix.switchSetCellPolicy} for more details.
|
|
96
|
+
*/
|
|
97
|
+
isSetCellConflictResolutionPolicyFWW(): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Change the conflict resolution policy for setCell operations to first-write win (FWW).
|
|
100
|
+
*
|
|
101
|
+
* This API only switches from LWW to FWW and not from FWW to LWW.
|
|
102
|
+
*
|
|
103
|
+
* @privateRemarks
|
|
104
|
+
* The next SetOp which is sent will communicate this policy to other clients.
|
|
105
|
+
*/
|
|
106
|
+
switchSetCellPolicy(): void;
|
|
49
107
|
}
|
|
50
108
|
/**
|
|
51
109
|
* A SharedMatrix holds a rectangular 2D array of values. Supported operations
|
|
@@ -63,7 +121,6 @@ export interface ISharedMatrix<T = any> extends IEventProvider<ISharedMatrixEven
|
|
|
63
121
|
export declare class SharedMatrix<T = any> extends SharedObject<ISharedMatrixEvents<T> & ISharedObjectEvents> implements ISharedMatrix<T> {
|
|
64
122
|
id: string;
|
|
65
123
|
private readonly consumers;
|
|
66
|
-
static getFactory(): SharedMatrixFactory;
|
|
67
124
|
/**
|
|
68
125
|
* Note: this field only provides a lower-bound on the reference sequence numbers for in-flight ops.
|
|
69
126
|
* The exact reason isn't understood, but some e2e tests suggest that the runtime may sometimes process
|
|
@@ -90,7 +147,7 @@ export declare class SharedMatrix<T = any> extends SharedObject<ISharedMatrixEve
|
|
|
90
147
|
* @param _isSetCellConflictResolutionPolicyFWW - Conflict resolution for Matrix set op is First Writer Win in case of
|
|
91
148
|
* race condition. Client can still overwrite values in case of no race.
|
|
92
149
|
*/
|
|
93
|
-
constructor(runtime: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes
|
|
150
|
+
constructor(runtime: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes);
|
|
94
151
|
private undo?;
|
|
95
152
|
/**
|
|
96
153
|
* Subscribes the given IUndoConsumer to the matrix.
|
|
@@ -98,10 +155,6 @@ export declare class SharedMatrix<T = any> extends SharedObject<ISharedMatrixEve
|
|
|
98
155
|
openUndo(consumer: IUndoConsumer): void;
|
|
99
156
|
private get rowHandles();
|
|
100
157
|
private get colHandles();
|
|
101
|
-
/**
|
|
102
|
-
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}
|
|
103
|
-
*/
|
|
104
|
-
static create<T>(runtime: IFluidDataStoreRuntime, id?: string): SharedMatrix<T>;
|
|
105
158
|
openMatrix(consumer: IMatrixConsumer<MatrixItem<T>>): IMatrixReader<MatrixItem<T>>;
|
|
106
159
|
closeMatrix(consumer: IMatrixConsumer<MatrixItem<T>>): void;
|
|
107
160
|
get rowCount(): number;
|
|
@@ -165,10 +218,6 @@ export declare class SharedMatrix<T = any> extends SharedObject<ISharedMatrixEve
|
|
|
165
218
|
private readonly onColDelta;
|
|
166
219
|
private readonly onRowHandlesRecycled;
|
|
167
220
|
private readonly onColHandlesRecycled;
|
|
168
|
-
/**
|
|
169
|
-
* Api to switch Set Op policy from Last Writer Win to First Writer Win. It only switches from LWW to FWW
|
|
170
|
-
* and not from FWW to LWW. The next SetOp which is sent will communicate this policy to other clients.
|
|
171
|
-
*/
|
|
172
221
|
switchSetCellPolicy(): void;
|
|
173
222
|
/**
|
|
174
223
|
* Returns true if the latest pending write to the cell indicated by the given row/col handles
|
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;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../src/matrix.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,MAAM,EACN,qBAAqB,EACrB,KAAK,cAAc,EACnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,QAAQ,EACb,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAGN,YAAY,EAOZ,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIjG,OAAO,EAEN,UAAU,EAKV,MAAM,UAAU,CAAC;AAKlB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAY3C;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,CAAE,SAAQ,MAAM;IACrD;;;;;;;;;;;;;;;;;;OAkBG;IACH,CACC,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,CACT,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,EAC3B,gBAAgB,EAAE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cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB;IA8BxD;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAoB/B,SAAS,CAAC,WAAW,CACpB,GAAG,EAAE,yBAAyB,EAC9B,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,OAAO;IAqIzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAQzB;IAGF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAQzB;IAEF,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAMnC;IAEF,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAMnC;IAEK,mBAAmB;IAU1B;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IAiBrB,QAAQ;IAoBf;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;CAiBjD"}
|
package/dist/matrix.js
CHANGED
|
@@ -18,7 +18,6 @@ const handletable_js_1 = require("./handletable.js");
|
|
|
18
18
|
const ops_js_1 = require("./ops.js");
|
|
19
19
|
const permutationvector_js_1 = require("./permutationvector.js");
|
|
20
20
|
const range_js_1 = require("./range.js");
|
|
21
|
-
const runtime_js_1 = require("./runtime.js");
|
|
22
21
|
const serialization_js_1 = require("./serialization.js");
|
|
23
22
|
const sparsearray2d_js_1 = require("./sparsearray2d.js");
|
|
24
23
|
const undoprovider_js_1 = require("./undoprovider.js");
|
|
@@ -36,9 +35,6 @@ const undoprovider_js_1 = require("./undoprovider.js");
|
|
|
36
35
|
* @alpha
|
|
37
36
|
*/
|
|
38
37
|
class SharedMatrix extends internal_4.SharedObject {
|
|
39
|
-
static getFactory() {
|
|
40
|
-
return new runtime_js_1.SharedMatrixFactory();
|
|
41
|
-
}
|
|
42
38
|
/**
|
|
43
39
|
* Constructor for the Shared Matrix
|
|
44
40
|
* @param runtime - DataStore runtime.
|
|
@@ -47,7 +43,7 @@ class SharedMatrix extends internal_4.SharedObject {
|
|
|
47
43
|
* @param _isSetCellConflictResolutionPolicyFWW - Conflict resolution for Matrix set op is First Writer Win in case of
|
|
48
44
|
* race condition. Client can still overwrite values in case of no race.
|
|
49
45
|
*/
|
|
50
|
-
constructor(runtime, id, attributes
|
|
46
|
+
constructor(runtime, id, attributes) {
|
|
51
47
|
super(id, runtime, attributes, "fluid_matrix_");
|
|
52
48
|
this.id = id;
|
|
53
49
|
this.consumers = new Set();
|
|
@@ -93,8 +89,7 @@ class SharedMatrix extends internal_4.SharedObject {
|
|
|
93
89
|
this.cellLastWriteTracker.clearCols(/* colStart: */ colHandle, /* colCount: */ 1);
|
|
94
90
|
}
|
|
95
91
|
};
|
|
96
|
-
this.setCellLwwToFwwPolicySwitchOpSeqNumber =
|
|
97
|
-
_isSetCellConflictResolutionPolicyFWW === true ? 0 : -1;
|
|
92
|
+
this.setCellLwwToFwwPolicySwitchOpSeqNumber = -1;
|
|
98
93
|
const getMinInFlightRefSeq = () => this.inFlightRefSeqs.get(0);
|
|
99
94
|
this.rows = new permutationvector_js_1.PermutationVector(ops_js_1.SnapshotPath.rows, this.logger, runtime, this.onRowDelta, this.onRowHandlesRecycled, getMinInFlightRefSeq);
|
|
100
95
|
this.cols = new permutationvector_js_1.PermutationVector(ops_js_1.SnapshotPath.cols, this.logger, runtime, this.onColDelta, this.onColHandlesRecycled, getMinInFlightRefSeq);
|
|
@@ -113,12 +108,6 @@ class SharedMatrix extends internal_4.SharedObject {
|
|
|
113
108
|
get colHandles() {
|
|
114
109
|
return this.cols.handleCache;
|
|
115
110
|
}
|
|
116
|
-
/**
|
|
117
|
-
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}
|
|
118
|
-
*/
|
|
119
|
-
static create(runtime, id) {
|
|
120
|
-
return runtime.createChannel(id, runtime_js_1.SharedMatrixFactory.Type);
|
|
121
|
-
}
|
|
122
111
|
// #region IMatrixProducer
|
|
123
112
|
openMatrix(consumer) {
|
|
124
113
|
this.consumers.add(consumer);
|
|
@@ -228,7 +217,7 @@ class SharedMatrix extends internal_4.SharedObject {
|
|
|
228
217
|
localSeq,
|
|
229
218
|
rowsRef,
|
|
230
219
|
colsRef,
|
|
231
|
-
referenceSeqNumber: this.
|
|
220
|
+
referenceSeqNumber: this.deltaManager.lastSequenceNumber,
|
|
232
221
|
};
|
|
233
222
|
this.submitLocalMessage(op, metadata);
|
|
234
223
|
this.pending.setCell(rowHandle, colHandle, localSeq);
|
|
@@ -242,11 +231,18 @@ class SharedMatrix extends internal_4.SharedObject {
|
|
|
242
231
|
* @param callback - code that needs to protected against reentrancy.
|
|
243
232
|
*/
|
|
244
233
|
protectAgainstReentrancy(callback) {
|
|
245
|
-
|
|
234
|
+
if (this.reentrantCount !== 0) {
|
|
235
|
+
// Validate that applications don't submit edits in response to matrix change notifications. This is unsupported.
|
|
236
|
+
throw new internal_5.UsageError("Reentrancy detected in SharedMatrix.");
|
|
237
|
+
}
|
|
246
238
|
this.reentrantCount++;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
239
|
+
try {
|
|
240
|
+
callback();
|
|
241
|
+
}
|
|
242
|
+
finally {
|
|
243
|
+
this.reentrantCount--;
|
|
244
|
+
}
|
|
245
|
+
(0, internal_1.assert)(this.reentrantCount === 0, 0x85e /* indicates a problem with the reentrancy tracking code. */);
|
|
250
246
|
}
|
|
251
247
|
submitVectorMessage(currentVector, oppositeVector, target, message) {
|
|
252
248
|
// Ideally, we would have a single 'localSeq' counter that is shared between both PermutationVectors
|
|
@@ -403,7 +399,7 @@ class SharedMatrix extends internal_4.SharedObject {
|
|
|
403
399
|
// TODO: Recommend moving this assertion into SharedObject
|
|
404
400
|
// (See https://github.com/microsoft/FluidFramework/issues/2559)
|
|
405
401
|
(0, internal_1.assert)(this.isAttached() === true, 0x01d /* "Trying to submit message to runtime while detached!" */);
|
|
406
|
-
this.inFlightRefSeqs.push(this.
|
|
402
|
+
this.inFlightRefSeqs.push(this.deltaManager.lastSequenceNumber);
|
|
407
403
|
super.submitLocalMessage(message, localOpMetadata);
|
|
408
404
|
// Ensure that row/col 'localSeq' are synchronized (see 'nextLocalSeq()').
|
|
409
405
|
(0, internal_1.assert)(this.rows.getCollabWindow().localSeq === this.cols.getCollabWindow().localSeq, 0x01e /* "Row and col collab window 'localSeq' desynchronized!" */);
|
|
@@ -469,10 +465,14 @@ class SharedMatrix extends internal_4.SharedObject {
|
|
|
469
465
|
else {
|
|
470
466
|
switch (content.target) {
|
|
471
467
|
case ops_js_1.SnapshotPath.cols:
|
|
472
|
-
this.submitColMessage(this.cols.regeneratePendingOp(content,
|
|
468
|
+
this.submitColMessage(this.cols.regeneratePendingOp(content,
|
|
469
|
+
// eslint-disable-next-line import/no-deprecated
|
|
470
|
+
localOpMetadata));
|
|
473
471
|
break;
|
|
474
472
|
case ops_js_1.SnapshotPath.rows:
|
|
475
|
-
this.submitRowMessage(this.rows.regeneratePendingOp(content,
|
|
473
|
+
this.submitRowMessage(this.rows.regeneratePendingOp(content,
|
|
474
|
+
// eslint-disable-next-line import/no-deprecated
|
|
475
|
+
localOpMetadata));
|
|
476
476
|
break;
|
|
477
477
|
default: {
|
|
478
478
|
(0, internal_1.unreachableCase)(content);
|
|
@@ -618,10 +618,6 @@ class SharedMatrix extends internal_4.SharedObject {
|
|
|
618
618
|
(0, internal_1.unreachableCase)(target, "unknown target");
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
|
-
/**
|
|
622
|
-
* Api to switch Set Op policy from Last Writer Win to First Writer Win. It only switches from LWW to FWW
|
|
623
|
-
* and not from FWW to LWW. The next SetOp which is sent will communicate this policy to other clients.
|
|
624
|
-
*/
|
|
625
621
|
switchSetCellPolicy() {
|
|
626
622
|
if (this.setCellLwwToFwwPolicySwitchOpSeqNumber === -1) {
|
|
627
623
|
if (this.isAttached()) {
|