@fluid-experimental/property-dds 1.2.6 → 2.0.0-dev.1.3.0.96595
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/dist/propertyTreeExt.d.ts +4 -0
- package/dist/propertyTreeExt.d.ts.map +1 -1
- package/dist/propertyTreeExt.js +10 -1
- package/dist/propertyTreeExt.js.map +1 -1
- package/dist/propertyTreeExtFactories.d.ts +30 -4
- package/dist/propertyTreeExtFactories.d.ts.map +1 -1
- package/dist/propertyTreeExtFactories.js +95 -52
- package/dist/propertyTreeExtFactories.js.map +1 -1
- package/lib/propertyTreeExt.d.ts +4 -0
- package/lib/propertyTreeExt.d.ts.map +1 -1
- package/lib/propertyTreeExt.js +9 -1
- package/lib/propertyTreeExt.js.map +1 -1
- package/lib/propertyTreeExtFactories.d.ts +30 -4
- package/lib/propertyTreeExtFactories.d.ts.map +1 -1
- package/lib/propertyTreeExtFactories.js +93 -52
- package/lib/propertyTreeExtFactories.js.map +1 -1
- package/package.json +23 -22
- package/src/propertyTreeExt.ts +11 -1
- package/src/propertyTreeExtFactories.ts +142 -58
|
@@ -12,4 +12,8 @@ export declare class DeflatedPropertyTree extends SharedPropertyTree {
|
|
|
12
12
|
static create(runtime: IFluidDataStoreRuntime, id?: string, queryString?: string): DeflatedPropertyTree;
|
|
13
13
|
static getFactory(): IChannelFactory;
|
|
14
14
|
}
|
|
15
|
+
export declare class LZ4PropertyTree extends SharedPropertyTree {
|
|
16
|
+
static create(runtime: IFluidDataStoreRuntime, id?: string, queryString?: string): LZ4PropertyTree;
|
|
17
|
+
static getFactory(): IChannelFactory;
|
|
18
|
+
}
|
|
15
19
|
//# sourceMappingURL=propertyTreeExt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTreeExt.d.ts","sourceRoot":"","sources":["../src/propertyTreeExt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGpD;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,kBAAkB;WAC1C,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;WAIzE,UAAU,IAAI,eAAe;CAG9C"}
|
|
1
|
+
{"version":3,"file":"propertyTreeExt.d.ts","sourceRoot":"","sources":["../src/propertyTreeExt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGpD;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,kBAAkB;WAC1C,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;WAIzE,UAAU,IAAI,eAAe;CAG9C;AAED,qBAAa,eAAgB,SAAQ,kBAAkB;WACrC,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;WAIzE,UAAU,IAAI,eAAe;CAG9C"}
|
package/dist/propertyTreeExt.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.DeflatedPropertyTree = void 0;
|
|
7
|
+
exports.LZ4PropertyTree = exports.DeflatedPropertyTree = void 0;
|
|
8
8
|
const propertyTree_1 = require("./propertyTree");
|
|
9
9
|
const propertyTreeExtFactories_1 = require("./propertyTreeExtFactories");
|
|
10
10
|
/**
|
|
@@ -20,4 +20,13 @@ class DeflatedPropertyTree extends propertyTree_1.SharedPropertyTree {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.DeflatedPropertyTree = DeflatedPropertyTree;
|
|
23
|
+
class LZ4PropertyTree extends propertyTree_1.SharedPropertyTree {
|
|
24
|
+
static create(runtime, id, queryString) {
|
|
25
|
+
return runtime.createChannel(id, propertyTreeExtFactories_1.LZ4PropertyTreeFactory.Type);
|
|
26
|
+
}
|
|
27
|
+
static getFactory() {
|
|
28
|
+
return new propertyTreeExtFactories_1.LZ4PropertyTreeFactory();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.LZ4PropertyTree = LZ4PropertyTree;
|
|
23
32
|
//# sourceMappingURL=propertyTreeExt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTreeExt.js","sourceRoot":"","sources":["../src/propertyTreeExt.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,iDAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"propertyTreeExt.js","sourceRoot":"","sources":["../src/propertyTreeExt.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,iDAAoD;AACpD,yEAAiG;AAEjG;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,iCAAkB;IACjD,MAAM,CAAC,MAAM,CAAC,OAA+B,EAAE,EAAW,EAAE,WAAoB;QACnF,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,sDAA2B,CAAC,IAAI,CAAyB,CAAC;IAC/F,CAAC;IAEM,MAAM,CAAC,UAAU;QACpB,OAAO,IAAI,sDAA2B,EAAE,CAAC;IAC7C,CAAC;CACJ;AARD,oDAQC;AAED,MAAa,eAAgB,SAAQ,iCAAkB;IAC5C,MAAM,CAAC,MAAM,CAAC,OAA+B,EAAE,EAAW,EAAE,WAAoB;QACnF,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,iDAAsB,CAAC,IAAI,CAAoB,CAAC;IACrF,CAAC;IAEM,MAAM,CAAC,UAAU;QACpB,OAAO,IAAI,iDAAsB,EAAE,CAAC;IACxC,CAAC;CACJ;AARD,0CAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IChannelFactory, IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { SharedPropertyTree } from \"./propertyTree\";\nimport { DeflatedPropertyTreeFactory, LZ4PropertyTreeFactory } from \"./propertyTreeExtFactories\";\n\n/**\n * This class is the extension of SharedPropertyTree which compresses\n * the deltas and summaries communicated to the server by Deflate.\n */\nexport class DeflatedPropertyTree extends SharedPropertyTree {\n public static create(runtime: IFluidDataStoreRuntime, id?: string, queryString?: string) {\n return runtime.createChannel(id, DeflatedPropertyTreeFactory.Type) as DeflatedPropertyTree;\n }\n\n public static getFactory(): IChannelFactory {\n return new DeflatedPropertyTreeFactory();\n }\n}\n\nexport class LZ4PropertyTree extends SharedPropertyTree {\n public static create(runtime: IFluidDataStoreRuntime, id?: string, queryString?: string) {\n return runtime.createChannel(id, LZ4PropertyTreeFactory.Type) as LZ4PropertyTree;\n }\n\n public static getFactory(): IChannelFactory {\n return new LZ4PropertyTreeFactory();\n }\n}\n"]}
|
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
import { IChannelAttributes, IFluidDataStoreRuntime, IChannelServices, IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { IPropertyTreeConfig, ISharedPropertyTreeEncDec, SharedPropertyTree, SharedPropertyTreeOptions } from "./propertyTree";
|
|
3
|
+
import { DeflatedPropertyTree, LZ4PropertyTree } from "./propertyTreeExt";
|
|
4
|
+
export declare abstract class CompressedPropertyTreeFactory implements IChannelFactory {
|
|
5
|
+
abstract get attributes(): any;
|
|
6
|
+
abstract get type(): any;
|
|
7
|
+
abstract getEncodeFce(): any;
|
|
8
|
+
abstract getDecodeFce(): any;
|
|
9
|
+
private createCompressionMethods;
|
|
10
|
+
getEncDec(): ISharedPropertyTreeEncDec;
|
|
11
|
+
abstract newPropertyTree(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, options: SharedPropertyTreeOptions, propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree;
|
|
12
|
+
load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes, url?: string): Promise<SharedPropertyTree>;
|
|
13
|
+
create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): SharedPropertyTree;
|
|
14
|
+
}
|
|
15
|
+
export declare class DeflatedPropertyTreeFactory extends CompressedPropertyTreeFactory {
|
|
4
16
|
static readonly Type = "DeflatedPropertyTree:84534a0fe613522101f6";
|
|
5
17
|
static readonly Attributes: IChannelAttributes;
|
|
6
|
-
get type(): string;
|
|
7
|
-
get attributes(): IChannelAttributes;
|
|
8
18
|
load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes, url?: string): Promise<DeflatedPropertyTree>;
|
|
9
19
|
create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): DeflatedPropertyTree;
|
|
20
|
+
get type(): string;
|
|
21
|
+
get attributes(): IChannelAttributes;
|
|
22
|
+
getEncodeFce(): any;
|
|
23
|
+
getDecodeFce(): any;
|
|
24
|
+
newPropertyTree(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, options: SharedPropertyTreeOptions, propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree;
|
|
25
|
+
}
|
|
26
|
+
export declare class LZ4PropertyTreeFactory extends CompressedPropertyTreeFactory {
|
|
27
|
+
static readonly Type = "LZ4PropertyTree:84534a0fe613522101f6";
|
|
28
|
+
static readonly Attributes: IChannelAttributes;
|
|
29
|
+
load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes, url?: string): Promise<LZ4PropertyTree>;
|
|
30
|
+
create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): LZ4PropertyTree;
|
|
31
|
+
get type(): string;
|
|
32
|
+
get attributes(): IChannelAttributes;
|
|
33
|
+
getEncodeFce(): any;
|
|
34
|
+
getDecodeFce(): any;
|
|
35
|
+
newPropertyTree(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, options: SharedPropertyTreeOptions, propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree;
|
|
10
36
|
}
|
|
11
37
|
//# sourceMappingURL=propertyTreeExtFactories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTreeExtFactories.d.ts","sourceRoot":"","sources":["../src/propertyTreeExtFactories.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"propertyTreeExtFactories.d.ts","sourceRoot":"","sources":["../src/propertyTreeExtFactories.ts"],"names":[],"mappings":"AAQA,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,mBAAmB,EAAwB,yBAAyB,EAClD,kBAAkB,EAAE,yBAAyB,EAClE,MACQ,gBAAgB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE1E,8BAAsB,6BAA8B,YAAW,eAAe;IAC1E,aAAoB,UAAU,QAAG;IACjC,aAAoB,IAAI,QAAG;aACX,YAAY;aACZ,YAAY;IAC5B,OAAO,CAAC,wBAAwB;IA0CzB,SAAS,IAAI,yBAAyB;aAG7B,eAAe,CAC3B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,sBAAsB,EAC/B,UAAU,EAAE,kBAAkB,EAC9B,OAAO,EAAE,yBAAyB,EAClC,kBAAkB,EAAE,mBAAmB,GAAG,kBAAkB;IAEnD,IAAI,CACb,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,EAC9B,GAAG,CAAC,EAAE,MAAM,GACb,OAAO,CAA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Y;IACZ,eAAe,CAClB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,sBAAsB,EAC/B,UAAU,EAAE,kBAAkB,EAC9B,OAAO,EAAE,yBAAyB,EAClC,kBAAkB,EAAE,mBAAmB,GAAG,kBAAkB;CAGnE"}
|
|
@@ -1,77 +1,94 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DeflatedPropertyTreeFactory = void 0;
|
|
3
|
+
exports.LZ4PropertyTreeFactory = exports.DeflatedPropertyTreeFactory = exports.CompressedPropertyTreeFactory = void 0;
|
|
4
4
|
/*!
|
|
5
5
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
6
6
|
* Licensed under the MIT License.
|
|
7
7
|
*/
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
8
9
|
const pako_1 = require("pako");
|
|
10
|
+
const lz4js_1 = require("lz4js");
|
|
9
11
|
const common_utils_1 = require("@fluidframework/common-utils");
|
|
10
12
|
const propertyTreeExt_1 = require("./propertyTreeExt");
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
class DeflatedPropertyTreeFactory {
|
|
56
|
-
get type() {
|
|
57
|
-
return DeflatedPropertyTreeFactory.Type;
|
|
13
|
+
class CompressedPropertyTreeFactory {
|
|
14
|
+
createCompressionMethods(encodeFn, decodeFn) {
|
|
15
|
+
return {
|
|
16
|
+
messageEncoder: {
|
|
17
|
+
encode: (change) => {
|
|
18
|
+
const changeSetStr = JSON.stringify(change.changeSet);
|
|
19
|
+
const unzipped = new TextEncoder().encode(changeSetStr);
|
|
20
|
+
const zipped = encodeFn(unzipped);
|
|
21
|
+
const zippedStr = (0, common_utils_1.bufferToString)(zipped, "base64");
|
|
22
|
+
if (zippedStr.length < changeSetStr.length) {
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
24
|
+
change["isZipped"] = "1";
|
|
25
|
+
change.changeSet = zippedStr;
|
|
26
|
+
}
|
|
27
|
+
return change;
|
|
28
|
+
},
|
|
29
|
+
decode: (transferChange) => {
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
31
|
+
if (transferChange["isZipped"]) {
|
|
32
|
+
const zipped = new Uint8Array((0, common_utils_1.stringToBuffer)(transferChange.changeSet, "base64"));
|
|
33
|
+
const unzipped = decodeFn(zipped);
|
|
34
|
+
const changeSetStr = new TextDecoder().decode(unzipped);
|
|
35
|
+
transferChange.changeSet = JSON.parse(changeSetStr);
|
|
36
|
+
}
|
|
37
|
+
return transferChange;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
summaryEncoder: {
|
|
41
|
+
encode: (snapshotSummary) => {
|
|
42
|
+
const summaryStr = JSON.stringify(snapshotSummary);
|
|
43
|
+
const unzipped = new TextEncoder().encode(summaryStr);
|
|
44
|
+
const serializedSummary = encodeFn(unzipped);
|
|
45
|
+
return serializedSummary;
|
|
46
|
+
},
|
|
47
|
+
decode: (serializedSummary) => {
|
|
48
|
+
const unzipped = decodeFn(serializedSummary);
|
|
49
|
+
const summaryStr = new TextDecoder().decode(unzipped);
|
|
50
|
+
const snapshotSummary = JSON.parse(summaryStr);
|
|
51
|
+
return snapshotSummary;
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
58
55
|
}
|
|
59
|
-
|
|
60
|
-
return
|
|
56
|
+
getEncDec() {
|
|
57
|
+
return this.createCompressionMethods(this.getEncodeFce(), this.getDecodeFce());
|
|
61
58
|
}
|
|
62
59
|
async load(runtime, id, services, attributes, url) {
|
|
63
60
|
const options = {};
|
|
64
|
-
const instance =
|
|
61
|
+
const instance = this.newPropertyTree(id, runtime, attributes, options, { encDec: this.getEncDec() });
|
|
65
62
|
await instance.load(services);
|
|
66
63
|
return instance;
|
|
67
64
|
}
|
|
68
65
|
create(document, id, requestUrl) {
|
|
69
66
|
const options = {};
|
|
70
|
-
const cell =
|
|
67
|
+
const cell = this.newPropertyTree(id, document, this.attributes, options, { encDec: this.getEncDec() });
|
|
71
68
|
cell.initializeLocal();
|
|
72
69
|
return cell;
|
|
73
70
|
}
|
|
74
71
|
}
|
|
72
|
+
exports.CompressedPropertyTreeFactory = CompressedPropertyTreeFactory;
|
|
73
|
+
class DeflatedPropertyTreeFactory extends CompressedPropertyTreeFactory {
|
|
74
|
+
async load(runtime, id, services, attributes, url) {
|
|
75
|
+
return await super.load(runtime, id, services, attributes, url);
|
|
76
|
+
}
|
|
77
|
+
create(document, id, requestUrl) {
|
|
78
|
+
return super.create(document, id, requestUrl);
|
|
79
|
+
}
|
|
80
|
+
get type() {
|
|
81
|
+
return DeflatedPropertyTreeFactory.Type;
|
|
82
|
+
}
|
|
83
|
+
get attributes() {
|
|
84
|
+
return DeflatedPropertyTreeFactory.Attributes;
|
|
85
|
+
}
|
|
86
|
+
getEncodeFce() { return pako_1.deflate; }
|
|
87
|
+
getDecodeFce() { return pako_1.inflate; }
|
|
88
|
+
newPropertyTree(id, runtime, attributes, options, propertyTreeConfig) {
|
|
89
|
+
return new propertyTreeExt_1.DeflatedPropertyTree(id, runtime, attributes, options, propertyTreeConfig);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
75
92
|
exports.DeflatedPropertyTreeFactory = DeflatedPropertyTreeFactory;
|
|
76
93
|
DeflatedPropertyTreeFactory.Type = "DeflatedPropertyTree:84534a0fe613522101f6";
|
|
77
94
|
DeflatedPropertyTreeFactory.Attributes = {
|
|
@@ -79,4 +96,30 @@ DeflatedPropertyTreeFactory.Attributes = {
|
|
|
79
96
|
snapshotFormatVersion: "0.1",
|
|
80
97
|
packageVersion: "0.0.1",
|
|
81
98
|
};
|
|
99
|
+
class LZ4PropertyTreeFactory extends CompressedPropertyTreeFactory {
|
|
100
|
+
async load(runtime, id, services, attributes, url) {
|
|
101
|
+
return await super.load(runtime, id, services, attributes, url);
|
|
102
|
+
}
|
|
103
|
+
create(document, id, requestUrl) {
|
|
104
|
+
return super.create(document, id, requestUrl);
|
|
105
|
+
}
|
|
106
|
+
get type() {
|
|
107
|
+
return LZ4PropertyTreeFactory.Type;
|
|
108
|
+
}
|
|
109
|
+
get attributes() {
|
|
110
|
+
return LZ4PropertyTreeFactory.Attributes;
|
|
111
|
+
}
|
|
112
|
+
getEncodeFce() { return lz4js_1.compress; }
|
|
113
|
+
getDecodeFce() { return lz4js_1.decompress; }
|
|
114
|
+
newPropertyTree(id, runtime, attributes, options, propertyTreeConfig) {
|
|
115
|
+
return new propertyTreeExt_1.LZ4PropertyTree(id, runtime, attributes, options, propertyTreeConfig);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.LZ4PropertyTreeFactory = LZ4PropertyTreeFactory;
|
|
119
|
+
LZ4PropertyTreeFactory.Type = "LZ4PropertyTree:84534a0fe613522101f6";
|
|
120
|
+
LZ4PropertyTreeFactory.Attributes = {
|
|
121
|
+
type: LZ4PropertyTreeFactory.Type,
|
|
122
|
+
snapshotFormatVersion: "0.1",
|
|
123
|
+
packageVersion: "0.0.1",
|
|
124
|
+
};
|
|
82
125
|
//# sourceMappingURL=propertyTreeExtFactories.js.map
|
|
@@ -1 +1 @@
|
|
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AAG,IAAI,sCAAoB,CAAC,EAAE,EAAE,QAAQ,EAC9C,IAAI,CAAC,UAAU,EAAE,OAAoC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACvE,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IAChB,CAAC;;AArCL,kEAsCC;AArC0B,gCAAI,GAAG,2CAA2C,CAAC;AAEnD,sCAAU,GAAuB;IACpD,IAAI,EAAE,2BAA2B,CAAC,IAAI;IACtC,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,OAAO;CAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { deflate, inflate } from \"pako\";\nimport { bufferToString, stringToBuffer } from \"@fluidframework/common-utils\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { IPropertyTreeMessage, ISharedPropertyTreeEncDec, ISnapshotSummary, SharedPropertyTreeOptions }\nfrom \"./propertyTree\";\nimport { DeflatedPropertyTree } from \"./propertyTreeExt\";\n\nfunction encodeSummary(snapshotSummary: ISnapshotSummary) {\n const summaryStr = JSON.stringify(snapshotSummary);\n const unzipped = new TextEncoder().encode(summaryStr);\n const serializedSummary: Buffer = deflate(unzipped);\n return serializedSummary;\n}\n\nfunction decodeSummary(serializedSummary): ISnapshotSummary {\n const unzipped = inflate(serializedSummary);\n const summaryStr = new TextDecoder().decode(unzipped);\n const snapshotSummary: ISnapshotSummary = JSON.parse(summaryStr);\n return snapshotSummary;\n}\n\nfunction encodeMessage(change: IPropertyTreeMessage) {\n const changeSetStr = JSON.stringify(change.changeSet);\n const unzipped = new TextEncoder().encode(changeSetStr);\n const zipped: Buffer = deflate(unzipped);\n const zippedStr = bufferToString(zipped, \"base64\");\n if (zippedStr.length < changeSetStr.length) {\n // eslint-disable-next-line @typescript-eslint/dot-notation\n change[\"isZipped\"] = \"1\";\n change.changeSet = zippedStr;\n }\n return change;\n}\n\nfunction decodeMessage(transferChange: IPropertyTreeMessage) {\n // eslint-disable-next-line @typescript-eslint/dot-notation\n if (transferChange[\"isZipped\"]) {\n const zipped = stringToBuffer(transferChange.changeSet, \"base64\");\n const unzipped = inflate(zipped);\n const changeSetStr = new TextDecoder().decode(unzipped);\n transferChange.changeSet = JSON.parse(changeSetStr);\n }\n return transferChange;\n}\n\nconst encDec: ISharedPropertyTreeEncDec = {\n messageEncoder: {\n encode: encodeMessage,\n decode: decodeMessage,\n },\n summaryEncoder: {\n encode: encodeSummary,\n decode: decodeSummary,\n },\n};\n\nexport class DeflatedPropertyTreeFactory implements IChannelFactory {\n public static readonly Type = \"DeflatedPropertyTree:84534a0fe613522101f6\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: DeflatedPropertyTreeFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: \"0.0.1\",\n };\n\n public get type() {\n return DeflatedPropertyTreeFactory.Type;\n }\n\n public get attributes() {\n return DeflatedPropertyTreeFactory.Attributes;\n }\n\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes,\n url?: string,\n ): Promise<DeflatedPropertyTree> {\n const options = {};\n const instance = new DeflatedPropertyTree(id, runtime, attributes, options as SharedPropertyTreeOptions\n , { encDec });\n await instance.load(services);\n return instance;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): DeflatedPropertyTree {\n const options = {};\n const cell = new DeflatedPropertyTree(id, document,\n this.attributes, options as SharedPropertyTreeOptions, { encDec });\n cell.initializeLocal();\n return cell;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"propertyTreeExtFactories.js","sourceRoot":"","sources":["../src/propertyTreeExtFactories.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,wDAAwD;AACxD,+BAAwC;AACxC,iCAA6C;AAC7C,+DAA8E;AAY9E,uDAA0E;AAE1E,MAAs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AAU,EACV,QAA0B,EAC1B,UAA8B,EAC9B,GAAY;QAEZ,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,CAAoB,CAAC;IACvF,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU,EAAE,UAAmB;QAC3E,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;IAClD,CAAC;IAED,IAAW,IAAI;QACX,OAAO,sBAAsB,CAAC,IAAI,CAAC;IACvC,CAAC;IAED,IAAW,UAAU;QACjB,OAAO,sBAAsB,CAAC,UAAU,CAAC;IAC7C,CAAC;IAEM,YAAY,KAAK,OAAO,gBAAQ,CAAC,CAAC,CAAC;IACnC,YAAY,KAAK,OAAO,kBAAU,CAAC,CAAC,CAAC;IACrC,eAAe,CAClB,EAAU,EACV,OAA+B,EAC/B,UAA8B,EAC9B,OAAkC,EAClC,kBAAuC;QACvC,OAAO,IAAI,iCAAe,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC;IACrF,CAAC;;AAxCL,wDAyCC;AAxC0B,2BAAI,GAAG,sCAAsC,CAAC;AAE9C,iCAAU,GAAuB;IACpD,IAAI,EAAE,sBAAsB,CAAC,IAAI;IACjC,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,OAAO;CAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint-disable @typescript-eslint/no-unsafe-return */\nimport { deflate, inflate } from \"pako\";\nimport { compress, decompress } from \"lz4js\";\nimport { bufferToString, stringToBuffer } from \"@fluidframework/common-utils\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n IPropertyTreeConfig, IPropertyTreeMessage, ISharedPropertyTreeEncDec,\n ISnapshotSummary, SharedPropertyTree, SharedPropertyTreeOptions,\n}\n from \"./propertyTree\";\nimport { DeflatedPropertyTree, LZ4PropertyTree } from \"./propertyTreeExt\";\n\nexport abstract class CompressedPropertyTreeFactory implements IChannelFactory {\n public abstract get attributes();\n public abstract get type();\n public abstract getEncodeFce();\n public abstract getDecodeFce();\n private createCompressionMethods(encodeFn, decodeFn): ISharedPropertyTreeEncDec {\n return {\n messageEncoder: {\n encode: (change: IPropertyTreeMessage) => {\n const changeSetStr = JSON.stringify(change.changeSet);\n const unzipped = new TextEncoder().encode(changeSetStr);\n const zipped: Buffer = encodeFn(unzipped);\n const zippedStr = bufferToString(zipped, \"base64\");\n if (zippedStr.length < changeSetStr.length) {\n // eslint-disable-next-line @typescript-eslint/dot-notation\n change[\"isZipped\"] = \"1\";\n change.changeSet = zippedStr;\n }\n return change;\n },\n decode: (transferChange: IPropertyTreeMessage) => {\n // eslint-disable-next-line @typescript-eslint/dot-notation\n if (transferChange[\"isZipped\"]) {\n const zipped = new Uint8Array(stringToBuffer(transferChange.changeSet, \"base64\"));\n const unzipped = decodeFn(zipped);\n const changeSetStr = new TextDecoder().decode(unzipped);\n transferChange.changeSet = JSON.parse(changeSetStr);\n }\n return transferChange;\n },\n },\n summaryEncoder: {\n encode: (snapshotSummary: ISnapshotSummary): Buffer => {\n const summaryStr = JSON.stringify(snapshotSummary);\n const unzipped = new TextEncoder().encode(summaryStr);\n const serializedSummary: Buffer = encodeFn(unzipped);\n return serializedSummary;\n },\n decode: (serializedSummary): ISnapshotSummary => {\n const unzipped = decodeFn(serializedSummary);\n const summaryStr = new TextDecoder().decode(unzipped);\n const snapshotSummary: ISnapshotSummary = JSON.parse(summaryStr);\n return snapshotSummary;\n },\n },\n };\n }\n public getEncDec(): ISharedPropertyTreeEncDec {\n return this.createCompressionMethods(this.getEncodeFce(), this.getDecodeFce());\n }\n public abstract newPropertyTree(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n options: SharedPropertyTreeOptions,\n propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree;\n\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes,\n url?: string,\n ): Promise<SharedPropertyTree> {\n const options = {};\n const instance = this.newPropertyTree(id, runtime, attributes,\n options as SharedPropertyTreeOptions\n , { encDec: this.getEncDec() });\n await instance.load(services);\n return instance;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): SharedPropertyTree {\n const options = {};\n const cell = this.newPropertyTree(id, document,\n this.attributes, options as SharedPropertyTreeOptions,\n { encDec: this.getEncDec() });\n cell.initializeLocal();\n return cell;\n }\n}\n\nexport class DeflatedPropertyTreeFactory extends CompressedPropertyTreeFactory {\n public static readonly Type = \"DeflatedPropertyTree:84534a0fe613522101f6\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: DeflatedPropertyTreeFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: \"0.0.1\",\n };\n\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes,\n url?: string,\n ): Promise<DeflatedPropertyTree> {\n return await super.load(runtime, id, services, attributes, url) as DeflatedPropertyTree;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): DeflatedPropertyTree {\n return super.create(document, id, requestUrl);\n }\n\n public get type() {\n return DeflatedPropertyTreeFactory.Type;\n }\n\n public get attributes() {\n return DeflatedPropertyTreeFactory.Attributes;\n }\n\n public getEncodeFce() { return deflate; }\n public getDecodeFce() { return inflate; }\n public newPropertyTree(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n options: SharedPropertyTreeOptions,\n propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree {\n return new DeflatedPropertyTree(id, runtime, attributes, options, propertyTreeConfig);\n }\n}\n\nexport class LZ4PropertyTreeFactory extends CompressedPropertyTreeFactory {\n public static readonly Type = \"LZ4PropertyTree:84534a0fe613522101f6\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: LZ4PropertyTreeFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: \"0.0.1\",\n };\n\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes,\n url?: string,\n ): Promise<LZ4PropertyTree> {\n return await super.load(runtime, id, services, attributes, url) as LZ4PropertyTree;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): LZ4PropertyTree {\n return super.create(document, id, requestUrl);\n }\n\n public get type() {\n return LZ4PropertyTreeFactory.Type;\n }\n\n public get attributes() {\n return LZ4PropertyTreeFactory.Attributes;\n }\n\n public getEncodeFce() { return compress; }\n public getDecodeFce() { return decompress; }\n public newPropertyTree(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n options: SharedPropertyTreeOptions,\n propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree {\n return new LZ4PropertyTree(id, runtime, attributes, options, propertyTreeConfig);\n }\n}\n"]}
|
package/lib/propertyTreeExt.d.ts
CHANGED
|
@@ -12,4 +12,8 @@ export declare class DeflatedPropertyTree extends SharedPropertyTree {
|
|
|
12
12
|
static create(runtime: IFluidDataStoreRuntime, id?: string, queryString?: string): DeflatedPropertyTree;
|
|
13
13
|
static getFactory(): IChannelFactory;
|
|
14
14
|
}
|
|
15
|
+
export declare class LZ4PropertyTree extends SharedPropertyTree {
|
|
16
|
+
static create(runtime: IFluidDataStoreRuntime, id?: string, queryString?: string): LZ4PropertyTree;
|
|
17
|
+
static getFactory(): IChannelFactory;
|
|
18
|
+
}
|
|
15
19
|
//# sourceMappingURL=propertyTreeExt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTreeExt.d.ts","sourceRoot":"","sources":["../src/propertyTreeExt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGpD;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,kBAAkB;WAC1C,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;WAIzE,UAAU,IAAI,eAAe;CAG9C"}
|
|
1
|
+
{"version":3,"file":"propertyTreeExt.d.ts","sourceRoot":"","sources":["../src/propertyTreeExt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGpD;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,kBAAkB;WAC1C,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;WAIzE,UAAU,IAAI,eAAe;CAG9C;AAED,qBAAa,eAAgB,SAAQ,kBAAkB;WACrC,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;WAIzE,UAAU,IAAI,eAAe;CAG9C"}
|
package/lib/propertyTreeExt.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { SharedPropertyTree } from "./propertyTree";
|
|
6
|
-
import { DeflatedPropertyTreeFactory } from "./propertyTreeExtFactories";
|
|
6
|
+
import { DeflatedPropertyTreeFactory, LZ4PropertyTreeFactory } from "./propertyTreeExtFactories";
|
|
7
7
|
/**
|
|
8
8
|
* This class is the extension of SharedPropertyTree which compresses
|
|
9
9
|
* the deltas and summaries communicated to the server by Deflate.
|
|
@@ -16,4 +16,12 @@ export class DeflatedPropertyTree extends SharedPropertyTree {
|
|
|
16
16
|
return new DeflatedPropertyTreeFactory();
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
export class LZ4PropertyTree extends SharedPropertyTree {
|
|
20
|
+
static create(runtime, id, queryString) {
|
|
21
|
+
return runtime.createChannel(id, LZ4PropertyTreeFactory.Type);
|
|
22
|
+
}
|
|
23
|
+
static getFactory() {
|
|
24
|
+
return new LZ4PropertyTreeFactory();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
19
27
|
//# sourceMappingURL=propertyTreeExt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTreeExt.js","sourceRoot":"","sources":["../src/propertyTreeExt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"propertyTreeExt.js","sourceRoot":"","sources":["../src/propertyTreeExt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEjG;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,kBAAkB;IACjD,MAAM,CAAC,MAAM,CAAC,OAA+B,EAAE,EAAW,EAAE,WAAoB;QACnF,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,2BAA2B,CAAC,IAAI,CAAyB,CAAC;IAC/F,CAAC;IAEM,MAAM,CAAC,UAAU;QACpB,OAAO,IAAI,2BAA2B,EAAE,CAAC;IAC7C,CAAC;CACJ;AAED,MAAM,OAAO,eAAgB,SAAQ,kBAAkB;IAC5C,MAAM,CAAC,MAAM,CAAC,OAA+B,EAAE,EAAW,EAAE,WAAoB;QACnF,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,sBAAsB,CAAC,IAAI,CAAoB,CAAC;IACrF,CAAC;IAEM,MAAM,CAAC,UAAU;QACpB,OAAO,IAAI,sBAAsB,EAAE,CAAC;IACxC,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IChannelFactory, IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { SharedPropertyTree } from \"./propertyTree\";\nimport { DeflatedPropertyTreeFactory, LZ4PropertyTreeFactory } from \"./propertyTreeExtFactories\";\n\n/**\n * This class is the extension of SharedPropertyTree which compresses\n * the deltas and summaries communicated to the server by Deflate.\n */\nexport class DeflatedPropertyTree extends SharedPropertyTree {\n public static create(runtime: IFluidDataStoreRuntime, id?: string, queryString?: string) {\n return runtime.createChannel(id, DeflatedPropertyTreeFactory.Type) as DeflatedPropertyTree;\n }\n\n public static getFactory(): IChannelFactory {\n return new DeflatedPropertyTreeFactory();\n }\n}\n\nexport class LZ4PropertyTree extends SharedPropertyTree {\n public static create(runtime: IFluidDataStoreRuntime, id?: string, queryString?: string) {\n return runtime.createChannel(id, LZ4PropertyTreeFactory.Type) as LZ4PropertyTree;\n }\n\n public static getFactory(): IChannelFactory {\n return new LZ4PropertyTreeFactory();\n }\n}\n"]}
|
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
import { IChannelAttributes, IFluidDataStoreRuntime, IChannelServices, IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { IPropertyTreeConfig, ISharedPropertyTreeEncDec, SharedPropertyTree, SharedPropertyTreeOptions } from "./propertyTree";
|
|
3
|
+
import { DeflatedPropertyTree, LZ4PropertyTree } from "./propertyTreeExt";
|
|
4
|
+
export declare abstract class CompressedPropertyTreeFactory implements IChannelFactory {
|
|
5
|
+
abstract get attributes(): any;
|
|
6
|
+
abstract get type(): any;
|
|
7
|
+
abstract getEncodeFce(): any;
|
|
8
|
+
abstract getDecodeFce(): any;
|
|
9
|
+
private createCompressionMethods;
|
|
10
|
+
getEncDec(): ISharedPropertyTreeEncDec;
|
|
11
|
+
abstract newPropertyTree(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, options: SharedPropertyTreeOptions, propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree;
|
|
12
|
+
load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes, url?: string): Promise<SharedPropertyTree>;
|
|
13
|
+
create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): SharedPropertyTree;
|
|
14
|
+
}
|
|
15
|
+
export declare class DeflatedPropertyTreeFactory extends CompressedPropertyTreeFactory {
|
|
4
16
|
static readonly Type = "DeflatedPropertyTree:84534a0fe613522101f6";
|
|
5
17
|
static readonly Attributes: IChannelAttributes;
|
|
6
|
-
get type(): string;
|
|
7
|
-
get attributes(): IChannelAttributes;
|
|
8
18
|
load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes, url?: string): Promise<DeflatedPropertyTree>;
|
|
9
19
|
create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): DeflatedPropertyTree;
|
|
20
|
+
get type(): string;
|
|
21
|
+
get attributes(): IChannelAttributes;
|
|
22
|
+
getEncodeFce(): any;
|
|
23
|
+
getDecodeFce(): any;
|
|
24
|
+
newPropertyTree(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, options: SharedPropertyTreeOptions, propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree;
|
|
25
|
+
}
|
|
26
|
+
export declare class LZ4PropertyTreeFactory extends CompressedPropertyTreeFactory {
|
|
27
|
+
static readonly Type = "LZ4PropertyTree:84534a0fe613522101f6";
|
|
28
|
+
static readonly Attributes: IChannelAttributes;
|
|
29
|
+
load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes, url?: string): Promise<LZ4PropertyTree>;
|
|
30
|
+
create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): LZ4PropertyTree;
|
|
31
|
+
get type(): string;
|
|
32
|
+
get attributes(): IChannelAttributes;
|
|
33
|
+
getEncodeFce(): any;
|
|
34
|
+
getDecodeFce(): any;
|
|
35
|
+
newPropertyTree(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, options: SharedPropertyTreeOptions, propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree;
|
|
10
36
|
}
|
|
11
37
|
//# sourceMappingURL=propertyTreeExtFactories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTreeExtFactories.d.ts","sourceRoot":"","sources":["../src/propertyTreeExtFactories.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"propertyTreeExtFactories.d.ts","sourceRoot":"","sources":["../src/propertyTreeExtFactories.ts"],"names":[],"mappings":"AAQA,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,mBAAmB,EAAwB,yBAAyB,EAClD,kBAAkB,EAAE,yBAAyB,EAClE,MACQ,gBAAgB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE1E,8BAAsB,6BAA8B,YAAW,eAAe;IAC1E,aAAoB,UAAU,QAAG;IACjC,aAAoB,IAAI,QAAG;aACX,YAAY;aACZ,YAAY;IAC5B,OAAO,CAAC,wBAAwB;IA0CzB,SAAS,IAAI,yBAAyB;aAG7B,eAAe,CAC3B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,sBAAsB,EAC/B,UAAU,EAAE,kBAAkB,EAC9B,OAAO,EAAE,yBAAyB,EAClC,kBAAkB,EAAE,mBAAmB,GAAG,kBAAkB;IAEnD,IAAI,CACb,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,M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U,CAAC,EAAE,MAAM,GAAG,eAAe;IAIjG,IAAW,IAAI,WAEd;IAED,IAAW,UAAU,uBAEpB;IAEM,YAAY;IACZ,YAAY;IACZ,eAAe,CAClB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,sBAAsB,EAC/B,UAAU,EAAE,kBAAkB,EAC9B,OAAO,EAAE,yBAAyB,EAClC,kBAAkB,EAAE,mBAAmB,GAAG,kBAAkB;CAGnE"}
|
|
@@ -2,77 +2,118 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
5
6
|
import { deflate, inflate } from "pako";
|
|
7
|
+
import { compress, decompress } from "lz4js";
|
|
6
8
|
import { bufferToString, stringToBuffer } from "@fluidframework/common-utils";
|
|
7
|
-
import { DeflatedPropertyTree } from "./propertyTreeExt";
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
export class DeflatedPropertyTreeFactory {
|
|
53
|
-
get type() {
|
|
54
|
-
return DeflatedPropertyTreeFactory.Type;
|
|
9
|
+
import { DeflatedPropertyTree, LZ4PropertyTree } from "./propertyTreeExt";
|
|
10
|
+
export class CompressedPropertyTreeFactory {
|
|
11
|
+
createCompressionMethods(encodeFn, decodeFn) {
|
|
12
|
+
return {
|
|
13
|
+
messageEncoder: {
|
|
14
|
+
encode: (change) => {
|
|
15
|
+
const changeSetStr = JSON.stringify(change.changeSet);
|
|
16
|
+
const unzipped = new TextEncoder().encode(changeSetStr);
|
|
17
|
+
const zipped = encodeFn(unzipped);
|
|
18
|
+
const zippedStr = bufferToString(zipped, "base64");
|
|
19
|
+
if (zippedStr.length < changeSetStr.length) {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
21
|
+
change["isZipped"] = "1";
|
|
22
|
+
change.changeSet = zippedStr;
|
|
23
|
+
}
|
|
24
|
+
return change;
|
|
25
|
+
},
|
|
26
|
+
decode: (transferChange) => {
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
28
|
+
if (transferChange["isZipped"]) {
|
|
29
|
+
const zipped = new Uint8Array(stringToBuffer(transferChange.changeSet, "base64"));
|
|
30
|
+
const unzipped = decodeFn(zipped);
|
|
31
|
+
const changeSetStr = new TextDecoder().decode(unzipped);
|
|
32
|
+
transferChange.changeSet = JSON.parse(changeSetStr);
|
|
33
|
+
}
|
|
34
|
+
return transferChange;
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
summaryEncoder: {
|
|
38
|
+
encode: (snapshotSummary) => {
|
|
39
|
+
const summaryStr = JSON.stringify(snapshotSummary);
|
|
40
|
+
const unzipped = new TextEncoder().encode(summaryStr);
|
|
41
|
+
const serializedSummary = encodeFn(unzipped);
|
|
42
|
+
return serializedSummary;
|
|
43
|
+
},
|
|
44
|
+
decode: (serializedSummary) => {
|
|
45
|
+
const unzipped = decodeFn(serializedSummary);
|
|
46
|
+
const summaryStr = new TextDecoder().decode(unzipped);
|
|
47
|
+
const snapshotSummary = JSON.parse(summaryStr);
|
|
48
|
+
return snapshotSummary;
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
55
52
|
}
|
|
56
|
-
|
|
57
|
-
return
|
|
53
|
+
getEncDec() {
|
|
54
|
+
return this.createCompressionMethods(this.getEncodeFce(), this.getDecodeFce());
|
|
58
55
|
}
|
|
59
56
|
async load(runtime, id, services, attributes, url) {
|
|
60
57
|
const options = {};
|
|
61
|
-
const instance =
|
|
58
|
+
const instance = this.newPropertyTree(id, runtime, attributes, options, { encDec: this.getEncDec() });
|
|
62
59
|
await instance.load(services);
|
|
63
60
|
return instance;
|
|
64
61
|
}
|
|
65
62
|
create(document, id, requestUrl) {
|
|
66
63
|
const options = {};
|
|
67
|
-
const cell =
|
|
64
|
+
const cell = this.newPropertyTree(id, document, this.attributes, options, { encDec: this.getEncDec() });
|
|
68
65
|
cell.initializeLocal();
|
|
69
66
|
return cell;
|
|
70
67
|
}
|
|
71
68
|
}
|
|
69
|
+
export class DeflatedPropertyTreeFactory extends CompressedPropertyTreeFactory {
|
|
70
|
+
async load(runtime, id, services, attributes, url) {
|
|
71
|
+
return await super.load(runtime, id, services, attributes, url);
|
|
72
|
+
}
|
|
73
|
+
create(document, id, requestUrl) {
|
|
74
|
+
return super.create(document, id, requestUrl);
|
|
75
|
+
}
|
|
76
|
+
get type() {
|
|
77
|
+
return DeflatedPropertyTreeFactory.Type;
|
|
78
|
+
}
|
|
79
|
+
get attributes() {
|
|
80
|
+
return DeflatedPropertyTreeFactory.Attributes;
|
|
81
|
+
}
|
|
82
|
+
getEncodeFce() { return deflate; }
|
|
83
|
+
getDecodeFce() { return inflate; }
|
|
84
|
+
newPropertyTree(id, runtime, attributes, options, propertyTreeConfig) {
|
|
85
|
+
return new DeflatedPropertyTree(id, runtime, attributes, options, propertyTreeConfig);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
72
88
|
DeflatedPropertyTreeFactory.Type = "DeflatedPropertyTree:84534a0fe613522101f6";
|
|
73
89
|
DeflatedPropertyTreeFactory.Attributes = {
|
|
74
90
|
type: DeflatedPropertyTreeFactory.Type,
|
|
75
91
|
snapshotFormatVersion: "0.1",
|
|
76
92
|
packageVersion: "0.0.1",
|
|
77
93
|
};
|
|
94
|
+
export class LZ4PropertyTreeFactory extends CompressedPropertyTreeFactory {
|
|
95
|
+
async load(runtime, id, services, attributes, url) {
|
|
96
|
+
return await super.load(runtime, id, services, attributes, url);
|
|
97
|
+
}
|
|
98
|
+
create(document, id, requestUrl) {
|
|
99
|
+
return super.create(document, id, requestUrl);
|
|
100
|
+
}
|
|
101
|
+
get type() {
|
|
102
|
+
return LZ4PropertyTreeFactory.Type;
|
|
103
|
+
}
|
|
104
|
+
get attributes() {
|
|
105
|
+
return LZ4PropertyTreeFactory.Attributes;
|
|
106
|
+
}
|
|
107
|
+
getEncodeFce() { return compress; }
|
|
108
|
+
getDecodeFce() { return decompress; }
|
|
109
|
+
newPropertyTree(id, runtime, attributes, options, propertyTreeConfig) {
|
|
110
|
+
return new LZ4PropertyTree(id, runtime, attributes, options, propertyTreeConfig);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
LZ4PropertyTreeFactory.Type = "LZ4PropertyTree:84534a0fe613522101f6";
|
|
114
|
+
LZ4PropertyTreeFactory.Attributes = {
|
|
115
|
+
type: LZ4PropertyTreeFactory.Type,
|
|
116
|
+
snapshotFormatVersion: "0.1",
|
|
117
|
+
packageVersion: "0.0.1",
|
|
118
|
+
};
|
|
78
119
|
//# sourceMappingURL=propertyTreeExtFactories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTreeExtFactories.js","sourceRoot":"","sources":["../src/propertyTreeExtFactories.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAS9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC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ChB,CAAC;;AApCsB,gCAAI,GAAG,2CAA2C,CAAC;AAEnD,sCAAU,GAAuB;IACpD,IAAI,EAAE,2BAA2B,CAAC,IAAI;IACtC,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,OAAO;CAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { deflate, inflate } from \"pako\";\nimport { bufferToString, stringToBuffer } from \"@fluidframework/common-utils\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { IPropertyTreeMessage, ISharedPropertyTreeEncDec, ISnapshotSummary, SharedPropertyTreeOptions }\nfrom \"./propertyTree\";\nimport { DeflatedPropertyTree } from \"./propertyTreeExt\";\n\nfunction encodeSummary(snapshotSummary: ISnapshotSummary) {\n const summaryStr = JSON.stringify(snapshotSummary);\n const unzipped = new TextEncoder().encode(summaryStr);\n const serializedSummary: Buffer = deflate(unzipped);\n return serializedSummary;\n}\n\nfunction decodeSummary(serializedSummary): ISnapshotSummary {\n const unzipped = inflate(serializedSummary);\n const summaryStr = new TextDecoder().decode(unzipped);\n const snapshotSummary: ISnapshotSummary = JSON.parse(summaryStr);\n return snapshotSummary;\n}\n\nfunction encodeMessage(change: IPropertyTreeMessage) {\n const changeSetStr = JSON.stringify(change.changeSet);\n const unzipped = new TextEncoder().encode(changeSetStr);\n const zipped: Buffer = deflate(unzipped);\n const zippedStr = bufferToString(zipped, \"base64\");\n if (zippedStr.length < changeSetStr.length) {\n // eslint-disable-next-line @typescript-eslint/dot-notation\n change[\"isZipped\"] = \"1\";\n change.changeSet = zippedStr;\n }\n return change;\n}\n\nfunction decodeMessage(transferChange: IPropertyTreeMessage) {\n // eslint-disable-next-line @typescript-eslint/dot-notation\n if (transferChange[\"isZipped\"]) {\n const zipped = stringToBuffer(transferChange.changeSet, \"base64\");\n const unzipped = inflate(zipped);\n const changeSetStr = new TextDecoder().decode(unzipped);\n transferChange.changeSet = JSON.parse(changeSetStr);\n }\n return transferChange;\n}\n\nconst encDec: ISharedPropertyTreeEncDec = {\n messageEncoder: {\n encode: encodeMessage,\n decode: decodeMessage,\n },\n summaryEncoder: {\n encode: encodeSummary,\n decode: decodeSummary,\n },\n};\n\nexport class DeflatedPropertyTreeFactory implements IChannelFactory {\n public static readonly Type = \"DeflatedPropertyTree:84534a0fe613522101f6\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: DeflatedPropertyTreeFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: \"0.0.1\",\n };\n\n public get type() {\n return DeflatedPropertyTreeFactory.Type;\n }\n\n public get attributes() {\n return DeflatedPropertyTreeFactory.Attributes;\n }\n\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes,\n url?: string,\n ): Promise<DeflatedPropertyTree> {\n const options = {};\n const instance = new DeflatedPropertyTree(id, runtime, attributes, options as SharedPropertyTreeOptions\n , { encDec });\n await instance.load(services);\n return instance;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): DeflatedPropertyTree {\n const options = {};\n const cell = new DeflatedPropertyTree(id, document,\n this.attributes, options as SharedPropertyTreeOptions, { encDec });\n cell.initializeLocal();\n return cell;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"propertyTreeExtFactories.js","sourceRoot":"","sources":["../src/propertyTreeExtFactories.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wDAAwD;AACxD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAY9E,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE1E,MAAM,OAAgB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9B,GAAY;QAEZ,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,CAAoB,CAAC;IACvF,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU,EAAE,UAAmB;QAC3E,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;IAClD,CAAC;IAED,IAAW,IAAI;QACX,OAAO,sBAAsB,CAAC,IAAI,CAAC;IACvC,CAAC;IAED,IAAW,UAAU;QACjB,OAAO,sBAAsB,CAAC,UAAU,CAAC;IAC7C,CAAC;IAEM,YAAY,KAAK,OAAO,QAAQ,CAAC,CAAC,CAAC;IACnC,YAAY,KAAK,OAAO,UAAU,CAAC,CAAC,CAAC;IACrC,eAAe,CAClB,EAAU,EACV,OAA+B,EAC/B,UAA8B,EAC9B,OAAkC,EAClC,kBAAuC;QACvC,OAAO,IAAI,eAAe,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC;IACrF,CAAC;;AAvCsB,2BAAI,GAAG,sCAAsC,CAAC;AAE9C,iCAAU,GAAuB;IACpD,IAAI,EAAE,sBAAsB,CAAC,IAAI;IACjC,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,OAAO;CAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint-disable @typescript-eslint/no-unsafe-return */\nimport { deflate, inflate } from \"pako\";\nimport { compress, decompress } from \"lz4js\";\nimport { bufferToString, stringToBuffer } from \"@fluidframework/common-utils\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n IPropertyTreeConfig, IPropertyTreeMessage, ISharedPropertyTreeEncDec,\n ISnapshotSummary, SharedPropertyTree, SharedPropertyTreeOptions,\n}\n from \"./propertyTree\";\nimport { DeflatedPropertyTree, LZ4PropertyTree } from \"./propertyTreeExt\";\n\nexport abstract class CompressedPropertyTreeFactory implements IChannelFactory {\n public abstract get attributes();\n public abstract get type();\n public abstract getEncodeFce();\n public abstract getDecodeFce();\n private createCompressionMethods(encodeFn, decodeFn): ISharedPropertyTreeEncDec {\n return {\n messageEncoder: {\n encode: (change: IPropertyTreeMessage) => {\n const changeSetStr = JSON.stringify(change.changeSet);\n const unzipped = new TextEncoder().encode(changeSetStr);\n const zipped: Buffer = encodeFn(unzipped);\n const zippedStr = bufferToString(zipped, \"base64\");\n if (zippedStr.length < changeSetStr.length) {\n // eslint-disable-next-line @typescript-eslint/dot-notation\n change[\"isZipped\"] = \"1\";\n change.changeSet = zippedStr;\n }\n return change;\n },\n decode: (transferChange: IPropertyTreeMessage) => {\n // eslint-disable-next-line @typescript-eslint/dot-notation\n if (transferChange[\"isZipped\"]) {\n const zipped = new Uint8Array(stringToBuffer(transferChange.changeSet, \"base64\"));\n const unzipped = decodeFn(zipped);\n const changeSetStr = new TextDecoder().decode(unzipped);\n transferChange.changeSet = JSON.parse(changeSetStr);\n }\n return transferChange;\n },\n },\n summaryEncoder: {\n encode: (snapshotSummary: ISnapshotSummary): Buffer => {\n const summaryStr = JSON.stringify(snapshotSummary);\n const unzipped = new TextEncoder().encode(summaryStr);\n const serializedSummary: Buffer = encodeFn(unzipped);\n return serializedSummary;\n },\n decode: (serializedSummary): ISnapshotSummary => {\n const unzipped = decodeFn(serializedSummary);\n const summaryStr = new TextDecoder().decode(unzipped);\n const snapshotSummary: ISnapshotSummary = JSON.parse(summaryStr);\n return snapshotSummary;\n },\n },\n };\n }\n public getEncDec(): ISharedPropertyTreeEncDec {\n return this.createCompressionMethods(this.getEncodeFce(), this.getDecodeFce());\n }\n public abstract newPropertyTree(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n options: SharedPropertyTreeOptions,\n propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree;\n\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes,\n url?: string,\n ): Promise<SharedPropertyTree> {\n const options = {};\n const instance = this.newPropertyTree(id, runtime, attributes,\n options as SharedPropertyTreeOptions\n , { encDec: this.getEncDec() });\n await instance.load(services);\n return instance;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): SharedPropertyTree {\n const options = {};\n const cell = this.newPropertyTree(id, document,\n this.attributes, options as SharedPropertyTreeOptions,\n { encDec: this.getEncDec() });\n cell.initializeLocal();\n return cell;\n }\n}\n\nexport class DeflatedPropertyTreeFactory extends CompressedPropertyTreeFactory {\n public static readonly Type = \"DeflatedPropertyTree:84534a0fe613522101f6\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: DeflatedPropertyTreeFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: \"0.0.1\",\n };\n\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes,\n url?: string,\n ): Promise<DeflatedPropertyTree> {\n return await super.load(runtime, id, services, attributes, url) as DeflatedPropertyTree;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): DeflatedPropertyTree {\n return super.create(document, id, requestUrl);\n }\n\n public get type() {\n return DeflatedPropertyTreeFactory.Type;\n }\n\n public get attributes() {\n return DeflatedPropertyTreeFactory.Attributes;\n }\n\n public getEncodeFce() { return deflate; }\n public getDecodeFce() { return inflate; }\n public newPropertyTree(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n options: SharedPropertyTreeOptions,\n propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree {\n return new DeflatedPropertyTree(id, runtime, attributes, options, propertyTreeConfig);\n }\n}\n\nexport class LZ4PropertyTreeFactory extends CompressedPropertyTreeFactory {\n public static readonly Type = \"LZ4PropertyTree:84534a0fe613522101f6\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: LZ4PropertyTreeFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: \"0.0.1\",\n };\n\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes,\n url?: string,\n ): Promise<LZ4PropertyTree> {\n return await super.load(runtime, id, services, attributes, url) as LZ4PropertyTree;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): LZ4PropertyTree {\n return super.create(document, id, requestUrl);\n }\n\n public get type() {\n return LZ4PropertyTreeFactory.Type;\n }\n\n public get attributes() {\n return LZ4PropertyTreeFactory.Attributes;\n }\n\n public getEncodeFce() { return compress; }\n public getDecodeFce() { return decompress; }\n public newPropertyTree(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n options: SharedPropertyTreeOptions,\n propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree {\n return new LZ4PropertyTree(id, runtime, attributes, options, propertyTreeConfig);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-experimental/property-dds",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.0.0-dev.1.3.0.96595",
|
|
4
4
|
"description": "definition of the property distributed data store",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,40 +35,41 @@
|
|
|
35
35
|
"tsc": "tsc"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluid-experimental/property-changeset": "
|
|
39
|
-
"@fluid-experimental/property-properties": "
|
|
40
|
-
"@fluidframework/common-utils": "^0.
|
|
41
|
-
"@fluidframework/container-definitions": "
|
|
42
|
-
"@fluidframework/core-interfaces": "
|
|
43
|
-
"@fluidframework/datastore-definitions": "
|
|
44
|
-
"@fluidframework/protocol-definitions": "^0.
|
|
45
|
-
"@fluidframework/runtime-definitions": "
|
|
46
|
-
"@fluidframework/runtime-utils": "
|
|
47
|
-
"@fluidframework/shared-object-base": "
|
|
38
|
+
"@fluid-experimental/property-changeset": "2.0.0-dev.1.3.0.96595",
|
|
39
|
+
"@fluid-experimental/property-properties": "2.0.0-dev.1.3.0.96595",
|
|
40
|
+
"@fluidframework/common-utils": "^1.0.0",
|
|
41
|
+
"@fluidframework/container-definitions": "2.0.0-dev.1.3.0.96595",
|
|
42
|
+
"@fluidframework/core-interfaces": "2.0.0-dev.1.3.0.96595",
|
|
43
|
+
"@fluidframework/datastore-definitions": "2.0.0-dev.1.3.0.96595",
|
|
44
|
+
"@fluidframework/protocol-definitions": "^1.0.0",
|
|
45
|
+
"@fluidframework/runtime-definitions": "2.0.0-dev.1.3.0.96595",
|
|
46
|
+
"@fluidframework/runtime-utils": "2.0.0-dev.1.3.0.96595",
|
|
47
|
+
"@fluidframework/shared-object-base": "2.0.0-dev.1.3.0.96595",
|
|
48
48
|
"axios": "^0.26.0",
|
|
49
49
|
"fastest-json-copy": "^1.0.1",
|
|
50
50
|
"lodash": "^4.17.21",
|
|
51
|
+
"lz4js": "^0.2.0",
|
|
51
52
|
"msgpackr": "^1.4.7",
|
|
52
53
|
"pako": "^2.0.4",
|
|
53
54
|
"uuid": "^8.3.1"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
|
-
"@fluid-experimental/property-common": "
|
|
57
|
-
"@fluidframework/build-common": "^0.
|
|
58
|
-
"@fluidframework/driver-definitions": "
|
|
59
|
-
"@fluidframework/eslint-config-fluid": "^0.
|
|
60
|
-
"@fluidframework/local-driver": "
|
|
61
|
-
"@fluidframework/mocha-test-setup": "
|
|
62
|
-
"@fluidframework/sequence": "
|
|
63
|
-
"@fluidframework/server-local-server": "^0.
|
|
64
|
-
"@fluidframework/test-runtime-utils": "
|
|
65
|
-
"@fluidframework/test-utils": "
|
|
57
|
+
"@fluid-experimental/property-common": "2.0.0-dev.1.3.0.96595",
|
|
58
|
+
"@fluidframework/build-common": "^1.0.0",
|
|
59
|
+
"@fluidframework/driver-definitions": "2.0.0-dev.1.3.0.96595",
|
|
60
|
+
"@fluidframework/eslint-config-fluid": "^1.0.0",
|
|
61
|
+
"@fluidframework/local-driver": "2.0.0-dev.1.3.0.96595",
|
|
62
|
+
"@fluidframework/mocha-test-setup": "2.0.0-dev.1.3.0.96595",
|
|
63
|
+
"@fluidframework/sequence": "2.0.0-dev.1.3.0.96595",
|
|
64
|
+
"@fluidframework/server-local-server": "^0.1037.2001",
|
|
65
|
+
"@fluidframework/test-runtime-utils": "2.0.0-dev.1.3.0.96595",
|
|
66
|
+
"@fluidframework/test-utils": "2.0.0-dev.1.3.0.96595",
|
|
66
67
|
"@microsoft/api-extractor": "^7.22.2",
|
|
67
68
|
"@rushstack/eslint-config": "^2.5.1",
|
|
68
69
|
"@types/mocha": "^9.1.1",
|
|
69
70
|
"chai": "^4.2.0",
|
|
70
71
|
"concurrently": "^6.2.0",
|
|
71
|
-
"copyfiles": "^2.1
|
|
72
|
+
"copyfiles": "^2.4.1",
|
|
72
73
|
"cross-env": "^7.0.2",
|
|
73
74
|
"easy-table": "^1.1.1",
|
|
74
75
|
"env-cmd": "^10.1.0",
|
package/src/propertyTreeExt.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { IChannelFactory, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
|
|
7
7
|
import { SharedPropertyTree } from "./propertyTree";
|
|
8
|
-
import { DeflatedPropertyTreeFactory } from "./propertyTreeExtFactories";
|
|
8
|
+
import { DeflatedPropertyTreeFactory, LZ4PropertyTreeFactory } from "./propertyTreeExtFactories";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* This class is the extension of SharedPropertyTree which compresses
|
|
@@ -20,3 +20,13 @@ export class DeflatedPropertyTree extends SharedPropertyTree {
|
|
|
20
20
|
return new DeflatedPropertyTreeFactory();
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
export class LZ4PropertyTree extends SharedPropertyTree {
|
|
25
|
+
public static create(runtime: IFluidDataStoreRuntime, id?: string, queryString?: string) {
|
|
26
|
+
return runtime.createChannel(id, LZ4PropertyTreeFactory.Type) as LZ4PropertyTree;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public static getFactory(): IChannelFactory {
|
|
30
|
+
return new LZ4PropertyTreeFactory();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
5
6
|
import { deflate, inflate } from "pako";
|
|
7
|
+
import { compress, decompress } from "lz4js";
|
|
6
8
|
import { bufferToString, stringToBuffer } from "@fluidframework/common-utils";
|
|
7
9
|
import {
|
|
8
10
|
IChannelAttributes,
|
|
@@ -10,60 +12,96 @@ import {
|
|
|
10
12
|
IChannelServices,
|
|
11
13
|
IChannelFactory,
|
|
12
14
|
} from "@fluidframework/datastore-definitions";
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function encodeSummary(snapshotSummary: ISnapshotSummary) {
|
|
18
|
-
const summaryStr = JSON.stringify(snapshotSummary);
|
|
19
|
-
const unzipped = new TextEncoder().encode(summaryStr);
|
|
20
|
-
const serializedSummary: Buffer = deflate(unzipped);
|
|
21
|
-
return serializedSummary;
|
|
15
|
+
import {
|
|
16
|
+
IPropertyTreeConfig, IPropertyTreeMessage, ISharedPropertyTreeEncDec,
|
|
17
|
+
ISnapshotSummary, SharedPropertyTree, SharedPropertyTreeOptions,
|
|
22
18
|
}
|
|
19
|
+
from "./propertyTree";
|
|
20
|
+
import { DeflatedPropertyTree, LZ4PropertyTree } from "./propertyTreeExt";
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
export abstract class CompressedPropertyTreeFactory implements IChannelFactory {
|
|
23
|
+
public abstract get attributes();
|
|
24
|
+
public abstract get type();
|
|
25
|
+
public abstract getEncodeFce();
|
|
26
|
+
public abstract getDecodeFce();
|
|
27
|
+
private createCompressionMethods(encodeFn, decodeFn): ISharedPropertyTreeEncDec {
|
|
28
|
+
return {
|
|
29
|
+
messageEncoder: {
|
|
30
|
+
encode: (change: IPropertyTreeMessage) => {
|
|
31
|
+
const changeSetStr = JSON.stringify(change.changeSet);
|
|
32
|
+
const unzipped = new TextEncoder().encode(changeSetStr);
|
|
33
|
+
const zipped: Buffer = encodeFn(unzipped);
|
|
34
|
+
const zippedStr = bufferToString(zipped, "base64");
|
|
35
|
+
if (zippedStr.length < changeSetStr.length) {
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
37
|
+
change["isZipped"] = "1";
|
|
38
|
+
change.changeSet = zippedStr;
|
|
39
|
+
}
|
|
40
|
+
return change;
|
|
41
|
+
},
|
|
42
|
+
decode: (transferChange: IPropertyTreeMessage) => {
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
44
|
+
if (transferChange["isZipped"]) {
|
|
45
|
+
const zipped = new Uint8Array(stringToBuffer(transferChange.changeSet, "base64"));
|
|
46
|
+
const unzipped = decodeFn(zipped);
|
|
47
|
+
const changeSetStr = new TextDecoder().decode(unzipped);
|
|
48
|
+
transferChange.changeSet = JSON.parse(changeSetStr);
|
|
49
|
+
}
|
|
50
|
+
return transferChange;
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
summaryEncoder: {
|
|
54
|
+
encode: (snapshotSummary: ISnapshotSummary): Buffer => {
|
|
55
|
+
const summaryStr = JSON.stringify(snapshotSummary);
|
|
56
|
+
const unzipped = new TextEncoder().encode(summaryStr);
|
|
57
|
+
const serializedSummary: Buffer = encodeFn(unzipped);
|
|
58
|
+
return serializedSummary;
|
|
59
|
+
},
|
|
60
|
+
decode: (serializedSummary): ISnapshotSummary => {
|
|
61
|
+
const unzipped = decodeFn(serializedSummary);
|
|
62
|
+
const summaryStr = new TextDecoder().decode(unzipped);
|
|
63
|
+
const snapshotSummary: ISnapshotSummary = JSON.parse(summaryStr);
|
|
64
|
+
return snapshotSummary;
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
public getEncDec(): ISharedPropertyTreeEncDec {
|
|
70
|
+
return this.createCompressionMethods(this.getEncodeFce(), this.getDecodeFce());
|
|
71
|
+
}
|
|
72
|
+
public abstract newPropertyTree(
|
|
73
|
+
id: string,
|
|
74
|
+
runtime: IFluidDataStoreRuntime,
|
|
75
|
+
attributes: IChannelAttributes,
|
|
76
|
+
options: SharedPropertyTreeOptions,
|
|
77
|
+
propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree;
|
|
30
78
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
79
|
+
public async load(
|
|
80
|
+
runtime: IFluidDataStoreRuntime,
|
|
81
|
+
id: string,
|
|
82
|
+
services: IChannelServices,
|
|
83
|
+
attributes: IChannelAttributes,
|
|
84
|
+
url?: string,
|
|
85
|
+
): Promise<SharedPropertyTree> {
|
|
86
|
+
const options = {};
|
|
87
|
+
const instance = this.newPropertyTree(id, runtime, attributes,
|
|
88
|
+
options as SharedPropertyTreeOptions
|
|
89
|
+
, { encDec: this.getEncDec() });
|
|
90
|
+
await instance.load(services);
|
|
91
|
+
return instance;
|
|
40
92
|
}
|
|
41
|
-
return change;
|
|
42
|
-
}
|
|
43
93
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
94
|
+
public create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): SharedPropertyTree {
|
|
95
|
+
const options = {};
|
|
96
|
+
const cell = this.newPropertyTree(id, document,
|
|
97
|
+
this.attributes, options as SharedPropertyTreeOptions,
|
|
98
|
+
{ encDec: this.getEncDec() });
|
|
99
|
+
cell.initializeLocal();
|
|
100
|
+
return cell;
|
|
51
101
|
}
|
|
52
|
-
return transferChange;
|
|
53
102
|
}
|
|
54
103
|
|
|
55
|
-
|
|
56
|
-
messageEncoder: {
|
|
57
|
-
encode: encodeMessage,
|
|
58
|
-
decode: decodeMessage,
|
|
59
|
-
},
|
|
60
|
-
summaryEncoder: {
|
|
61
|
-
encode: encodeSummary,
|
|
62
|
-
decode: decodeSummary,
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export class DeflatedPropertyTreeFactory implements IChannelFactory {
|
|
104
|
+
export class DeflatedPropertyTreeFactory extends CompressedPropertyTreeFactory {
|
|
67
105
|
public static readonly Type = "DeflatedPropertyTree:84534a0fe613522101f6";
|
|
68
106
|
|
|
69
107
|
public static readonly Attributes: IChannelAttributes = {
|
|
@@ -72,6 +110,20 @@ export class DeflatedPropertyTreeFactory implements IChannelFactory {
|
|
|
72
110
|
packageVersion: "0.0.1",
|
|
73
111
|
};
|
|
74
112
|
|
|
113
|
+
public async load(
|
|
114
|
+
runtime: IFluidDataStoreRuntime,
|
|
115
|
+
id: string,
|
|
116
|
+
services: IChannelServices,
|
|
117
|
+
attributes: IChannelAttributes,
|
|
118
|
+
url?: string,
|
|
119
|
+
): Promise<DeflatedPropertyTree> {
|
|
120
|
+
return await super.load(runtime, id, services, attributes, url) as DeflatedPropertyTree;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
public create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): DeflatedPropertyTree {
|
|
124
|
+
return super.create(document, id, requestUrl);
|
|
125
|
+
}
|
|
126
|
+
|
|
75
127
|
public get type() {
|
|
76
128
|
return DeflatedPropertyTreeFactory.Type;
|
|
77
129
|
}
|
|
@@ -80,25 +132,57 @@ export class DeflatedPropertyTreeFactory implements IChannelFactory {
|
|
|
80
132
|
return DeflatedPropertyTreeFactory.Attributes;
|
|
81
133
|
}
|
|
82
134
|
|
|
135
|
+
public getEncodeFce() { return deflate; }
|
|
136
|
+
public getDecodeFce() { return inflate; }
|
|
137
|
+
public newPropertyTree(
|
|
138
|
+
id: string,
|
|
139
|
+
runtime: IFluidDataStoreRuntime,
|
|
140
|
+
attributes: IChannelAttributes,
|
|
141
|
+
options: SharedPropertyTreeOptions,
|
|
142
|
+
propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree {
|
|
143
|
+
return new DeflatedPropertyTree(id, runtime, attributes, options, propertyTreeConfig);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export class LZ4PropertyTreeFactory extends CompressedPropertyTreeFactory {
|
|
148
|
+
public static readonly Type = "LZ4PropertyTree:84534a0fe613522101f6";
|
|
149
|
+
|
|
150
|
+
public static readonly Attributes: IChannelAttributes = {
|
|
151
|
+
type: LZ4PropertyTreeFactory.Type,
|
|
152
|
+
snapshotFormatVersion: "0.1",
|
|
153
|
+
packageVersion: "0.0.1",
|
|
154
|
+
};
|
|
155
|
+
|
|
83
156
|
public async load(
|
|
84
157
|
runtime: IFluidDataStoreRuntime,
|
|
85
158
|
id: string,
|
|
86
159
|
services: IChannelServices,
|
|
87
160
|
attributes: IChannelAttributes,
|
|
88
161
|
url?: string,
|
|
89
|
-
): Promise<
|
|
90
|
-
|
|
91
|
-
const instance = new DeflatedPropertyTree(id, runtime, attributes, options as SharedPropertyTreeOptions
|
|
92
|
-
, { encDec });
|
|
93
|
-
await instance.load(services);
|
|
94
|
-
return instance;
|
|
162
|
+
): Promise<LZ4PropertyTree> {
|
|
163
|
+
return await super.load(runtime, id, services, attributes, url) as LZ4PropertyTree;
|
|
95
164
|
}
|
|
96
165
|
|
|
97
|
-
public create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string):
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return
|
|
166
|
+
public create(document: IFluidDataStoreRuntime, id: string, requestUrl?: string): LZ4PropertyTree {
|
|
167
|
+
return super.create(document, id, requestUrl);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
public get type() {
|
|
171
|
+
return LZ4PropertyTreeFactory.Type;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
public get attributes() {
|
|
175
|
+
return LZ4PropertyTreeFactory.Attributes;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
public getEncodeFce() { return compress; }
|
|
179
|
+
public getDecodeFce() { return decompress; }
|
|
180
|
+
public newPropertyTree(
|
|
181
|
+
id: string,
|
|
182
|
+
runtime: IFluidDataStoreRuntime,
|
|
183
|
+
attributes: IChannelAttributes,
|
|
184
|
+
options: SharedPropertyTreeOptions,
|
|
185
|
+
propertyTreeConfig: IPropertyTreeConfig): SharedPropertyTree {
|
|
186
|
+
return new LZ4PropertyTree(id, runtime, attributes, options, propertyTreeConfig);
|
|
103
187
|
}
|
|
104
188
|
}
|