@fluidframework/datastore 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.224419
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/.eslintrc.js +5 -7
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +273 -0
- package/README.md +41 -0
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/datastore.api.md +168 -0
- package/dist/channelContext.cjs +86 -0
- package/dist/channelContext.cjs.map +1 -0
- package/dist/channelContext.d.ts +15 -9
- package/dist/channelContext.d.ts.map +1 -1
- package/dist/{channelDeltaConnection.js → channelDeltaConnection.cjs} +14 -15
- package/dist/channelDeltaConnection.cjs.map +1 -0
- package/dist/channelDeltaConnection.d.ts +4 -5
- package/dist/channelDeltaConnection.d.ts.map +1 -1
- package/dist/{channelStorageService.js → channelStorageService.cjs} +13 -16
- package/dist/channelStorageService.cjs.map +1 -0
- package/dist/channelStorageService.d.ts +2 -2
- package/dist/channelStorageService.d.ts.map +1 -1
- package/dist/{dataStoreRuntime.js → dataStoreRuntime.cjs} +302 -225
- package/dist/dataStoreRuntime.cjs.map +1 -0
- package/dist/dataStoreRuntime.d.ts +81 -37
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/datastore-alpha.d.ts +317 -0
- package/dist/datastore-beta.d.ts +47 -0
- package/dist/datastore-public.d.ts +47 -0
- package/dist/datastore-untrimmed.d.ts +324 -0
- package/dist/{fluidHandle.js → fluidHandle.cjs} +44 -16
- package/dist/fluidHandle.cjs.map +1 -0
- package/dist/fluidHandle.d.ts +33 -6
- package/dist/fluidHandle.d.ts.map +1 -1
- package/dist/index.cjs +15 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/localChannelContext.cjs +190 -0
- package/dist/localChannelContext.cjs.map +1 -0
- package/dist/localChannelContext.d.ts +12 -21
- package/dist/localChannelContext.d.ts.map +1 -1
- package/dist/{localChannelStorageService.js → localChannelStorageService.cjs} +3 -3
- package/dist/localChannelStorageService.cjs.map +1 -0
- package/dist/localChannelStorageService.d.ts.map +1 -1
- package/dist/remoteChannelContext.cjs +124 -0
- package/dist/remoteChannelContext.cjs.map +1 -0
- package/dist/remoteChannelContext.d.ts +5 -10
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/{channelContext.d.ts → channelContext.d.mts} +16 -10
- package/lib/channelContext.d.mts.map +1 -0
- package/lib/channelContext.mjs +78 -0
- package/lib/channelContext.mjs.map +1 -0
- package/lib/{channelDeltaConnection.d.ts → channelDeltaConnection.d.mts} +4 -5
- package/lib/channelDeltaConnection.d.mts.map +1 -0
- package/lib/{channelDeltaConnection.js → channelDeltaConnection.mjs} +11 -12
- package/lib/channelDeltaConnection.mjs.map +1 -0
- package/lib/{channelStorageService.d.ts → channelStorageService.d.mts} +2 -2
- package/lib/channelStorageService.d.mts.map +1 -0
- package/lib/{channelStorageService.js → channelStorageService.mjs} +13 -16
- package/lib/channelStorageService.mjs.map +1 -0
- package/lib/{dataStoreRuntime.d.ts → dataStoreRuntime.d.mts} +81 -37
- package/lib/dataStoreRuntime.d.mts.map +1 -0
- package/lib/{dataStoreRuntime.js → dataStoreRuntime.mjs} +286 -209
- package/lib/dataStoreRuntime.mjs.map +1 -0
- package/lib/datastore-alpha.d.mts +317 -0
- package/lib/datastore-beta.d.mts +47 -0
- package/lib/datastore-public.d.mts +47 -0
- package/lib/datastore-untrimmed.d.mts +324 -0
- package/lib/fluidHandle.d.mts +57 -0
- package/lib/fluidHandle.d.mts.map +1 -0
- package/lib/{fluidHandle.js → fluidHandle.mjs} +44 -16
- package/lib/fluidHandle.mjs.map +1 -0
- package/lib/index.d.mts +7 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +7 -0
- package/lib/index.mjs.map +1 -0
- package/lib/{localChannelContext.d.ts → localChannelContext.d.mts} +13 -22
- package/lib/localChannelContext.d.mts.map +1 -0
- package/lib/{localChannelContext.js → localChannelContext.mjs} +73 -85
- package/lib/localChannelContext.mjs.map +1 -0
- package/lib/localChannelStorageService.d.mts.map +1 -0
- package/lib/{localChannelStorageService.js → localChannelStorageService.mjs} +2 -2
- package/lib/localChannelStorageService.mjs.map +1 -0
- package/lib/{remoteChannelContext.d.ts → remoteChannelContext.d.mts} +7 -12
- package/lib/remoteChannelContext.d.mts.map +1 -0
- package/lib/remoteChannelContext.mjs +120 -0
- package/lib/remoteChannelContext.mjs.map +1 -0
- package/package.json +107 -72
- package/{lib/index.js → prettier.config.cjs} +4 -3
- package/src/channelContext.ts +168 -71
- package/src/channelDeltaConnection.ts +52 -47
- package/src/channelStorageService.ts +59 -55
- package/src/dataStoreRuntime.ts +1158 -983
- package/src/fluidHandle.ts +92 -64
- package/src/index.ts +8 -2
- package/src/localChannelContext.ts +278 -272
- package/src/localChannelStorageService.ts +48 -46
- package/src/remoteChannelContext.ts +237 -300
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +11 -13
- package/dist/channelContext.js +0 -35
- package/dist/channelContext.js.map +0 -1
- package/dist/channelDeltaConnection.js.map +0 -1
- package/dist/channelStorageService.js.map +0 -1
- package/dist/dataStoreRuntime.js.map +0 -1
- package/dist/fluidHandle.js.map +0 -1
- package/dist/index.js +0 -19
- package/dist/index.js.map +0 -1
- package/dist/localChannelContext.js +0 -202
- package/dist/localChannelContext.js.map +0 -1
- package/dist/localChannelStorageService.js.map +0 -1
- package/dist/packageVersion.d.ts +0 -9
- package/dist/packageVersion.d.ts.map +0 -1
- package/dist/packageVersion.js +0 -12
- package/dist/packageVersion.js.map +0 -1
- package/dist/remoteChannelContext.js +0 -207
- package/dist/remoteChannelContext.js.map +0 -1
- package/lib/channelContext.d.ts.map +0 -1
- package/lib/channelContext.js +0 -29
- package/lib/channelContext.js.map +0 -1
- package/lib/channelDeltaConnection.d.ts.map +0 -1
- package/lib/channelDeltaConnection.js.map +0 -1
- package/lib/channelStorageService.d.ts.map +0 -1
- package/lib/channelStorageService.js.map +0 -1
- package/lib/dataStoreRuntime.d.ts.map +0 -1
- package/lib/dataStoreRuntime.js.map +0 -1
- package/lib/fluidHandle.d.ts +0 -30
- package/lib/fluidHandle.d.ts.map +0 -1
- package/lib/fluidHandle.js.map +0 -1
- package/lib/index.d.ts +0 -7
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/localChannelContext.d.ts.map +0 -1
- package/lib/localChannelContext.js.map +0 -1
- package/lib/localChannelStorageService.d.ts.map +0 -1
- package/lib/localChannelStorageService.js.map +0 -1
- package/lib/packageVersion.d.ts +0 -9
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/packageVersion.js +0 -9
- package/lib/packageVersion.js.map +0 -1
- package/lib/remoteChannelContext.d.ts.map +0 -1
- package/lib/remoteChannelContext.js +0 -203
- package/lib/remoteChannelContext.js.map +0 -1
- package/src/packageVersion.ts +0 -9
- package/tsconfig.esnext.json +0 -7
- /package/lib/{localChannelStorageService.d.ts → localChannelStorageService.d.mts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/datastore",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.0.0-dev-rc.1.0.0.224419",
|
|
4
4
|
"description": "Fluid data store implementation",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -11,45 +11,32 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"author": "Microsoft and contributors",
|
|
13
13
|
"sideEffects": false,
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"build:genver": "gen-version",
|
|
26
|
-
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
27
|
-
"ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
|
|
28
|
-
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
|
|
29
|
-
"eslint": "eslint --format stylish src",
|
|
30
|
-
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
31
|
-
"lint": "npm run eslint",
|
|
32
|
-
"lint:fix": "npm run eslint:fix",
|
|
33
|
-
"test": "npm run test:mocha",
|
|
34
|
-
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
|
|
35
|
-
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test --exit -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
|
|
36
|
-
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
37
|
-
"tsc": "tsc",
|
|
38
|
-
"tsc:watch": "tsc --watch",
|
|
39
|
-
"typetests:gen": "flub generate typetests --generate --dir . --no-generateInName",
|
|
40
|
-
"typetests:prepare": "flub generate typetests --prepare --dir . --pin"
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./lib/index.d.mts",
|
|
18
|
+
"default": "./lib/index.mjs"
|
|
19
|
+
},
|
|
20
|
+
"require": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.cjs"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
41
25
|
},
|
|
42
|
-
"
|
|
26
|
+
"main": "dist/index.cjs",
|
|
27
|
+
"module": "lib/index.mjs",
|
|
28
|
+
"types": "dist/index.d.ts",
|
|
29
|
+
"c8": {
|
|
43
30
|
"all": true,
|
|
44
31
|
"cache-dir": "nyc/.cache",
|
|
45
32
|
"exclude": [
|
|
46
|
-
"src/test
|
|
47
|
-
"dist/test
|
|
33
|
+
"src/test/**/*.*ts",
|
|
34
|
+
"dist/test/**/*.*js"
|
|
48
35
|
],
|
|
49
36
|
"exclude-after-remap": false,
|
|
50
37
|
"include": [
|
|
51
|
-
"src
|
|
52
|
-
"dist
|
|
38
|
+
"src/**/*.*ts",
|
|
39
|
+
"dist/**/*.*js"
|
|
53
40
|
],
|
|
54
41
|
"report-dir": "nyc/report",
|
|
55
42
|
"reporter": [
|
|
@@ -60,49 +47,97 @@
|
|
|
60
47
|
"temp-directory": "nyc/.nyc_output"
|
|
61
48
|
},
|
|
62
49
|
"dependencies": {
|
|
63
|
-
"@
|
|
64
|
-
"@fluidframework/
|
|
65
|
-
"@fluidframework/
|
|
66
|
-
"@fluidframework/
|
|
67
|
-
"@fluidframework/
|
|
68
|
-
"@fluidframework/
|
|
69
|
-
"@fluidframework/driver-
|
|
70
|
-
"@fluidframework/
|
|
71
|
-
"@fluidframework/
|
|
72
|
-
"@fluidframework/
|
|
73
|
-
"@fluidframework/
|
|
74
|
-
"@fluidframework/runtime-definitions": "1.4.0-121020",
|
|
75
|
-
"@fluidframework/runtime-utils": "1.4.0-121020",
|
|
76
|
-
"@fluidframework/telemetry-utils": "1.4.0-121020",
|
|
50
|
+
"@fluid-internal/client-utils": "2.0.0-dev-rc.1.0.0.224419",
|
|
51
|
+
"@fluidframework/container-definitions": "2.0.0-dev-rc.1.0.0.224419",
|
|
52
|
+
"@fluidframework/core-interfaces": "2.0.0-dev-rc.1.0.0.224419",
|
|
53
|
+
"@fluidframework/core-utils": "2.0.0-dev-rc.1.0.0.224419",
|
|
54
|
+
"@fluidframework/datastore-definitions": "2.0.0-dev-rc.1.0.0.224419",
|
|
55
|
+
"@fluidframework/driver-definitions": "2.0.0-dev-rc.1.0.0.224419",
|
|
56
|
+
"@fluidframework/driver-utils": "2.0.0-dev-rc.1.0.0.224419",
|
|
57
|
+
"@fluidframework/protocol-definitions": "^3.1.0-223007",
|
|
58
|
+
"@fluidframework/runtime-definitions": "2.0.0-dev-rc.1.0.0.224419",
|
|
59
|
+
"@fluidframework/runtime-utils": "2.0.0-dev-rc.1.0.0.224419",
|
|
60
|
+
"@fluidframework/telemetry-utils": "2.0.0-dev-rc.1.0.0.224419",
|
|
77
61
|
"lodash": "^4.17.21",
|
|
78
|
-
"uuid": "^
|
|
62
|
+
"uuid": "^9.0.0"
|
|
79
63
|
},
|
|
80
64
|
"devDependencies": {
|
|
81
|
-
"@
|
|
82
|
-
"@
|
|
83
|
-
"@fluidframework/
|
|
84
|
-
"@fluidframework/
|
|
85
|
-
"@fluidframework/
|
|
86
|
-
"@fluidframework/
|
|
87
|
-
"@
|
|
88
|
-
"@
|
|
65
|
+
"@arethetypeswrong/cli": "^0.13.3",
|
|
66
|
+
"@fluid-tools/build-cli": "0.29.0-222379",
|
|
67
|
+
"@fluidframework/build-common": "^2.0.3",
|
|
68
|
+
"@fluidframework/build-tools": "0.29.0-222379",
|
|
69
|
+
"@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.0.0-internal.7.2.0",
|
|
70
|
+
"@fluidframework/eslint-config-fluid": "^3.1.0",
|
|
71
|
+
"@fluidframework/mocha-test-setup": "2.0.0-dev-rc.1.0.0.224419",
|
|
72
|
+
"@fluidframework/test-runtime-utils": "2.0.0-dev-rc.1.0.0.224419",
|
|
73
|
+
"@microsoft/api-extractor": "^7.38.3",
|
|
74
|
+
"@types/lodash": "^4.14.118",
|
|
89
75
|
"@types/mocha": "^9.1.1",
|
|
90
|
-
"@types/node": "^
|
|
91
|
-
"@types/uuid": "^
|
|
92
|
-
"
|
|
93
|
-
"copyfiles": "^2.1
|
|
94
|
-
"cross-env": "^7.0.
|
|
95
|
-
"eslint": "~8.
|
|
96
|
-
"mocha": "^10.
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
76
|
+
"@types/node": "^18.19.0",
|
|
77
|
+
"@types/uuid": "^9.0.2",
|
|
78
|
+
"c8": "^7.7.1",
|
|
79
|
+
"copyfiles": "^2.4.1",
|
|
80
|
+
"cross-env": "^7.0.3",
|
|
81
|
+
"eslint": "~8.50.0",
|
|
82
|
+
"mocha": "^10.2.0",
|
|
83
|
+
"mocha-json-output-reporter": "^2.0.1",
|
|
84
|
+
"mocha-multi-reporters": "^1.5.1",
|
|
85
|
+
"moment": "^2.21.0",
|
|
86
|
+
"prettier": "~3.0.3",
|
|
87
|
+
"renamer": "^4.0.0",
|
|
88
|
+
"rimraf": "^4.4.0",
|
|
89
|
+
"tsc-multi": "^1.1.0",
|
|
90
|
+
"typescript": "~5.1.6"
|
|
91
|
+
},
|
|
92
|
+
"fluidBuild": {
|
|
93
|
+
"tasks": {
|
|
94
|
+
"build:docs": {
|
|
95
|
+
"dependsOn": [
|
|
96
|
+
"...",
|
|
97
|
+
"api-extractor:commonjs",
|
|
98
|
+
"api-extractor:esnext"
|
|
99
|
+
],
|
|
100
|
+
"script": false
|
|
101
|
+
}
|
|
102
|
+
}
|
|
101
103
|
},
|
|
102
104
|
"typeValidation": {
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
"broken": {
|
|
106
|
+
"ClassDeclaration_FluidDataStoreRuntime": {
|
|
107
|
+
"forwardCompat": false,
|
|
108
|
+
"backCompat": false
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"scripts": {
|
|
113
|
+
"api": "fluid-build . --task api",
|
|
114
|
+
"api-extractor:commonjs": "api-extractor run --local",
|
|
115
|
+
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
|
|
116
|
+
"build": "fluid-build . --task build",
|
|
117
|
+
"build:commonjs": "fluid-build . --task commonjs",
|
|
118
|
+
"build:compile": "fluid-build . --task compile",
|
|
119
|
+
"build:docs": "fluid-build . --task api",
|
|
120
|
+
"build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
|
|
121
|
+
"build:rename-types": "renamer \"lib/**\" -f .d.ts -r .d.mts --force",
|
|
122
|
+
"build:test": "tsc-multi --config ./tsc-multi.test.json",
|
|
123
|
+
"check:are-the-types-wrong": "attw --pack",
|
|
124
|
+
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
125
|
+
"ci:build:docs": "api-extractor run",
|
|
126
|
+
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
127
|
+
"eslint": "eslint --format stylish src",
|
|
128
|
+
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
129
|
+
"format": "npm run prettier:fix",
|
|
130
|
+
"lint": "npm run prettier && npm run check:release-tags && npm run eslint",
|
|
131
|
+
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
132
|
+
"prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
133
|
+
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
134
|
+
"test": "npm run test:mocha",
|
|
135
|
+
"test:coverage": "c8 npm test",
|
|
136
|
+
"test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test --exit -r node_modules/@fluidframework/mocha-test-setup",
|
|
137
|
+
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
138
|
+
"tsc": "tsc-multi --config ../../../common/build/build-common/tsc-multi.cjs.json",
|
|
139
|
+
"tsc:watch": "tsc --watch",
|
|
140
|
+
"typetests:gen": "fluid-type-test-generator",
|
|
141
|
+
"typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
|
|
107
142
|
}
|
|
108
|
-
}
|
|
143
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
...require("@fluidframework/build-common/prettier.config.cjs"),
|
|
8
|
+
};
|
package/src/channelContext.ts
CHANGED
|
@@ -3,106 +3,203 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
DataCorruptionError,
|
|
8
|
+
ITelemetryLoggerExt,
|
|
9
|
+
tagCodeArtifacts,
|
|
10
|
+
} from "@fluidframework/telemetry-utils";
|
|
7
11
|
import { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
8
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
IChannel,
|
|
14
|
+
IChannelAttributes,
|
|
15
|
+
IChannelFactory,
|
|
16
|
+
IFluidDataStoreRuntime,
|
|
17
|
+
} from "@fluidframework/datastore-definitions";
|
|
9
18
|
import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
10
19
|
import { ISequencedDocumentMessage, ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
11
20
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
IGarbageCollectionData,
|
|
22
|
+
IExperimentalIncrementalSummaryContext,
|
|
23
|
+
ISummarizeResult,
|
|
24
|
+
ISummaryTreeWithStats,
|
|
25
|
+
ITelemetryContext,
|
|
26
|
+
IFluidDataStoreContext,
|
|
16
27
|
} from "@fluidframework/runtime-definitions";
|
|
17
28
|
import { addBlobToSummary } from "@fluidframework/runtime-utils";
|
|
18
|
-
import {
|
|
29
|
+
import { readAndParse } from "@fluidframework/driver-utils";
|
|
19
30
|
import { ChannelStorageService } from "./channelStorageService";
|
|
31
|
+
import { ChannelDeltaConnection } from "./channelDeltaConnection";
|
|
32
|
+
import { ISharedObjectRegistry } from "./dataStoreRuntime";
|
|
20
33
|
|
|
21
34
|
export const attributesBlobKey = ".attributes";
|
|
22
35
|
|
|
23
36
|
export interface IChannelContext {
|
|
24
|
-
|
|
37
|
+
getChannel(): Promise<IChannel>;
|
|
25
38
|
|
|
26
|
-
|
|
39
|
+
setConnectionState(connected: boolean, clientId?: string);
|
|
27
40
|
|
|
28
|
-
|
|
41
|
+
processOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata?: unknown): void;
|
|
29
42
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
summarize(
|
|
44
|
+
fullTree?: boolean,
|
|
45
|
+
trackState?: boolean,
|
|
46
|
+
telemetryContext?: ITelemetryContext,
|
|
47
|
+
): Promise<ISummarizeResult>;
|
|
35
48
|
|
|
36
|
-
|
|
49
|
+
reSubmit(content: any, localOpMetadata: unknown): void;
|
|
37
50
|
|
|
38
|
-
|
|
51
|
+
applyStashedOp(content: any): unknown;
|
|
39
52
|
|
|
40
|
-
|
|
53
|
+
rollback(message: any, localOpMetadata: unknown): void;
|
|
41
54
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Returns the data used for garbage collection. This includes a list of GC nodes that represent this context
|
|
57
|
+
* including any of its children. Each node has a set of outbound routes to other GC nodes in the document.
|
|
58
|
+
* @param fullGC - true to bypass optimizations and force full generation of GC data.
|
|
59
|
+
*/
|
|
60
|
+
getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
|
|
48
61
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
updateUsedRoutes(usedRoutes: string[], gcTimestamp?: number): void;
|
|
62
|
+
/**
|
|
63
|
+
* After GC has run, called to notify this context of routes that are used in it. These are used for the following:
|
|
64
|
+
* 1. To identify if this context is being referenced in the document or not.
|
|
65
|
+
* 2. To identify if this context or any of its children's used routes changed since last summary.
|
|
66
|
+
* 3. They are added to the summary generated by this context.
|
|
67
|
+
*/
|
|
68
|
+
updateUsedRoutes(usedRoutes: string[]): void;
|
|
57
69
|
}
|
|
58
70
|
|
|
59
|
-
export
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
export interface ChannelServiceEndpoints {
|
|
72
|
+
deltaConnection: ChannelDeltaConnection;
|
|
73
|
+
objectStorage: ChannelStorageService;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function createChannelServiceEndpoints(
|
|
77
|
+
connected: boolean,
|
|
78
|
+
submitFn: (content: any, localOpMetadata: unknown) => void,
|
|
79
|
+
dirtyFn: () => void,
|
|
80
|
+
addedGCOutboundReferenceFn: (srcHandle: IFluidHandle, outboundHandle: IFluidHandle) => void,
|
|
81
|
+
storageService: IDocumentStorageService,
|
|
82
|
+
logger: ITelemetryLoggerExt,
|
|
83
|
+
tree?: ISnapshotTree,
|
|
84
|
+
extraBlobs?: Map<string, ArrayBufferLike>,
|
|
85
|
+
): ChannelServiceEndpoints {
|
|
86
|
+
const deltaConnection = new ChannelDeltaConnection(
|
|
87
|
+
connected,
|
|
88
|
+
(message, localOpMetadata) => submitFn(message, localOpMetadata),
|
|
89
|
+
dirtyFn,
|
|
90
|
+
addedGCOutboundReferenceFn,
|
|
91
|
+
);
|
|
92
|
+
const objectStorage = new ChannelStorageService(tree, storageService, logger, extraBlobs);
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
deltaConnection,
|
|
96
|
+
objectStorage,
|
|
97
|
+
};
|
|
82
98
|
}
|
|
83
99
|
|
|
84
100
|
export function summarizeChannel(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
101
|
+
channel: IChannel,
|
|
102
|
+
fullTree: boolean = false,
|
|
103
|
+
trackState: boolean = false,
|
|
104
|
+
telemetryContext?: ITelemetryContext,
|
|
89
105
|
): ISummaryTreeWithStats {
|
|
90
|
-
|
|
106
|
+
const summarizeResult = channel.getAttachSummary(fullTree, trackState, telemetryContext);
|
|
91
107
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
108
|
+
// Add the channel attributes to the returned result.
|
|
109
|
+
addBlobToSummary(summarizeResult, attributesBlobKey, JSON.stringify(channel.attributes));
|
|
110
|
+
return summarizeResult;
|
|
95
111
|
}
|
|
96
112
|
|
|
97
113
|
export async function summarizeChannelAsync(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
114
|
+
channel: IChannel,
|
|
115
|
+
fullTree: boolean = false,
|
|
116
|
+
trackState: boolean = false,
|
|
117
|
+
telemetryContext?: ITelemetryContext,
|
|
118
|
+
incrementalSummaryContext?: IExperimentalIncrementalSummaryContext,
|
|
102
119
|
): Promise<ISummaryTreeWithStats> {
|
|
103
|
-
|
|
120
|
+
const summarizeResult = await channel.summarize(
|
|
121
|
+
fullTree,
|
|
122
|
+
trackState,
|
|
123
|
+
telemetryContext,
|
|
124
|
+
incrementalSummaryContext,
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
// Add the channel attributes to the returned result.
|
|
128
|
+
addBlobToSummary(summarizeResult, attributesBlobKey, JSON.stringify(channel.attributes));
|
|
129
|
+
return summarizeResult;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export async function loadChannelFactoryAndAttributes(
|
|
133
|
+
dataStoreContext: IFluidDataStoreContext,
|
|
134
|
+
services: ChannelServiceEndpoints,
|
|
135
|
+
channelId: string,
|
|
136
|
+
registry: ISharedObjectRegistry,
|
|
137
|
+
attachMessageType?: string,
|
|
138
|
+
): Promise<{ factory: IChannelFactory; attributes: IChannelAttributes }> {
|
|
139
|
+
let attributes: IChannelAttributes | undefined;
|
|
140
|
+
if (await services.objectStorage.contains(attributesBlobKey)) {
|
|
141
|
+
attributes = await readAndParse<IChannelAttributes | undefined>(
|
|
142
|
+
services.objectStorage,
|
|
143
|
+
attributesBlobKey,
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// This is a backward compatibility case where the attach message doesn't include attributes. They must
|
|
148
|
+
// include attach message type.
|
|
149
|
+
// Since old attach messages will not have attributes, we need to keep this as long as we support old attach
|
|
150
|
+
// messages.
|
|
151
|
+
const channelFactoryType = attributes ? attributes.type : attachMessageType;
|
|
152
|
+
if (channelFactoryType === undefined) {
|
|
153
|
+
throw new DataCorruptionError(
|
|
154
|
+
"channelTypeNotAvailable",
|
|
155
|
+
tagCodeArtifacts({
|
|
156
|
+
channelId,
|
|
157
|
+
dataStoreId: dataStoreContext.id,
|
|
158
|
+
dataStorePackagePath: dataStoreContext.packagePath.join("/"),
|
|
159
|
+
channelFactoryType,
|
|
160
|
+
}),
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
const factory = registry.get(channelFactoryType);
|
|
164
|
+
if (factory === undefined) {
|
|
165
|
+
throw new DataCorruptionError(
|
|
166
|
+
"channelFactoryNotRegisteredForGivenType",
|
|
167
|
+
tagCodeArtifacts({
|
|
168
|
+
channelId,
|
|
169
|
+
dataStoreId: dataStoreContext.id,
|
|
170
|
+
dataStorePackagePath: dataStoreContext.packagePath.join("/"),
|
|
171
|
+
channelFactoryType,
|
|
172
|
+
}),
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
// This is a backward compatibility case where the attach message doesn't include attributes. Get the attributes
|
|
176
|
+
// from the factory.
|
|
177
|
+
attributes = attributes ?? factory.attributes;
|
|
178
|
+
return { factory, attributes };
|
|
179
|
+
}
|
|
104
180
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
181
|
+
export async function loadChannel(
|
|
182
|
+
dataStoreRuntime: IFluidDataStoreRuntime,
|
|
183
|
+
attributes: IChannelAttributes,
|
|
184
|
+
factory: IChannelFactory,
|
|
185
|
+
services: ChannelServiceEndpoints,
|
|
186
|
+
logger: ITelemetryLoggerExt,
|
|
187
|
+
channelId: string,
|
|
188
|
+
): Promise<IChannel> {
|
|
189
|
+
// Compare snapshot version to collaborative object version
|
|
190
|
+
if (
|
|
191
|
+
attributes.snapshotFormatVersion !== undefined &&
|
|
192
|
+
attributes.snapshotFormatVersion !== factory.attributes.snapshotFormatVersion
|
|
193
|
+
) {
|
|
194
|
+
logger.sendTelemetryEvent({
|
|
195
|
+
eventName: "ChannelAttributesVersionMismatch",
|
|
196
|
+
...tagCodeArtifacts({
|
|
197
|
+
channelType: attributes.type,
|
|
198
|
+
channelSnapshotVersion: `${attributes.snapshotFormatVersion}@${attributes.packageVersion}`,
|
|
199
|
+
channelCodeVersion: `${factory.attributes.snapshotFormatVersion}@${factory.attributes.packageVersion}`,
|
|
200
|
+
}),
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return factory.load(dataStoreRuntime, channelId, services, attributes);
|
|
108
205
|
}
|
|
@@ -3,63 +3,68 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert } from "@fluidframework/
|
|
7
|
-
import {
|
|
6
|
+
import { assert } from "@fluidframework/core-utils";
|
|
7
|
+
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
8
8
|
import { IDeltaConnection, IDeltaHandler } from "@fluidframework/datastore-definitions";
|
|
9
|
-
import { DataProcessingError } from "@fluidframework/
|
|
9
|
+
import { DataProcessingError } from "@fluidframework/telemetry-utils";
|
|
10
10
|
import { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
11
11
|
|
|
12
12
|
export class ChannelDeltaConnection implements IDeltaConnection {
|
|
13
|
-
|
|
13
|
+
private _handler: IDeltaHandler | undefined;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
private get handler(): IDeltaHandler {
|
|
16
|
+
assert(!!this._handler, 0x177 /* "Missing delta handler" */);
|
|
17
|
+
return this._handler;
|
|
18
|
+
}
|
|
19
|
+
public get connected(): boolean {
|
|
20
|
+
return this._connected;
|
|
21
|
+
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
constructor(
|
|
24
|
+
private _connected: boolean,
|
|
25
|
+
public readonly submit: (content: any, localOpMetadata: unknown) => void,
|
|
26
|
+
public readonly dirty: () => void,
|
|
27
|
+
public readonly addedGCOutboundReference: (
|
|
28
|
+
srcHandle: IFluidHandle,
|
|
29
|
+
outboundHandle: IFluidHandle,
|
|
30
|
+
) => void,
|
|
31
|
+
) {}
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
public attach(handler: IDeltaHandler) {
|
|
34
|
+
assert(this._handler === undefined, 0x178 /* "Missing delta handler on attach" */);
|
|
35
|
+
this._handler = handler;
|
|
36
|
+
}
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
public setConnectionState(connected: boolean) {
|
|
39
|
+
this._connected = connected;
|
|
40
|
+
this.handler.setConnectionState(connected);
|
|
41
|
+
}
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
public process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {
|
|
44
|
+
try {
|
|
45
|
+
// catches as data processing error whether or not they come from async pending queues
|
|
46
|
+
this.handler.process(message, local, localOpMetadata);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
throw DataProcessingError.wrapIfUnrecognized(
|
|
49
|
+
error,
|
|
50
|
+
"channelDeltaConnectionFailedToProcessMessage",
|
|
51
|
+
message,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
50
55
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
public reSubmit(content: any, localOpMetadata: unknown) {
|
|
57
|
+
this.handler.reSubmit(content, localOpMetadata);
|
|
58
|
+
}
|
|
54
59
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
public rollback(content: any, localOpMetadata: unknown) {
|
|
61
|
+
if (this.handler.rollback === undefined) {
|
|
62
|
+
throw new Error("Handler doesn't support rollback");
|
|
63
|
+
}
|
|
64
|
+
this.handler.rollback(content, localOpMetadata);
|
|
65
|
+
}
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
public applyStashedOp(content: any): unknown {
|
|
68
|
+
return this.handler.applyStashedOp(content);
|
|
69
|
+
}
|
|
65
70
|
}
|