@fluidframework/driver-utils 2.0.0-internal.3.4.2 → 2.0.0-internal.4.0.1
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/index.d.ts +3 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -21
- package/dist/index.js.map +1 -1
- package/dist/messageRecognition.d.ts +0 -20
- package/dist/messageRecognition.d.ts.map +1 -1
- package/dist/messageRecognition.js +1 -37
- package/dist/messageRecognition.js.map +1 -1
- package/dist/network.d.ts +0 -15
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts +0 -12
- package/dist/networkUtils.d.ts.map +1 -1
- package/dist/networkUtils.js +1 -34
- package/dist/networkUtils.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/index.d.ts +3 -10
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -9
- package/lib/index.js.map +1 -1
- package/lib/messageRecognition.d.ts +0 -20
- package/lib/messageRecognition.d.ts.map +1 -1
- package/lib/messageRecognition.js +0 -35
- package/lib/messageRecognition.js.map +1 -1
- package/lib/network.d.ts +0 -15
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js.map +1 -1
- package/lib/networkUtils.d.ts +0 -12
- package/lib/networkUtils.d.ts.map +1 -1
- package/lib/networkUtils.js +0 -32
- package/lib/networkUtils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +64 -7
- package/src/index.ts +2 -19
- package/src/messageRecognition.ts +0 -36
- package/src/network.ts +0 -16
- package/src/networkUtils.ts +0 -34
- package/src/packageVersion.ts +1 -1
- package/dist/blobAggregationStorage.d.ts +0 -56
- package/dist/blobAggregationStorage.d.ts.map +0 -1
- package/dist/blobAggregationStorage.js +0 -327
- package/dist/blobAggregationStorage.js.map +0 -1
- package/dist/blobCacheStorageService.d.ts +0 -27
- package/dist/blobCacheStorageService.d.ts.map +0 -1
- package/dist/blobCacheStorageService.js +0 -40
- package/dist/blobCacheStorageService.js.map +0 -1
- package/dist/emptyDocumentDeltaStorageService.d.ts +0 -18
- package/dist/emptyDocumentDeltaStorageService.d.ts.map +0 -1
- package/dist/emptyDocumentDeltaStorageService.js +0 -25
- package/dist/emptyDocumentDeltaStorageService.js.map +0 -1
- package/dist/mapWithExpiration.d.ts +0 -75
- package/dist/mapWithExpiration.d.ts.map +0 -1
- package/dist/mapWithExpiration.js +0 -146
- package/dist/mapWithExpiration.js.map +0 -1
- package/dist/multiDocumentServiceFactory.d.ts +0 -34
- package/dist/multiDocumentServiceFactory.d.ts.map +0 -1
- package/dist/multiDocumentServiceFactory.js +0 -81
- package/dist/multiDocumentServiceFactory.js.map +0 -1
- package/dist/multiUrlResolver.d.ts +0 -34
- package/dist/multiUrlResolver.d.ts.map +0 -1
- package/dist/multiUrlResolver.js +0 -59
- package/dist/multiUrlResolver.js.map +0 -1
- package/dist/treeUtils.d.ts +0 -72
- package/dist/treeUtils.d.ts.map +0 -1
- package/dist/treeUtils.js +0 -102
- package/dist/treeUtils.js.map +0 -1
- package/lib/blobAggregationStorage.d.ts +0 -56
- package/lib/blobAggregationStorage.d.ts.map +0 -1
- package/lib/blobAggregationStorage.js +0 -322
- package/lib/blobAggregationStorage.js.map +0 -1
- package/lib/blobCacheStorageService.d.ts +0 -27
- package/lib/blobCacheStorageService.d.ts.map +0 -1
- package/lib/blobCacheStorageService.js +0 -36
- package/lib/blobCacheStorageService.js.map +0 -1
- package/lib/emptyDocumentDeltaStorageService.d.ts +0 -18
- package/lib/emptyDocumentDeltaStorageService.d.ts.map +0 -1
- package/lib/emptyDocumentDeltaStorageService.js +0 -21
- package/lib/emptyDocumentDeltaStorageService.js.map +0 -1
- package/lib/mapWithExpiration.d.ts +0 -75
- package/lib/mapWithExpiration.d.ts.map +0 -1
- package/lib/mapWithExpiration.js +0 -142
- package/lib/mapWithExpiration.js.map +0 -1
- package/lib/multiDocumentServiceFactory.d.ts +0 -34
- package/lib/multiDocumentServiceFactory.d.ts.map +0 -1
- package/lib/multiDocumentServiceFactory.js +0 -77
- package/lib/multiDocumentServiceFactory.js.map +0 -1
- package/lib/multiUrlResolver.d.ts +0 -34
- package/lib/multiUrlResolver.d.ts.map +0 -1
- package/lib/multiUrlResolver.js +0 -54
- package/lib/multiUrlResolver.js.map +0 -1
- package/lib/treeUtils.d.ts +0 -72
- package/lib/treeUtils.d.ts.map +0 -1
- package/lib/treeUtils.js +0 -97
- package/lib/treeUtils.js.map +0 -1
- package/src/blobAggregationStorage.ts +0 -430
- package/src/blobCacheStorageService.ts +0 -46
- package/src/emptyDocumentDeltaStorageService.ts +0 -30
- package/src/mapWithExpiration.ts +0 -165
- package/src/multiDocumentServiceFactory.ts +0 -109
- package/src/multiUrlResolver.ts +0 -62
- package/src/treeUtils.ts +0 -128
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.BlobAggregationStorage = exports.SnapshotExtractor = void 0;
|
|
8
|
-
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
9
|
-
const common_utils_1 = require("@fluidframework/common-utils");
|
|
10
|
-
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
11
|
-
/*
|
|
12
|
-
* Work around for bufferToString having a bug - it can't consume IsoBuffer!
|
|
13
|
-
* To be removed once bufferToString is fixed!
|
|
14
|
-
*/
|
|
15
|
-
function bufferToString2(blob, encoding) {
|
|
16
|
-
if (blob instanceof Uint8Array) {
|
|
17
|
-
// IsoBuffer does not have ctor, so it's not in proto chain :(
|
|
18
|
-
return (0, common_utils_1.Uint8ArrayToString)(blob, encoding);
|
|
19
|
-
}
|
|
20
|
-
return (0, common_utils_1.bufferToString)(blob, encoding);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Class responsible for aggregating smaller blobs into one and unpacking it later on.
|
|
24
|
-
*/
|
|
25
|
-
class BlobAggregator {
|
|
26
|
-
constructor() {
|
|
27
|
-
this.content = [];
|
|
28
|
-
}
|
|
29
|
-
addBlob(key, content) {
|
|
30
|
-
this.content.push([key, content]);
|
|
31
|
-
}
|
|
32
|
-
getAggregatedBlobContent() {
|
|
33
|
-
if (this.content.length === 0) {
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
return JSON.stringify(this.content);
|
|
37
|
-
}
|
|
38
|
-
static load(input) {
|
|
39
|
-
const data = bufferToString2(input, "utf-8");
|
|
40
|
-
return JSON.parse(data);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Base class that deals with unpacking snapshots (in place) containing aggregated blobs
|
|
45
|
-
* It relies on abstract methods for reads and storing unpacked blobs.
|
|
46
|
-
*
|
|
47
|
-
* @deprecated This class was introduced experimentally and is no longer used.
|
|
48
|
-
*/
|
|
49
|
-
class SnapshotExtractor {
|
|
50
|
-
constructor() {
|
|
51
|
-
this.aggregatedBlobName = "__big";
|
|
52
|
-
this.virtualIdPrefix = "__";
|
|
53
|
-
// counter for generation of virtual storage IDs
|
|
54
|
-
this.virtualIdCounter = 0;
|
|
55
|
-
}
|
|
56
|
-
getNextVirtualId() {
|
|
57
|
-
return `${this.virtualIdPrefix}${++this.virtualIdCounter}`;
|
|
58
|
-
}
|
|
59
|
-
async unpackSnapshotCore(snapshot, level = 0) {
|
|
60
|
-
for (const key of Object.keys(snapshot.trees)) {
|
|
61
|
-
const obj = snapshot.trees[key];
|
|
62
|
-
await this.unpackSnapshotCore(obj, level + 1);
|
|
63
|
-
}
|
|
64
|
-
// For future proof, we will support multiple aggregated blobs with any name
|
|
65
|
-
// that starts with this.aggregatedBlobName
|
|
66
|
-
for (const key of Object.keys(snapshot.blobs)) {
|
|
67
|
-
if (!key.startsWith(this.aggregatedBlobName)) {
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
const blobId = snapshot.blobs[key];
|
|
71
|
-
if (blobId !== undefined) {
|
|
72
|
-
const blob = await this.getBlob(blobId, snapshot);
|
|
73
|
-
for (const [path, value] of BlobAggregator.load(blob)) {
|
|
74
|
-
const id = this.getNextVirtualId();
|
|
75
|
-
this.setBlob(id, snapshot, value);
|
|
76
|
-
const pathSplit = path.split("/");
|
|
77
|
-
let subTree = snapshot;
|
|
78
|
-
for (const subPath of pathSplit.slice(0, pathSplit.length - 1)) {
|
|
79
|
-
if (subTree.trees[subPath] === undefined) {
|
|
80
|
-
subTree.trees[subPath] = { blobs: {}, trees: {} };
|
|
81
|
-
}
|
|
82
|
-
subTree = subTree.trees[subPath];
|
|
83
|
-
}
|
|
84
|
-
const blobName = pathSplit[pathSplit.length - 1];
|
|
85
|
-
(0, common_utils_1.assert)(subTree.blobs[blobName] === undefined, 0x0f6 /* "real blob ID exists" */);
|
|
86
|
-
subTree.blobs[blobName] = id;
|
|
87
|
-
}
|
|
88
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
89
|
-
delete snapshot.blobs[this.aggregatedBlobName];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
exports.SnapshotExtractor = SnapshotExtractor;
|
|
95
|
-
/*
|
|
96
|
-
* Snapshot extractor class that works in place, i.e. patches snapshot that has
|
|
97
|
-
* blob content in ISnapshotTree.blobs itself, not in storage.
|
|
98
|
-
* As result, it implements reading and writing of blobs to/from snapshot itself.
|
|
99
|
-
* It follows existing pattern that mixes concerns - ISnapshotTree.blobs is used for two
|
|
100
|
-
* purposes:
|
|
101
|
-
* 1. map path name to blob ID
|
|
102
|
-
* 2. map blob ID to blob content
|
|
103
|
-
* #2 is what storage (IDocumentStorageService) is for, but in places where we do not have it
|
|
104
|
-
* (like loading serialized earlier draft content), blob content is put directly into snapshot.
|
|
105
|
-
* Ideally this should be fixed by using BlobCacheStorageService or something similar and
|
|
106
|
-
* fixing existing flows to allow switching of storage.
|
|
107
|
-
*/
|
|
108
|
-
class SnapshotExtractorInPlace extends SnapshotExtractor {
|
|
109
|
-
async getBlob(id, tree) {
|
|
110
|
-
const blob = tree.blobs[id];
|
|
111
|
-
(0, common_utils_1.assert)(blob !== undefined, 0x0f7 /* "aggregate blob missing" */);
|
|
112
|
-
return (0, common_utils_1.stringToBuffer)(blob, "base64");
|
|
113
|
-
}
|
|
114
|
-
setBlob(id, tree, content) {
|
|
115
|
-
(0, common_utils_1.assert)(tree.blobs[id] === undefined, 0x0f8 /* "blob from aggregate blob exists on its own" */);
|
|
116
|
-
tree.blobs[id] = (0, common_utils_1.fromUtf8ToBase64)(content);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Snapshot packer and extractor.
|
|
121
|
-
* When summary is written it will find and aggregate small blobs into bigger blobs
|
|
122
|
-
* When snapshot is read, it will unpack aggregated blobs and provide them transparently to caller.
|
|
123
|
-
*
|
|
124
|
-
* @deprecated This class was introduced experimentally and is no longer used.
|
|
125
|
-
*/
|
|
126
|
-
class BlobAggregationStorage extends SnapshotExtractor {
|
|
127
|
-
constructor(storage, logger, allowPacking, packingLevel, blobCutOffSize) {
|
|
128
|
-
super();
|
|
129
|
-
this.storage = storage;
|
|
130
|
-
this.logger = logger;
|
|
131
|
-
this.allowPacking = allowPacking;
|
|
132
|
-
this.packingLevel = packingLevel;
|
|
133
|
-
this.blobCutOffSize = blobCutOffSize;
|
|
134
|
-
this.loadedFromSummary = false;
|
|
135
|
-
this.virtualBlobs = new Map();
|
|
136
|
-
}
|
|
137
|
-
static wrap(storage, logger, allowPacking, packingLevel = 2) {
|
|
138
|
-
var _a, _b, _c;
|
|
139
|
-
if (storage instanceof BlobAggregationStorage) {
|
|
140
|
-
return storage;
|
|
141
|
-
}
|
|
142
|
-
const mc = (0, telemetry_utils_1.loggerToMonitoringContext)(logger);
|
|
143
|
-
const realAllowPackaging = (_b = (_a = mc.config.getBoolean("FluidAggregateBlobs")) !== null && _a !== void 0 ? _a : allowPacking) !== null && _b !== void 0 ? _b : false;
|
|
144
|
-
// Always create BlobAggregationStorage even if storage is not asking for packing.
|
|
145
|
-
// This is mostly to avoid cases where future changes in policy would result in inability to
|
|
146
|
-
// load old files that were created with aggregation on.
|
|
147
|
-
const minBlobSize = (_c = storage.policies) === null || _c === void 0 ? void 0 : _c.minBlobSize;
|
|
148
|
-
return new BlobAggregationStorage(storage, logger, realAllowPackaging, packingLevel, minBlobSize);
|
|
149
|
-
}
|
|
150
|
-
static async unpackSnapshot(snapshot) {
|
|
151
|
-
const converter = new SnapshotExtractorInPlace();
|
|
152
|
-
await converter.unpackSnapshotCore(snapshot);
|
|
153
|
-
}
|
|
154
|
-
get policies() {
|
|
155
|
-
const policies = this.storage.policies;
|
|
156
|
-
if (policies) {
|
|
157
|
-
return Object.assign(Object.assign({}, policies), { minBlobSize: undefined });
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
async unpackSnapshot(snapshot) {
|
|
161
|
-
// SummarizerNodeWithGC.refreshLatestSummary can call it when this.loadedFromSummary === false
|
|
162
|
-
// (I assumed after file was created)
|
|
163
|
-
// assert(!this.loadedFromSummary, "unpack without summary");
|
|
164
|
-
this.loadedFromSummary = true;
|
|
165
|
-
await this.unpackSnapshotCore(snapshot);
|
|
166
|
-
}
|
|
167
|
-
setBlob(id, tree, content) {
|
|
168
|
-
this.virtualBlobs.set(id, (0, common_utils_1.stringToBuffer)(content, "utf-8"));
|
|
169
|
-
}
|
|
170
|
-
async getBlob(id, tree) {
|
|
171
|
-
return this.readBlob(id).catch((error) => {
|
|
172
|
-
this.logger.sendErrorEvent({ eventName: "BlobDedupNoAggregateBlob" }, error);
|
|
173
|
-
throw error;
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
get repositoryUrl() {
|
|
177
|
-
return this.storage.repositoryUrl;
|
|
178
|
-
}
|
|
179
|
-
async getVersions(versionId, count, scenarioName, fetchSource) {
|
|
180
|
-
return this.storage.getVersions(versionId, count, scenarioName, fetchSource);
|
|
181
|
-
}
|
|
182
|
-
async downloadSummary(handle) {
|
|
183
|
-
throw new Error("NYI");
|
|
184
|
-
}
|
|
185
|
-
// for now we are not optimizing these blobs, with assumption that this API is used only
|
|
186
|
-
// for big blobs (images)
|
|
187
|
-
async createBlob(file) {
|
|
188
|
-
return this.storage.createBlob(file);
|
|
189
|
-
}
|
|
190
|
-
async getSnapshotTree(version) {
|
|
191
|
-
const tree = await this.storage.getSnapshotTree(version);
|
|
192
|
-
if (tree) {
|
|
193
|
-
await this.unpackSnapshot(tree);
|
|
194
|
-
}
|
|
195
|
-
return tree;
|
|
196
|
-
}
|
|
197
|
-
async readBlob(id) {
|
|
198
|
-
if (this.isRealStorageId(id)) {
|
|
199
|
-
return this.storage.readBlob(id);
|
|
200
|
-
}
|
|
201
|
-
// We support only reading blobs from the summary we loaded from.
|
|
202
|
-
// This may need to be extended to any general summary in the future as runtime usage pattern
|
|
203
|
-
// of storage changes (for example, data stores start to load from recent summary, not from original
|
|
204
|
-
// summary whole container loaded from)
|
|
205
|
-
// are there other ways we can get here? createFile is one flow, but we should not be reading blobs
|
|
206
|
-
// in such flow
|
|
207
|
-
(0, common_utils_1.assert)(this.loadedFromSummary, 0x0f9 /* "never read summary" */);
|
|
208
|
-
const blob = this.virtualBlobs.get(id);
|
|
209
|
-
(0, common_utils_1.assert)(blob !== undefined, 0x0fa /* "virtual blob not found" */);
|
|
210
|
-
return blob;
|
|
211
|
-
}
|
|
212
|
-
async uploadSummaryWithContext(summary, context) {
|
|
213
|
-
const summaryNew = this.allowPacking ? await this.compressSmallBlobs(summary) : summary;
|
|
214
|
-
return this.storage.uploadSummaryWithContext(summaryNew, context);
|
|
215
|
-
}
|
|
216
|
-
// For simplification, we assume that
|
|
217
|
-
// - blob aggregation is done at data store level only for now
|
|
218
|
-
// - data store either reuses previous summary, or generates full summary, i.e. there is no partial (some DDS)
|
|
219
|
-
// summary produced by data stores.
|
|
220
|
-
// These simplifications allow us not to touch handles, as they are self-contained (either do not use aggregated
|
|
221
|
-
// blob or contain aggregated blob that stays relevant for that sub-tree)
|
|
222
|
-
// Note:
|
|
223
|
-
// From perf perspective, it makes sense to place aggregated blobs one level up in the tree to not create extra
|
|
224
|
-
// tree nodes (i.e. have shallow tree with less edges). But that creates problems with reusability of trees at
|
|
225
|
-
// incremental summary time - we would need to understand handles and parse them. In current design we can skip
|
|
226
|
-
// that step because if data store is reused, the whole sub-tree is reused including aggregated blob embedded into it
|
|
227
|
-
// and that means we can do nothing and be correct!
|
|
228
|
-
async compressSmallBlobs(summary, path = "", level = 0, aggregatorArg) {
|
|
229
|
-
if (this.blobCutOffSize === undefined || this.blobCutOffSize < 0) {
|
|
230
|
-
return summary;
|
|
231
|
-
}
|
|
232
|
-
let shouldCompress = false;
|
|
233
|
-
let aggregator = aggregatorArg;
|
|
234
|
-
// checking if this is a dataStore tree, since we only pack at data store level
|
|
235
|
-
if (Object.keys(summary.tree).includes(".component")) {
|
|
236
|
-
(0, common_utils_1.assert)(aggregator === undefined, 0x0fb /* "logic err with aggregator" */);
|
|
237
|
-
(0, common_utils_1.assert)(level === this.packingLevel, 0x23b /* "we are not packing at the right level" */);
|
|
238
|
-
aggregator = new BlobAggregator();
|
|
239
|
-
shouldCompress = true;
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
(0, common_utils_1.assert)(level !== this.packingLevel, 0x23c /* "we are not packing at the right level" */);
|
|
243
|
-
}
|
|
244
|
-
const newSummary = Object.assign({}, summary);
|
|
245
|
-
newSummary.tree = Object.assign({}, newSummary.tree);
|
|
246
|
-
for (const key of Object.keys(summary.tree)) {
|
|
247
|
-
const obj = summary.tree[key];
|
|
248
|
-
// Get path relative to root of data store (where we do aggregation)
|
|
249
|
-
const newPath = shouldCompress ? key : `${path}/${key}`;
|
|
250
|
-
switch (obj.type) {
|
|
251
|
-
case protocol_definitions_1.SummaryType.Tree:
|
|
252
|
-
// If client created empty tree, keep it as is
|
|
253
|
-
// Also do not package search blobs - they are part of storage contract
|
|
254
|
-
if (Object.keys(obj).length !== 0 && key !== "__search") {
|
|
255
|
-
const tree = await this.compressSmallBlobs(obj, newPath, level + 1, aggregator);
|
|
256
|
-
newSummary.tree[key] = tree;
|
|
257
|
-
if (Object.keys(obj).length === 0) {
|
|
258
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
259
|
-
delete newSummary.tree[key];
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
break;
|
|
263
|
-
case protocol_definitions_1.SummaryType.Blob:
|
|
264
|
-
if (aggregator &&
|
|
265
|
-
typeof obj.content == "string" &&
|
|
266
|
-
obj.content.length < this.blobCutOffSize) {
|
|
267
|
-
aggregator.addBlob(newPath, obj.content);
|
|
268
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
269
|
-
delete newSummary.tree[key];
|
|
270
|
-
}
|
|
271
|
-
break;
|
|
272
|
-
case protocol_definitions_1.SummaryType.Handle: {
|
|
273
|
-
// Would be nice to:
|
|
274
|
-
// Trees: expand the tree
|
|
275
|
-
// Blobs: parse handle and ensure it points to real blob, not virtual blob.
|
|
276
|
-
// We can avoid it for now given data store is the granularity of incremental summaries.
|
|
277
|
-
let handlePath = obj.handle;
|
|
278
|
-
if (handlePath.startsWith("/")) {
|
|
279
|
-
handlePath = handlePath.substr(1);
|
|
280
|
-
}
|
|
281
|
-
// Ensure only whole data stores can be reused, no reusing at deeper level!
|
|
282
|
-
(0, common_utils_1.assert)(level === 0, 0x0fc /* "tree reuse at lower level" */);
|
|
283
|
-
(0, common_utils_1.assert)(!handlePath.includes("/"), 0x0fd /* "data stores are writing incremental summaries!" */);
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
case protocol_definitions_1.SummaryType.Attachment:
|
|
287
|
-
(0, common_utils_1.assert)(this.isRealStorageId(obj.id), 0x0fe /* "attachment is aggregate blob" */);
|
|
288
|
-
break;
|
|
289
|
-
default:
|
|
290
|
-
(0, common_utils_1.unreachableCase)(obj, `Unknown type: ${obj.type}`);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
(0, common_utils_1.assert)(newSummary.tree[this.aggregatedBlobName] === undefined, 0x0ff /* "duplicate aggregate blob" */);
|
|
294
|
-
if (shouldCompress) {
|
|
295
|
-
// Note: It would be great to add code here to unpack aggregate blob back to normal blobs
|
|
296
|
-
// If only one blob made it into aggregate. Currently that does not happen as we always have
|
|
297
|
-
// at least one .component blob and at least one DDS that has .attributes blob, so it's not an issue.
|
|
298
|
-
// But it's possible that in future that would be great addition!
|
|
299
|
-
// Good news - it's backward compatible change.
|
|
300
|
-
(0, common_utils_1.assert)(aggregator !== undefined, 0x100 /* "logic error" */);
|
|
301
|
-
const content = aggregator.getAggregatedBlobContent();
|
|
302
|
-
if (content !== undefined) {
|
|
303
|
-
newSummary.tree[this.aggregatedBlobName] = {
|
|
304
|
-
type: protocol_definitions_1.SummaryType.Blob,
|
|
305
|
-
content,
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
return newSummary;
|
|
310
|
-
}
|
|
311
|
-
isRealStorageId(id) {
|
|
312
|
-
return !id.startsWith(this.virtualIdPrefix);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
exports.BlobAggregationStorage = BlobAggregationStorage;
|
|
316
|
-
// Tells data store if it can use incremental summary (i.e. reuse DDSes from previous summary
|
|
317
|
-
// when only one DDS changed).
|
|
318
|
-
// The answer has to be know long before we enable actual packing. The reason for the is the following:
|
|
319
|
-
// A the moment when we enable packing, we should assume that all clients out there wil already have bits
|
|
320
|
-
// that can unpack properly (i.e. enough time passed since we deployed bits that can unpack)
|
|
321
|
-
// But we can still have clients where some of them already pack, and some do not. If one summary was
|
|
322
|
-
// using packing, then it relies on non-incremental summaries going forward, even if next client who
|
|
323
|
-
// produced summary is not packing!
|
|
324
|
-
// This can have slight improvement by enabling it per file (based on "did summary we loaded from contain
|
|
325
|
-
// aggregated blobs"), but that's harder to make reliable, so going for simplicity.
|
|
326
|
-
BlobAggregationStorage.fullDataStoreSummaries = true;
|
|
327
|
-
//# sourceMappingURL=blobAggregationStorage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blobAggregationStorage.js","sourceRoot":"","sources":["../src/blobAggregationStorage.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,+EAO8C;AAC9C,+DAOsC;AAEtC,qEAA4E;AAE5E;;;GAGG;AACH,SAAS,eAAe,CAAC,IAAqB,EAAE,QAA4B;IAC3E,IAAI,IAAI,YAAY,UAAU,EAAE;QAC/B,8DAA8D;QAC9D,OAAO,IAAA,iCAAkB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KAC1C;IACD,OAAO,IAAA,6BAAc,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,cAAc;IAApB;QACkB,YAAO,GAAuB,EAAE,CAAC;IAiBnD,CAAC;IAfO,OAAO,CAAC,GAAW,EAAE,OAAe;QAC1C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;IACnC,CAAC;IAEM,wBAAwB;QAC9B,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,OAAO,SAAS,CAAC;SACjB;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,KAAsB;QACjC,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,C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AI,CAAC,eAAe,CAAC,CAAC;IAC7C,CAAC;;AA5QF,wDA6QC;AA5QA,6FAA6F;AAC7F,8BAA8B;AAC9B,uGAAuG;AACvG,yGAAyG;AACzG,4FAA4F;AAC5F,qGAAqG;AACrG,oGAAoG;AACpG,mCAAmC;AACnC,yGAAyG;AACzG,mFAAmF;AACnE,6CAAsB,GAAG,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tFetchSource,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n\tSummaryType,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tassert,\n\tbufferToString,\n\tstringToBuffer,\n\tunreachableCase,\n\tfromUtf8ToBase64,\n\tUint8ArrayToString,\n} from \"@fluidframework/common-utils\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { loggerToMonitoringContext } from \"@fluidframework/telemetry-utils\";\n\n/*\n * Work around for bufferToString having a bug - it can't consume IsoBuffer!\n * To be removed once bufferToString is fixed!\n */\nfunction bufferToString2(blob: ArrayBufferLike, encoding: \"utf-8\" | \"base64\"): string {\n\tif (blob instanceof Uint8Array) {\n\t\t// IsoBuffer does not have ctor, so it's not in proto chain :(\n\t\treturn Uint8ArrayToString(blob, encoding);\n\t}\n\treturn bufferToString(blob, encoding);\n}\n\n/**\n * Class responsible for aggregating smaller blobs into one and unpacking it later on.\n */\nclass BlobAggregator {\n\tprivate readonly content: [string, string][] = [];\n\n\tpublic addBlob(key: string, content: string) {\n\t\tthis.content.push([key, content]);\n\t}\n\n\tpublic getAggregatedBlobContent() {\n\t\tif (this.content.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn JSON.stringify(this.content);\n\t}\n\n\tstatic load(input: ArrayBufferLike) {\n\t\tconst data = bufferToString2(input, \"utf-8\");\n\t\treturn JSON.parse(data) as [string, string][];\n\t}\n}\n\n/**\n * Base class that deals with unpacking snapshots (in place) containing aggregated blobs\n * It relies on abstract methods for reads and storing unpacked blobs.\n *\n * @deprecated This class was introduced experimentally and is no longer used.\n */\nexport abstract class SnapshotExtractor {\n\tprotected readonly aggregatedBlobName = \"__big\";\n\tprotected readonly virtualIdPrefix = \"__\";\n\n\t// counter for generation of virtual storage IDs\n\tprotected virtualIdCounter = 0;\n\tprotected getNextVirtualId() {\n\t\treturn `${this.virtualIdPrefix}${++this.virtualIdCounter}`;\n\t}\n\n\tabstract getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike>;\n\tabstract setBlob(id: string, tree: ISnapshotTree, content: string);\n\n\tpublic async unpackSnapshotCore(snapshot: ISnapshotTree, level = 0): Promise<void> {\n\t\tfor (const key of Object.keys(snapshot.trees)) {\n\t\t\tconst obj = snapshot.trees[key];\n\t\t\tawait this.unpackSnapshotCore(obj, level + 1);\n\t\t}\n\n\t\t// For future proof, we will support multiple aggregated blobs with any name\n\t\t// that starts with this.aggregatedBlobName\n\t\tfor (const key of Object.keys(snapshot.blobs)) {\n\t\t\tif (!key.startsWith(this.aggregatedBlobName)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst blobId = snapshot.blobs[key];\n\t\t\tif (blobId !== undefined) {\n\t\t\t\tconst blob = await this.getBlob(blobId, snapshot);\n\t\t\t\tfor (const [path, value] of BlobAggregator.load(blob)) {\n\t\t\t\t\tconst id = this.getNextVirtualId();\n\t\t\t\t\tthis.setBlob(id, snapshot, value);\n\t\t\t\t\tconst pathSplit = path.split(\"/\");\n\t\t\t\t\tlet subTree = snapshot;\n\t\t\t\t\tfor (const subPath of pathSplit.slice(0, pathSplit.length - 1)) {\n\t\t\t\t\t\tif (subTree.trees[subPath] === undefined) {\n\t\t\t\t\t\t\tsubTree.trees[subPath] = { blobs: {}, trees: {} };\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsubTree = subTree.trees[subPath];\n\t\t\t\t\t}\n\t\t\t\t\tconst blobName = pathSplit[pathSplit.length - 1];\n\t\t\t\t\tassert(\n\t\t\t\t\t\tsubTree.blobs[blobName] === undefined,\n\t\t\t\t\t\t0x0f6 /* \"real blob ID exists\" */,\n\t\t\t\t\t);\n\t\t\t\t\tsubTree.blobs[blobName] = id;\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete snapshot.blobs[this.aggregatedBlobName];\n\t\t\t}\n\t\t}\n\t}\n}\n\n/*\n * Snapshot extractor class that works in place, i.e. patches snapshot that has\n * blob content in ISnapshotTree.blobs itself, not in storage.\n * As result, it implements reading and writing of blobs to/from snapshot itself.\n * It follows existing pattern that mixes concerns - ISnapshotTree.blobs is used for two\n * purposes:\n * 1. map path name to blob ID\n * 2. map blob ID to blob content\n * #2 is what storage (IDocumentStorageService) is for, but in places where we do not have it\n * (like loading serialized earlier draft content), blob content is put directly into snapshot.\n * Ideally this should be fixed by using BlobCacheStorageService or something similar and\n * fixing existing flows to allow switching of storage.\n */\nclass SnapshotExtractorInPlace extends SnapshotExtractor {\n\tpublic async getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike> {\n\t\tconst blob = tree.blobs[id];\n\t\tassert(blob !== undefined, 0x0f7 /* \"aggregate blob missing\" */);\n\t\treturn stringToBuffer(blob, \"base64\");\n\t}\n\n\tpublic setBlob(id: string, tree: ISnapshotTree, content: string) {\n\t\tassert(\n\t\t\ttree.blobs[id] === undefined,\n\t\t\t0x0f8 /* \"blob from aggregate blob exists on its own\" */,\n\t\t);\n\t\ttree.blobs[id] = fromUtf8ToBase64(content);\n\t}\n}\n\n/**\n * Snapshot packer and extractor.\n * When summary is written it will find and aggregate small blobs into bigger blobs\n * When snapshot is read, it will unpack aggregated blobs and provide them transparently to caller.\n *\n * @deprecated This class was introduced experimentally and is no longer used.\n */\nexport class BlobAggregationStorage extends SnapshotExtractor implements IDocumentStorageService {\n\t// Tells data store if it can use incremental summary (i.e. reuse DDSes from previous summary\n\t// when only one DDS changed).\n\t// The answer has to be know long before we enable actual packing. The reason for the is the following:\n\t// A the moment when we enable packing, we should assume that all clients out there wil already have bits\n\t// that can unpack properly (i.e. enough time passed since we deployed bits that can unpack)\n\t// But we can still have clients where some of them already pack, and some do not. If one summary was\n\t// using packing, then it relies on non-incremental summaries going forward, even if next client who\n\t// produced summary is not packing!\n\t// This can have slight improvement by enabling it per file (based on \"did summary we loaded from contain\n\t// aggregated blobs\"), but that's harder to make reliable, so going for simplicity.\n\tstatic readonly fullDataStoreSummaries = true;\n\n\tprotected loadedFromSummary = false;\n\n\tprotected virtualBlobs = new Map<string, ArrayBufferLike>();\n\n\tstatic wrap(\n\t\tstorage: IDocumentStorageService,\n\t\tlogger: ITelemetryLogger,\n\t\tallowPacking?: boolean,\n\t\tpackingLevel = 2,\n\t) {\n\t\tif (storage instanceof BlobAggregationStorage) {\n\t\t\treturn storage;\n\t\t}\n\t\tconst mc = loggerToMonitoringContext(logger);\n\t\tconst realAllowPackaging =\n\t\t\tmc.config.getBoolean(\"FluidAggregateBlobs\") ?? allowPacking ?? false;\n\n\t\t// Always create BlobAggregationStorage even if storage is not asking for packing.\n\t\t// This is mostly to avoid cases where future changes in policy would result in inability to\n\t\t// load old files that were created with aggregation on.\n\t\tconst minBlobSize = storage.policies?.minBlobSize;\n\t\treturn new BlobAggregationStorage(\n\t\t\tstorage,\n\t\t\tlogger,\n\t\t\trealAllowPackaging,\n\t\t\tpackingLevel,\n\t\t\tminBlobSize,\n\t\t);\n\t}\n\n\tstatic async unpackSnapshot(snapshot: ISnapshotTree) {\n\t\tconst converter = new SnapshotExtractorInPlace();\n\t\tawait converter.unpackSnapshotCore(snapshot);\n\t}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\tconst policies = this.storage.policies;\n\t\tif (policies) {\n\t\t\treturn { ...policies, minBlobSize: undefined };\n\t\t}\n\t}\n\n\tpublic async unpackSnapshot(snapshot: ISnapshotTree) {\n\t\t// SummarizerNodeWithGC.refreshLatestSummary can call it when this.loadedFromSummary === false\n\t\t// (I assumed after file was created)\n\t\t// assert(!this.loadedFromSummary, \"unpack without summary\");\n\n\t\tthis.loadedFromSummary = true;\n\t\tawait this.unpackSnapshotCore(snapshot);\n\t}\n\n\tprotected constructor(\n\t\tprivate readonly storage: IDocumentStorageService,\n\t\tprivate readonly logger: ITelemetryLogger,\n\t\tprivate readonly allowPacking: boolean,\n\t\tprivate readonly packingLevel: number,\n\t\tprivate readonly blobCutOffSize?: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic setBlob(id: string, tree: ISnapshotTree, content: string) {\n\t\tthis.virtualBlobs.set(id, stringToBuffer(content, \"utf-8\"));\n\t}\n\n\tpublic async getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike> {\n\t\treturn this.readBlob(id).catch((error) => {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"BlobDedupNoAggregateBlob\" }, error);\n\t\t\tthrow error;\n\t\t});\n\t}\n\n\tpublic get repositoryUrl() {\n\t\treturn this.storage.repositoryUrl;\n\t}\n\tpublic async getVersions(\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t) {\n\t\treturn this.storage.getVersions(versionId, count, scenarioName, fetchSource);\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\tthrow new Error(\"NYI\");\n\t}\n\n\t// for now we are not optimizing these blobs, with assumption that this API is used only\n\t// for big blobs (images)\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this.storage.createBlob(file);\n\t}\n\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\tconst tree = await this.storage.getSnapshotTree(version);\n\t\tif (tree) {\n\t\t\tawait this.unpackSnapshot(tree);\n\t\t}\n\t\treturn tree;\n\t}\n\n\tpublic async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\tif (this.isRealStorageId(id)) {\n\t\t\treturn this.storage.readBlob(id);\n\t\t}\n\t\t// We support only reading blobs from the summary we loaded from.\n\t\t// This may need to be extended to any general summary in the future as runtime usage pattern\n\t\t// of storage changes (for example, data stores start to load from recent summary, not from original\n\t\t// summary whole container loaded from)\n\n\t\t// are there other ways we can get here? createFile is one flow, but we should not be reading blobs\n\t\t// in such flow\n\t\tassert(this.loadedFromSummary, 0x0f9 /* \"never read summary\" */);\n\t\tconst blob = this.virtualBlobs.get(id);\n\t\tassert(blob !== undefined, 0x0fa /* \"virtual blob not found\" */);\n\t\treturn blob;\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tconst summaryNew = this.allowPacking ? await this.compressSmallBlobs(summary) : summary;\n\t\treturn this.storage.uploadSummaryWithContext(summaryNew, context);\n\t}\n\n\t// For simplification, we assume that\n\t// - blob aggregation is done at data store level only for now\n\t// - data store either reuses previous summary, or generates full summary, i.e. there is no partial (some DDS)\n\t// summary produced by data stores.\n\t// These simplifications allow us not to touch handles, as they are self-contained (either do not use aggregated\n\t// blob or contain aggregated blob that stays relevant for that sub-tree)\n\t// Note:\n\t// From perf perspective, it makes sense to place aggregated blobs one level up in the tree to not create extra\n\t// tree nodes (i.e. have shallow tree with less edges). But that creates problems with reusability of trees at\n\t// incremental summary time - we would need to understand handles and parse them. In current design we can skip\n\t// that step because if data store is reused, the whole sub-tree is reused including aggregated blob embedded into it\n\t// and that means we can do nothing and be correct!\n\tprivate async compressSmallBlobs(\n\t\tsummary: ISummaryTree,\n\t\tpath = \"\",\n\t\tlevel = 0,\n\t\taggregatorArg?: BlobAggregator,\n\t): Promise<ISummaryTree> {\n\t\tif (this.blobCutOffSize === undefined || this.blobCutOffSize < 0) {\n\t\t\treturn summary;\n\t\t}\n\n\t\tlet shouldCompress: boolean = false;\n\n\t\tlet aggregator = aggregatorArg;\n\t\t// checking if this is a dataStore tree, since we only pack at data store level\n\t\tif (Object.keys(summary.tree).includes(\".component\")) {\n\t\t\tassert(aggregator === undefined, 0x0fb /* \"logic err with aggregator\" */);\n\t\t\tassert(\n\t\t\t\tlevel === this.packingLevel,\n\t\t\t\t0x23b /* \"we are not packing at the right level\" */,\n\t\t\t);\n\t\t\taggregator = new BlobAggregator();\n\t\t\tshouldCompress = true;\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tlevel !== this.packingLevel,\n\t\t\t\t0x23c /* \"we are not packing at the right level\" */,\n\t\t\t);\n\t\t}\n\n\t\tconst newSummary: ISummaryTree = { ...summary };\n\t\tnewSummary.tree = { ...newSummary.tree };\n\t\tfor (const key of Object.keys(summary.tree)) {\n\t\t\tconst obj = summary.tree[key];\n\t\t\t// Get path relative to root of data store (where we do aggregation)\n\t\t\tconst newPath = shouldCompress ? key : `${path}/${key}`;\n\t\t\tswitch (obj.type) {\n\t\t\t\tcase SummaryType.Tree:\n\t\t\t\t\t// If client created empty tree, keep it as is\n\t\t\t\t\t// Also do not package search blobs - they are part of storage contract\n\t\t\t\t\tif (Object.keys(obj).length !== 0 && key !== \"__search\") {\n\t\t\t\t\t\tconst tree = await this.compressSmallBlobs(\n\t\t\t\t\t\t\tobj,\n\t\t\t\t\t\t\tnewPath,\n\t\t\t\t\t\t\tlevel + 1,\n\t\t\t\t\t\t\taggregator,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tnewSummary.tree[key] = tree;\n\t\t\t\t\t\tif (Object.keys(obj).length === 0) {\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\t\t\t\tdelete newSummary.tree[key];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase SummaryType.Blob:\n\t\t\t\t\tif (\n\t\t\t\t\t\taggregator &&\n\t\t\t\t\t\ttypeof obj.content == \"string\" &&\n\t\t\t\t\t\tobj.content.length < this.blobCutOffSize\n\t\t\t\t\t) {\n\t\t\t\t\t\taggregator.addBlob(newPath, obj.content);\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\t\t\tdelete newSummary.tree[key];\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase SummaryType.Handle: {\n\t\t\t\t\t// Would be nice to:\n\t\t\t\t\t// Trees: expand the tree\n\t\t\t\t\t// Blobs: parse handle and ensure it points to real blob, not virtual blob.\n\t\t\t\t\t// We can avoid it for now given data store is the granularity of incremental summaries.\n\t\t\t\t\tlet handlePath = obj.handle;\n\t\t\t\t\tif (handlePath.startsWith(\"/\")) {\n\t\t\t\t\t\thandlePath = handlePath.substr(1);\n\t\t\t\t\t}\n\t\t\t\t\t// Ensure only whole data stores can be reused, no reusing at deeper level!\n\t\t\t\t\tassert(level === 0, 0x0fc /* \"tree reuse at lower level\" */);\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!handlePath.includes(\"/\"),\n\t\t\t\t\t\t0x0fd /* \"data stores are writing incremental summaries!\" */,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase SummaryType.Attachment:\n\t\t\t\t\tassert(\n\t\t\t\t\t\tthis.isRealStorageId(obj.id),\n\t\t\t\t\t\t0x0fe /* \"attachment is aggregate blob\" */,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(obj, `Unknown type: ${(obj as any).type}`);\n\t\t\t}\n\t\t}\n\n\t\tassert(\n\t\t\tnewSummary.tree[this.aggregatedBlobName] === undefined,\n\t\t\t0x0ff /* \"duplicate aggregate blob\" */,\n\t\t);\n\t\tif (shouldCompress) {\n\t\t\t// Note: It would be great to add code here to unpack aggregate blob back to normal blobs\n\t\t\t// If only one blob made it into aggregate. Currently that does not happen as we always have\n\t\t\t// at least one .component blob and at least one DDS that has .attributes blob, so it's not an issue.\n\t\t\t// But it's possible that in future that would be great addition!\n\t\t\t// Good news - it's backward compatible change.\n\t\t\tassert(aggregator !== undefined, 0x100 /* \"logic error\" */);\n\t\t\tconst content = aggregator.getAggregatedBlobContent();\n\t\t\tif (content !== undefined) {\n\t\t\t\tnewSummary.tree[this.aggregatedBlobName] = {\n\t\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\t\tcontent,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn newSummary;\n\t}\n\n\tprotected isRealStorageId(id: string): boolean {\n\t\treturn !id.startsWith(this.virtualIdPrefix);\n\t}\n}\n"]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { IDocumentStorageService, IDocumentStorageServicePolicies } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { DocumentStorageServiceProxy } from "./documentStorageServiceProxy";
|
|
7
|
-
/**
|
|
8
|
-
* IDocumentStorageService adapter with pre-cached blobs.
|
|
9
|
-
*
|
|
10
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
11
|
-
*/
|
|
12
|
-
export declare class BlobCacheStorageService extends DocumentStorageServiceProxy {
|
|
13
|
-
private readonly blobs;
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
16
|
-
*/
|
|
17
|
-
constructor(internalStorageService: IDocumentStorageService, blobs: Map<string, ArrayBufferLike>);
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
20
|
-
*/
|
|
21
|
-
get policies(): IDocumentStorageServicePolicies | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
24
|
-
*/
|
|
25
|
-
readBlob(id: string): Promise<ArrayBufferLike>;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=blobCacheStorageService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blobCacheStorageService.d.ts","sourceRoot":"","sources":["../src/blobCacheStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,uBAAuB,EACvB,+BAA+B,EAC/B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,2BAA2B;IAMtE,OAAO,CAAC,QAAQ,CAAC,KAAK;IALvB;;OAEG;gBAEF,sBAAsB,EAAE,uBAAuB,EAC9B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC;IAKrD;;OAEG;IACH,IAAW,QAAQ,IAAI,+BAA+B,GAAG,SAAS,CAEjE;IAED;;OAEG;IACU,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAQ3D"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.BlobCacheStorageService = void 0;
|
|
8
|
-
const documentStorageServiceProxy_1 = require("./documentStorageServiceProxy");
|
|
9
|
-
/**
|
|
10
|
-
* IDocumentStorageService adapter with pre-cached blobs.
|
|
11
|
-
*
|
|
12
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
13
|
-
*/
|
|
14
|
-
class BlobCacheStorageService extends documentStorageServiceProxy_1.DocumentStorageServiceProxy {
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
17
|
-
*/
|
|
18
|
-
constructor(internalStorageService, blobs) {
|
|
19
|
-
super(internalStorageService);
|
|
20
|
-
this.blobs = blobs;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
24
|
-
*/
|
|
25
|
-
get policies() {
|
|
26
|
-
return this.internalStorageService.policies;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
30
|
-
*/
|
|
31
|
-
async readBlob(id) {
|
|
32
|
-
const blob = this.blobs.get(id);
|
|
33
|
-
if (blob !== undefined) {
|
|
34
|
-
return blob;
|
|
35
|
-
}
|
|
36
|
-
return this.internalStorageService.readBlob(id);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.BlobCacheStorageService = BlobCacheStorageService;
|
|
40
|
-
//# sourceMappingURL=blobCacheStorageService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blobCacheStorageService.js","sourceRoot":"","sources":["../src/blobCacheStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,+EAA4E;AAE5E;;;;GAIG;AACH,MAAa,uBAAwB,SAAQ,yDAA2B;IACvE;;OAEG;IACH,YACC,sBAA+C,EAC9B,KAAmC;QAEpD,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAFb,UAAK,GAAL,KAAK,CAA8B;IAGrD,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAC7C,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,QAAQ,CAAC,EAAU;QAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChC,IAAI,IAAI,KAAK,SAAS,EAAE;YACvB,OAAO,IAAI,CAAC;SACZ;QAED,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC;CACD;AA7BD,0DA6BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n} from \"@fluidframework/driver-definitions\";\nimport { DocumentStorageServiceProxy } from \"./documentStorageServiceProxy\";\n\n/**\n * IDocumentStorageService adapter with pre-cached blobs.\n *\n * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n */\nexport class BlobCacheStorageService extends DocumentStorageServiceProxy {\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tconstructor(\n\t\tinternalStorageService: IDocumentStorageService,\n\t\tprivate readonly blobs: Map<string, ArrayBufferLike>,\n\t) {\n\t\tsuper(internalStorageService);\n\t}\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\treturn this.internalStorageService.policies;\n\t}\n\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\tconst blob = this.blobs.get(id);\n\t\tif (blob !== undefined) {\n\t\t\treturn blob;\n\t\t}\n\n\t\treturn this.internalStorageService.readBlob(id);\n\t}\n}\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { IDocumentDeltaStorageService, IStream } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
7
|
-
/**
|
|
8
|
-
* Implementation of IDocumentDeltaStorageService that will always return an empty message queue when fetching messages
|
|
9
|
-
*
|
|
10
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
11
|
-
*/
|
|
12
|
-
export declare class EmptyDocumentDeltaStorageService implements IDocumentDeltaStorageService {
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
15
|
-
*/
|
|
16
|
-
fetchMessages(from: number, _to: number | undefined, _abortSignal?: AbortSignal, _cachedOnly?: boolean, _fetchReason?: string): IStream<ISequencedDocumentMessage[]>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=emptyDocumentDeltaStorageService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emptyDocumentDeltaStorageService.d.ts","sourceRoot":"","sources":["../src/emptyDocumentDeltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,4BAA4B,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAGjF;;;;GAIG;AACH,qBAAa,gCAAiC,YAAW,4BAA4B;IACpF;;OAEG;IACI,aAAa,CACnB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,YAAY,CAAC,EAAE,WAAW,EAC1B,WAAW,CAAC,EAAE,OAAO,EACrB,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,yBAAyB,EAAE,CAAC;CAKvC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.EmptyDocumentDeltaStorageService = void 0;
|
|
8
|
-
const parallelRequests_1 = require("./parallelRequests");
|
|
9
|
-
/**
|
|
10
|
-
* Implementation of IDocumentDeltaStorageService that will always return an empty message queue when fetching messages
|
|
11
|
-
*
|
|
12
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
13
|
-
*/
|
|
14
|
-
class EmptyDocumentDeltaStorageService {
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
17
|
-
*/
|
|
18
|
-
fetchMessages(from, _to, _abortSignal, _cachedOnly, _fetchReason) {
|
|
19
|
-
const queue = new parallelRequests_1.Queue();
|
|
20
|
-
queue.pushDone();
|
|
21
|
-
return queue;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.EmptyDocumentDeltaStorageService = EmptyDocumentDeltaStorageService;
|
|
25
|
-
//# sourceMappingURL=emptyDocumentDeltaStorageService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emptyDocumentDeltaStorageService.js","sourceRoot":"","sources":["../src/emptyDocumentDeltaStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,yDAA2C;AAE3C;;;;GAIG;AACH,MAAa,gCAAgC;IAC5C;;OAEG;IACI,aAAa,CACnB,IAAY,EACZ,GAAuB,EACvB,YAA0B,EAC1B,WAAqB,EACrB,YAAqB;QAErB,MAAM,KAAK,GAAG,IAAI,wBAAK,EAA+B,CAAC;QACvD,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC;IACd,CAAC;CACD;AAfD,4EAeC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentDeltaStorageService, IStream } from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { Queue } from \"./parallelRequests\";\n\n/**\n * Implementation of IDocumentDeltaStorageService that will always return an empty message queue when fetching messages\n *\n * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n */\nexport class EmptyDocumentDeltaStorageService implements IDocumentDeltaStorageService {\n\t/**\n\t * @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.\n\t */\n\tpublic fetchMessages(\n\t\tfrom: number,\n\t\t_to: number | undefined,\n\t\t_abortSignal?: AbortSignal,\n\t\t_cachedOnly?: boolean,\n\t\t_fetchReason?: string,\n\t): IStream<ISequencedDocumentMessage[]> {\n\t\tconst queue = new Queue<ISequencedDocumentMessage[]>();\n\t\tqueue.pushDone();\n\t\treturn queue;\n\t}\n}\n"]}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* An extension of Map that expires (deletes) entries after a period of inactivity.
|
|
7
|
-
* The policy is based on the last time a key was written to.
|
|
8
|
-
*
|
|
9
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
10
|
-
*/
|
|
11
|
-
export declare class MapWithExpiration<TKey = any, TValue = any> extends Map<TKey, TValue> {
|
|
12
|
-
private readonly expiryMs;
|
|
13
|
-
/** Timestamps (as epoch ms numbers) of when each key was last refreshed */
|
|
14
|
-
private readonly lastRefreshedTimes;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
17
|
-
*/
|
|
18
|
-
constructor(expiryMs: number);
|
|
19
|
-
private refresh;
|
|
20
|
-
/**
|
|
21
|
-
* Returns true if the key is present and expired, false if it's not expired, and undefined if it's not found
|
|
22
|
-
* If cleanUp is passed as true, then delete any expired entry before returning.
|
|
23
|
-
*/
|
|
24
|
-
private checkExpiry;
|
|
25
|
-
private clearExpiredEntries;
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
28
|
-
*/
|
|
29
|
-
get size(): number;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
32
|
-
*/
|
|
33
|
-
has(key: TKey): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
36
|
-
*/
|
|
37
|
-
get(key: TKey): TValue | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
40
|
-
*/
|
|
41
|
-
set(key: TKey, value: TValue): this;
|
|
42
|
-
/**
|
|
43
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
44
|
-
*/
|
|
45
|
-
delete(key: TKey): boolean;
|
|
46
|
-
/**
|
|
47
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
48
|
-
*/
|
|
49
|
-
clear(): void;
|
|
50
|
-
/**
|
|
51
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
52
|
-
*/
|
|
53
|
-
forEach(callbackfn: (value: TValue, key: TKey, map: Map<TKey, TValue>) => void, thisArg?: any): void;
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
56
|
-
*/
|
|
57
|
-
entries(): IterableIterator<[TKey, TValue]>;
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
60
|
-
*/
|
|
61
|
-
keys(): IterableIterator<TKey>;
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
64
|
-
*/
|
|
65
|
-
values(): IterableIterator<TValue>;
|
|
66
|
-
/**
|
|
67
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
68
|
-
*/
|
|
69
|
-
[Symbol.iterator](): IterableIterator<[TKey, TValue]>;
|
|
70
|
-
/**
|
|
71
|
-
* @deprecated 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
72
|
-
*/
|
|
73
|
-
valueOf(): Object;
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=mapWithExpiration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mapWithExpiration.d.ts","sourceRoot":"","sources":["../src/mapWithExpiration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;GAKG;AACH,qBAAa,iBAAiB,CAAC,IAAI,GAAG,GAAG,EAAE,MAAM,GAAG,GAAG,CAAE,SAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC;IAOrE,OAAO,CAAC,QAAQ,CAAC,QAAQ;IANrC,2EAA2E;IAC3E,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA2B;IAE9D;;OAEG;gBAC0B,QAAQ,EAAE,MAAM;IAI7C,OAAO,CAAC,OAAO;IAIf;;;OAGG;IACH,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,mBAAmB;IAK3B;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAGjB;IAED;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO;IAKvB;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS;IAKlC;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAMnC;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO;IAK1B;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,OAAO,CACN,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,IAAI,EACtE,OAAO,CAAC,E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