@fluidframework/driver-utils 2.0.0-internal.7.3.0 → 2.0.0-internal.8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +9 -1
- package/api-report/driver-utils.api.md +47 -47
- package/dist/adapters/compression/compressionTypes.d.ts +2 -2
- package/dist/adapters/compression/compressionTypes.js +1 -1
- package/dist/adapters/compression/compressionTypes.js.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/dist/adapters/predefinedAdapters.d.ts +1 -1
- package/dist/adapters/predefinedAdapters.js +1 -1
- package/dist/adapters/predefinedAdapters.js.map +1 -1
- package/dist/blob.d.ts +3 -3
- package/dist/blob.js +3 -3
- package/dist/blob.js.map +1 -1
- package/dist/buildSnapshotTree.d.ts +1 -1
- package/dist/buildSnapshotTree.js +1 -1
- package/dist/buildSnapshotTree.js.map +1 -1
- package/dist/documentStorageServiceProxy.d.ts +1 -1
- package/dist/documentStorageServiceProxy.js +1 -1
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/driver-utils-alpha.d.ts +169 -0
- package/dist/driver-utils-beta.d.ts +176 -0
- package/dist/driver-utils-public.d.ts +176 -0
- package/dist/driver-utils-untrimmed.d.ts +590 -0
- package/dist/error.d.ts +1 -1
- package/dist/error.js +1 -1
- package/dist/error.js.map +1 -1
- package/dist/insecureUrlResolver.d.ts +1 -1
- package/dist/insecureUrlResolver.js +1 -1
- package/dist/insecureUrlResolver.js.map +1 -1
- package/dist/messageRecognition.d.ts +3 -3
- package/dist/messageRecognition.js +3 -3
- package/dist/messageRecognition.js.map +1 -1
- package/dist/network.d.ts +19 -19
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +18 -18
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts +1 -1
- package/dist/networkUtils.js +1 -1
- 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/dist/parallelRequests.d.ts +6 -6
- package/dist/parallelRequests.js +6 -6
- package/dist/parallelRequests.js.map +1 -1
- package/dist/prefetchDocumentStorageService.d.ts +1 -1
- package/dist/prefetchDocumentStorageService.js +1 -1
- package/dist/prefetchDocumentStorageService.js.map +1 -1
- package/dist/rateLimiter.d.ts +1 -1
- package/dist/rateLimiter.js +1 -1
- package/dist/rateLimiter.js.map +1 -1
- package/dist/readAndParse.d.ts +1 -1
- package/dist/readAndParse.js +1 -1
- package/dist/readAndParse.js.map +1 -1
- package/dist/runWithRetry.d.ts +3 -3
- package/dist/runWithRetry.js +2 -2
- package/dist/runWithRetry.js.map +1 -1
- package/dist/summaryForCreateNew.d.ts +2 -2
- package/dist/summaryForCreateNew.js +2 -2
- package/dist/summaryForCreateNew.js.map +1 -1
- package/dist/treeConversions.d.ts +1 -1
- package/dist/treeConversions.js +1 -1
- package/dist/treeConversions.js.map +1 -1
- package/lib/adapters/compression/compressionTypes.d.ts +2 -2
- package/lib/adapters/compression/compressionTypes.js +1 -1
- package/lib/adapters/compression/compressionTypes.js.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/lib/adapters/predefinedAdapters.d.ts +1 -1
- package/lib/adapters/predefinedAdapters.js +1 -1
- package/lib/adapters/predefinedAdapters.js.map +1 -1
- package/lib/blob.d.ts +3 -3
- package/lib/blob.js +3 -3
- package/lib/blob.js.map +1 -1
- package/lib/buildSnapshotTree.d.ts +1 -1
- package/lib/buildSnapshotTree.js +1 -1
- package/lib/buildSnapshotTree.js.map +1 -1
- package/lib/documentStorageServiceProxy.d.ts +1 -1
- package/lib/documentStorageServiceProxy.js +1 -1
- package/lib/documentStorageServiceProxy.js.map +1 -1
- package/lib/driver-utils-alpha.d.ts +169 -0
- package/lib/driver-utils-beta.d.ts +176 -0
- package/lib/driver-utils-public.d.ts +176 -0
- package/lib/driver-utils-untrimmed.d.ts +590 -0
- package/lib/error.d.ts +1 -1
- package/lib/error.js +1 -1
- package/lib/error.js.map +1 -1
- package/lib/insecureUrlResolver.d.ts +1 -1
- package/lib/insecureUrlResolver.js +1 -1
- package/lib/insecureUrlResolver.js.map +1 -1
- package/lib/messageRecognition.d.ts +3 -3
- package/lib/messageRecognition.js +3 -3
- package/lib/messageRecognition.js.map +1 -1
- package/lib/network.d.ts +19 -19
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js +18 -18
- package/lib/network.js.map +1 -1
- package/lib/networkUtils.d.ts +1 -1
- package/lib/networkUtils.js +1 -1
- 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/lib/parallelRequests.d.ts +6 -6
- package/lib/parallelRequests.js +6 -6
- package/lib/parallelRequests.js.map +1 -1
- package/lib/prefetchDocumentStorageService.d.ts +1 -1
- package/lib/prefetchDocumentStorageService.js +1 -1
- package/lib/prefetchDocumentStorageService.js.map +1 -1
- package/lib/rateLimiter.d.ts +1 -1
- package/lib/rateLimiter.js +1 -1
- package/lib/rateLimiter.js.map +1 -1
- package/lib/readAndParse.d.ts +1 -1
- package/lib/readAndParse.js +1 -1
- package/lib/readAndParse.js.map +1 -1
- package/lib/runWithRetry.d.ts +3 -3
- package/lib/runWithRetry.js +2 -2
- package/lib/runWithRetry.js.map +1 -1
- package/lib/summaryForCreateNew.d.ts +2 -2
- package/lib/summaryForCreateNew.js +2 -2
- package/lib/summaryForCreateNew.js.map +1 -1
- package/lib/treeConversions.d.ts +1 -1
- package/lib/treeConversions.js +1 -1
- package/lib/treeConversions.js.map +1 -1
- package/package.json +31 -12
- package/src/adapters/compression/compressionTypes.ts +2 -2
- package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +1 -1
- package/src/adapters/predefinedAdapters.ts +1 -1
- package/src/blob.ts +3 -3
- package/src/buildSnapshotTree.ts +1 -1
- package/src/documentStorageServiceProxy.ts +1 -1
- package/src/error.ts +1 -1
- package/src/insecureUrlResolver.ts +1 -1
- package/src/messageRecognition.ts +3 -3
- package/src/network.ts +19 -19
- package/src/networkUtils.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +6 -6
- package/src/prefetchDocumentStorageService.ts +1 -1
- package/src/rateLimiter.ts +1 -1
- package/src/readAndParse.ts +1 -1
- package/src/runWithRetry.ts +3 -3
- package/src/summaryForCreateNew.ts +2 -2
- package/src/treeConversions.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-lint.json",
|
|
4
|
+
"messages": {
|
|
5
|
+
"extractorMessageReporting": {
|
|
6
|
+
// TODO: remove once base config has this enabled as an error
|
|
7
|
+
"ae-incompatible-release-tags": {
|
|
8
|
+
"logLevel": "error",
|
|
9
|
+
"addToApiReportFile": false
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
package/api-extractor.json
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-base.json",
|
|
4
|
+
"messages": {
|
|
5
|
+
"extractorMessageReporting": {
|
|
6
|
+
// TODO: Add missing documentation and remove this rule override
|
|
7
|
+
"ae-undocumented": {
|
|
8
|
+
"logLevel": "none"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
4
12
|
}
|
|
@@ -39,10 +39,10 @@ import { IVersion } from '@fluidframework/protocol-definitions';
|
|
|
39
39
|
import { LoaderCachingPolicy } from '@fluidframework/driver-definitions';
|
|
40
40
|
import { LoggingError } from '@fluidframework/telemetry-utils';
|
|
41
41
|
|
|
42
|
-
// @
|
|
42
|
+
// @internal
|
|
43
43
|
export function applyStorageCompression(documentServiceFactory: IDocumentServiceFactory, config?: ICompressionStorageConfig | boolean): IDocumentServiceFactory;
|
|
44
44
|
|
|
45
|
-
// @
|
|
45
|
+
// @internal
|
|
46
46
|
export class AttachmentTreeEntry {
|
|
47
47
|
constructor(path: string, id: string);
|
|
48
48
|
// (undocumented)
|
|
@@ -57,7 +57,7 @@ export class AttachmentTreeEntry {
|
|
|
57
57
|
readonly value: IAttachment;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
// @
|
|
60
|
+
// @internal (undocumented)
|
|
61
61
|
export class AuthorizationError extends LoggingError implements IAuthorizationError, IFluidErrorBase {
|
|
62
62
|
constructor(message: string, claims: string | undefined, tenantId: string | undefined, props: DriverErrorTelemetryProps);
|
|
63
63
|
// (undocumented)
|
|
@@ -70,10 +70,10 @@ export class AuthorizationError extends LoggingError implements IAuthorizationEr
|
|
|
70
70
|
readonly tenantId: string | undefined;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
// @
|
|
73
|
+
// @internal (undocumented)
|
|
74
74
|
export const blobHeadersBlobName = ".metadata.blobHeaders";
|
|
75
75
|
|
|
76
|
-
// @
|
|
76
|
+
// @internal
|
|
77
77
|
export class BlobTreeEntry {
|
|
78
78
|
constructor(path: string, contents: string, encoding?: "utf-8" | "base64");
|
|
79
79
|
// (undocumented)
|
|
@@ -86,16 +86,16 @@ export class BlobTreeEntry {
|
|
|
86
86
|
readonly value: IBlob;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
// @
|
|
89
|
+
// @internal
|
|
90
90
|
export function buildSnapshotTree(entries: ITreeEntry[], blobMap: Map<string, ArrayBufferLike>): ISnapshotTree;
|
|
91
91
|
|
|
92
|
-
// @
|
|
92
|
+
// @internal
|
|
93
93
|
export function calculateMaxWaitTime(delayMs: number, error: unknown): number;
|
|
94
94
|
|
|
95
|
-
// @
|
|
95
|
+
// @internal (undocumented)
|
|
96
96
|
export function canBeCoalescedByService(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
|
|
97
97
|
|
|
98
|
-
// @
|
|
98
|
+
// @internal
|
|
99
99
|
export const canRetryOnError: (error: any) => boolean;
|
|
100
100
|
|
|
101
101
|
// @internal
|
|
@@ -107,19 +107,19 @@ export interface CombinedAppAndProtocolSummary extends ISummaryTree {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
// @
|
|
110
|
+
// @internal
|
|
111
111
|
export function convertSummaryTreeToSnapshotITree(summaryTree: ISummaryTree): ITree;
|
|
112
112
|
|
|
113
|
-
// @
|
|
113
|
+
// @internal (undocumented)
|
|
114
114
|
export function createGenericNetworkError(message: string, retryInfo: {
|
|
115
115
|
canRetry: boolean;
|
|
116
116
|
retryAfterMs?: number;
|
|
117
117
|
}, props: DriverErrorTelemetryProps): ThrottlingError | GenericNetworkError;
|
|
118
118
|
|
|
119
|
-
// @
|
|
119
|
+
// @internal (undocumented)
|
|
120
120
|
export const createWriteError: (message: string, props: DriverErrorTelemetryProps) => NonRetryableError<"writeError">;
|
|
121
121
|
|
|
122
|
-
// @
|
|
122
|
+
// @internal (undocumented)
|
|
123
123
|
export class DeltaStreamConnectionForbiddenError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
124
124
|
constructor(message: string, props: DriverErrorTelemetryProps, storageOnlyReason?: string);
|
|
125
125
|
// (undocumented)
|
|
@@ -132,7 +132,7 @@ export class DeltaStreamConnectionForbiddenError extends LoggingError implements
|
|
|
132
132
|
readonly storageOnlyReason: string | undefined;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
// @
|
|
135
|
+
// @internal (undocumented)
|
|
136
136
|
export class DocumentStorageServiceProxy implements IDocumentStorageService {
|
|
137
137
|
constructor(internalStorageService: IDocumentStorageService);
|
|
138
138
|
// (undocumented)
|
|
@@ -156,15 +156,15 @@ export class DocumentStorageServiceProxy implements IDocumentStorageService {
|
|
|
156
156
|
uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
// @
|
|
159
|
+
// @internal
|
|
160
160
|
export type DriverErrorTelemetryProps = ITelemetryProperties & {
|
|
161
161
|
driverVersion: string | undefined;
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
-
// @
|
|
164
|
+
// @internal (undocumented)
|
|
165
165
|
export const emptyMessageStream: IStream<ISequencedDocumentMessage[]>;
|
|
166
166
|
|
|
167
|
-
// @
|
|
167
|
+
// @internal
|
|
168
168
|
export class FluidInvalidSchemaError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
169
169
|
constructor(message: string, props: DriverErrorTelemetryProps);
|
|
170
170
|
// (undocumented)
|
|
@@ -173,7 +173,7 @@ export class FluidInvalidSchemaError extends LoggingError implements IDriverErro
|
|
|
173
173
|
readonly errorType = DriverErrorType.fluidInvalidSchema;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
// @
|
|
176
|
+
// @internal
|
|
177
177
|
export class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
178
178
|
constructor(message: string, canRetry: boolean, props: DriverErrorTelemetryProps);
|
|
179
179
|
// (undocumented)
|
|
@@ -182,19 +182,19 @@ export class GenericNetworkError extends LoggingError implements IDriverErrorBas
|
|
|
182
182
|
readonly errorType = DriverErrorType.genericNetworkError;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
// @
|
|
185
|
+
// @internal
|
|
186
186
|
export function getDocAttributesFromProtocolSummary(protocolSummary: ISummaryTree): IDocumentAttributes;
|
|
187
187
|
|
|
188
|
-
// @
|
|
188
|
+
// @internal
|
|
189
189
|
export function getQuorumValuesFromProtocolSummary(protocolSummary: ISummaryTree): [string, ICommittedProposal][];
|
|
190
190
|
|
|
191
|
-
// @
|
|
191
|
+
// @internal
|
|
192
192
|
export const getRetryDelayFromError: (error: any) => number | undefined;
|
|
193
193
|
|
|
194
|
-
// @
|
|
194
|
+
// @internal
|
|
195
195
|
export const getRetryDelaySecondsFromError: (error: any) => number | undefined;
|
|
196
196
|
|
|
197
|
-
// @
|
|
197
|
+
// @alpha (undocumented)
|
|
198
198
|
export interface ICompressionStorageConfig {
|
|
199
199
|
// (undocumented)
|
|
200
200
|
algorithm: SummaryCompressionAlgorithm;
|
|
@@ -202,7 +202,7 @@ export interface ICompressionStorageConfig {
|
|
|
202
202
|
minSizeToCompress: number;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
// @
|
|
205
|
+
// @internal
|
|
206
206
|
export class InsecureUrlResolver implements IUrlResolver {
|
|
207
207
|
constructor(hostUrl: string, ordererUrl: string, storageUrl: string, tenantId: string, bearer: string, isForNodeTest?: boolean);
|
|
208
208
|
// (undocumented)
|
|
@@ -213,7 +213,7 @@ export class InsecureUrlResolver implements IUrlResolver {
|
|
|
213
213
|
resolve(request: IRequest): Promise<IResolvedUrl | undefined>;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
// @
|
|
216
|
+
// @internal
|
|
217
217
|
export interface IProgress {
|
|
218
218
|
cancel?: AbortSignal;
|
|
219
219
|
onRetry?(delayInMs: number, error: any): void;
|
|
@@ -222,15 +222,15 @@ export interface IProgress {
|
|
|
222
222
|
// @internal
|
|
223
223
|
export function isCombinedAppAndProtocolSummary(summary: ISummaryTree | undefined, ...optionalRootTrees: string[]): summary is CombinedAppAndProtocolSummary;
|
|
224
224
|
|
|
225
|
-
// @
|
|
225
|
+
// @internal
|
|
226
226
|
export function isOnline(): OnlineStatus;
|
|
227
227
|
|
|
228
|
-
// @
|
|
228
|
+
// @internal
|
|
229
229
|
export function isRuntimeMessage(message: {
|
|
230
230
|
type: string;
|
|
231
231
|
}): boolean;
|
|
232
232
|
|
|
233
|
-
// @
|
|
233
|
+
// @internal (undocumented)
|
|
234
234
|
export class LocationRedirectionError extends LoggingError implements ILocationRedirectionError, IFluidErrorBase {
|
|
235
235
|
constructor(message: string, redirectUrl: IResolvedUrl, props: DriverErrorTelemetryProps);
|
|
236
236
|
// (undocumented)
|
|
@@ -241,16 +241,16 @@ export class LocationRedirectionError extends LoggingError implements ILocationR
|
|
|
241
241
|
readonly redirectUrl: IResolvedUrl;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
// @
|
|
244
|
+
// @internal (undocumented)
|
|
245
245
|
export function logNetworkFailure(logger: ITelemetryLoggerExt, event: ITelemetryErrorEvent, error?: any): void;
|
|
246
246
|
|
|
247
|
-
// @
|
|
247
|
+
// @internal (undocumented)
|
|
248
248
|
export enum MessageType2 {
|
|
249
249
|
// (undocumented)
|
|
250
250
|
Accept = "accept"
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
// @
|
|
253
|
+
// @internal (undocumented)
|
|
254
254
|
export class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {
|
|
255
255
|
constructor(message: string, errorType: T, canRetry: boolean, props: DriverErrorTelemetryProps);
|
|
256
256
|
// (undocumented)
|
|
@@ -259,14 +259,14 @@ export class NetworkErrorBasic<T extends string> extends LoggingError implements
|
|
|
259
259
|
readonly errorType: T;
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
// @
|
|
262
|
+
// @internal (undocumented)
|
|
263
263
|
export class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {
|
|
264
264
|
constructor(message: string, errorType: T, props: DriverErrorTelemetryProps);
|
|
265
265
|
// (undocumented)
|
|
266
266
|
readonly errorType: T;
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
// @
|
|
269
|
+
// @internal (undocumented)
|
|
270
270
|
export enum OnlineStatus {
|
|
271
271
|
// (undocumented)
|
|
272
272
|
Offline = 0,
|
|
@@ -276,7 +276,7 @@ export enum OnlineStatus {
|
|
|
276
276
|
Unknown = 2
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
// @
|
|
279
|
+
// @internal
|
|
280
280
|
export class ParallelRequests<T> {
|
|
281
281
|
constructor(from: number, to: number | undefined, payloadSize: number, logger: ITelemetryLoggerExt, requestCallback: (request: number, from: number, to: number, strongTo: boolean, props: ITelemetryProperties) => Promise<{
|
|
282
282
|
partial: boolean;
|
|
@@ -291,7 +291,7 @@ export class ParallelRequests<T> {
|
|
|
291
291
|
run(concurrency: number): Promise<void>;
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
// @
|
|
294
|
+
// @internal (undocumented)
|
|
295
295
|
export class PrefetchDocumentStorageService extends DocumentStorageServiceProxy {
|
|
296
296
|
// (undocumented)
|
|
297
297
|
getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
|
|
@@ -306,7 +306,7 @@ export class PrefetchDocumentStorageService extends DocumentStorageServiceProxy
|
|
|
306
306
|
stopPrefetch(): void;
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
-
// @
|
|
309
|
+
// @internal
|
|
310
310
|
export class Queue<T> implements IStream<T> {
|
|
311
311
|
// (undocumented)
|
|
312
312
|
protected pushCore(value: Promise<IStreamResult<T>>): void;
|
|
@@ -320,7 +320,7 @@ export class Queue<T> implements IStream<T> {
|
|
|
320
320
|
read(): Promise<IStreamResult<T>>;
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
// @
|
|
323
|
+
// @alpha (undocumented)
|
|
324
324
|
export class RateLimiter {
|
|
325
325
|
constructor(maxRequests: number);
|
|
326
326
|
// (undocumented)
|
|
@@ -333,29 +333,29 @@ export class RateLimiter {
|
|
|
333
333
|
get waitQueueLength(): number;
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
-
// @
|
|
336
|
+
// @internal
|
|
337
337
|
export function readAndParse<T>(storage: Pick<IDocumentStorageService, "readBlob">, id: string): Promise<T>;
|
|
338
338
|
|
|
339
|
-
// @
|
|
339
|
+
// @internal
|
|
340
340
|
export function requestOps(get: (from: number, to: number, telemetryProps: ITelemetryProperties) => Promise<IDeltasFetchResult>, concurrency: number, fromTotal: number, toTotal: number | undefined, payloadSize: number, logger: ITelemetryLoggerExt, signal?: AbortSignal, scenarioName?: string): IStream<ISequencedDocumentMessage[]>;
|
|
341
341
|
|
|
342
|
-
// @
|
|
342
|
+
// @internal (undocumented)
|
|
343
343
|
export class RetryableError<T extends string> extends NetworkErrorBasic<T> {
|
|
344
344
|
constructor(message: string, errorType: T, props: DriverErrorTelemetryProps);
|
|
345
345
|
// (undocumented)
|
|
346
346
|
readonly errorType: T;
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
// @
|
|
349
|
+
// @internal (undocumented)
|
|
350
350
|
export function runWithRetry<T>(api: (cancel?: AbortSignal) => Promise<T>, fetchCallName: string, logger: ITelemetryLoggerExt, progress: IProgress): Promise<T>;
|
|
351
351
|
|
|
352
|
-
// @
|
|
352
|
+
// @internal (undocumented)
|
|
353
353
|
export function streamFromMessages(messagesArg: Promise<ISequencedDocumentMessage[]>): IStream<ISequencedDocumentMessage[]>;
|
|
354
354
|
|
|
355
|
-
// @
|
|
355
|
+
// @internal (undocumented)
|
|
356
356
|
export function streamObserver<T>(stream: IStream<T>, handler: (value: IStreamResult<T>) => void): IStream<T>;
|
|
357
357
|
|
|
358
|
-
// @
|
|
358
|
+
// @alpha (undocumented)
|
|
359
359
|
export enum SummaryCompressionAlgorithm {
|
|
360
360
|
// (undocumented)
|
|
361
361
|
LZ4 = 1,
|
|
@@ -363,7 +363,7 @@ export enum SummaryCompressionAlgorithm {
|
|
|
363
363
|
None = 0
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
-
// @
|
|
366
|
+
// @internal
|
|
367
367
|
export class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {
|
|
368
368
|
constructor(message: string, retryAfterSeconds: number, props: DriverErrorTelemetryProps);
|
|
369
369
|
// (undocumented)
|
|
@@ -374,7 +374,7 @@ export class ThrottlingError extends LoggingError implements IThrottlingWarning,
|
|
|
374
374
|
readonly retryAfterSeconds: number;
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
-
// @
|
|
377
|
+
// @internal
|
|
378
378
|
export class TreeTreeEntry {
|
|
379
379
|
constructor(path: string, value: ITree);
|
|
380
380
|
// (undocumented)
|
|
@@ -387,7 +387,7 @@ export class TreeTreeEntry {
|
|
|
387
387
|
readonly value: ITree;
|
|
388
388
|
}
|
|
389
389
|
|
|
390
|
-
// @
|
|
390
|
+
// @internal
|
|
391
391
|
export class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
392
392
|
constructor(message: string);
|
|
393
393
|
// (undocumented)
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* @
|
|
6
|
+
* @alpha
|
|
7
7
|
*/
|
|
8
8
|
export declare enum SummaryCompressionAlgorithm {
|
|
9
9
|
None = 0,
|
|
10
10
|
LZ4 = 1
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* @
|
|
13
|
+
* @alpha
|
|
14
14
|
*/
|
|
15
15
|
export interface ICompressionStorageConfig {
|
|
16
16
|
algorithm: SummaryCompressionAlgorithm;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.DefaultCompressionStorageConfig = exports.SummaryCompressionAlgorithm = void 0;
|
|
8
8
|
/**
|
|
9
|
-
* @
|
|
9
|
+
* @alpha
|
|
10
10
|
*/
|
|
11
11
|
var SummaryCompressionAlgorithm;
|
|
12
12
|
(function (SummaryCompressionAlgorithm) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compressionTypes.js","sourceRoot":"","sources":["../../../src/adapters/compression/compressionTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACtC,6EAAQ,CAAA;IACR,2EAAO,CAAA;AACR,CAAC,EAHW,2BAA2B,2CAA3B,2BAA2B,QAGtC;AAUY,QAAA,+BAA+B,GAAG;IAC9C,SAAS,EAAE,2BAA2B,CAAC,GAAG;IAC1C,iBAAiB,EAAE,GAAG;CACtB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @
|
|
1
|
+
{"version":3,"file":"compressionTypes.js","sourceRoot":"","sources":["../../../src/adapters/compression/compressionTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACtC,6EAAQ,CAAA;IACR,2EAAO,CAAA;AACR,CAAC,EAHW,2BAA2B,2CAA3B,2BAA2B,QAGtC;AAUY,QAAA,+BAA+B,GAAG;IAC9C,SAAS,EAAE,2BAA2B,CAAC,GAAG;IAC1C,iBAAiB,EAAE,GAAG;CACtB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @alpha\n */\nexport enum SummaryCompressionAlgorithm {\n\tNone = 0,\n\tLZ4 = 1,\n}\n\n/**\n * @alpha\n */\nexport interface ICompressionStorageConfig {\n\talgorithm: SummaryCompressionAlgorithm;\n\tminSizeToCompress: number;\n}\n\nexport const DefaultCompressionStorageConfig = {\n\talgorithm: SummaryCompressionAlgorithm.LZ4,\n\tminSizeToCompress: 500,\n};\n"]}
|
|
@@ -7,7 +7,7 @@ import { ISnapshotTree, ISummaryHandle, ISummaryTree, IVersion } from "@fluidfra
|
|
|
7
7
|
import { DocumentStorageServiceProxy } from "../../../documentStorageServiceProxy";
|
|
8
8
|
import { ICompressionStorageConfig } from "../";
|
|
9
9
|
/**
|
|
10
|
-
* @
|
|
10
|
+
* @internal
|
|
11
11
|
*/
|
|
12
12
|
export declare const blobHeadersBlobName = ".metadata.blobHeaders";
|
|
13
13
|
/**
|
package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js
CHANGED
|
@@ -12,7 +12,7 @@ const lz4js_1 = require("lz4js");
|
|
|
12
12
|
const documentStorageServiceProxy_1 = require("../../../documentStorageServiceProxy");
|
|
13
13
|
const __1 = require("../");
|
|
14
14
|
/**
|
|
15
|
-
* @
|
|
15
|
+
* @internal
|
|
16
16
|
*/
|
|
17
17
|
exports.blobHeadersBlobName = ".metadata.blobHeaders";
|
|
18
18
|
const metadataBlobName = ".metadata";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentStorageServiceSummaryBlobCompressionAdapter.js","sourceRoot":"","sources":["../../../../src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAyD;AACzD,2DAAoD;AAEpD,+EAQ8C;AAC9C,iCAA6C;AAC7C,sFAAmF;AACnF,2BAA6E;AAE7E;;GAEG;AACU,QAAA,mBAAmB,GAAG,uBAAuB,CAAC;AAC3D,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAErC;;;;;;;;;;;GAWG;AACH,MAAa,wCAAyC,SAAQ,yDAA2B;IAGxF,YACC,OAAgC,EACf,OAAkC;QAEnD,KAAK,CAAC,OAAO,CAAC,CAAC;QAFE,YAAO,GAAP,OAAO,CAA2B;QAJ5C,0BAAqB,GAAY,KAAK,CAAC;IAO/C,CAAC;IAED,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACK,MAA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AW,GAAiB,KAAK,CAAC;QACxC,MAAM,QAAQ,GAAe,wCAAwC,CAAC,aAAa,CAClF,WAAW,CAAC,OAAO,CACnB,CAAC;QACF,MAAM,SAAS,GACd,wCAAwC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC/D,MAAM,cAAc,GAAG;YACtB,IAAI,EAAE,kCAAW,CAAC,IAAI;YACtB,OAAO,EAAE,wBAAS,CAAC,IAAI,CAAC,SAAS,CAAC;SAClC,CAAC;QACF,OAAO,cAAc,CAAC;KACtB;SAAM;QACN,OAAO,KAAK,CAAC;KACb;AACF,CAAC,AAhBkC,CAgBjC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDocumentStorageService, ISummaryContext } from \"@fluidframework/driver-definitions\";\nimport {\n\tISnapshotTree,\n\tISummaryBlob,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n\tSummaryObject,\n\tSummaryType,\n} from \"@fluidframework/protocol-definitions\";\nimport { compress, decompress } from \"lz4js\";\nimport { DocumentStorageServiceProxy } from \"../../../documentStorageServiceProxy\";\nimport { ICompressionStorageConfig, SummaryCompressionAlgorithm } from \"../\";\n\n/**\n * @public\n */\nexport const blobHeadersBlobName = \".metadata.blobHeaders\";\nconst metadataBlobName = \".metadata\";\n\n/**\n * This class is a proxy for the IDocumentStorageService that compresses and decompresses blobs in the summary.\n * The identification of the compressed blobs is done by adding a compression markup blob to the summary.\n * Even if the markup blob is present, it does not mean that all blobs are compressed. The blob,\n * which is compressed also contain the compression algorithm enumerated value from the\n * SummaryCompressionAlgorithm enumeration in the first byte . If the blob is not\n * commpressed, it contains the first byte equals to SummaryCompressionAlgorithm.None .\n * In case, the markup blob is present, it is expected that the first byte of the markup blob\n * will contain the info about the compression. If the first byte is not present, it is assumed\n * that the compression is not enabled and no first prefix byte is present in the blobs.\n * @public\n */\nexport class DocumentStorageServiceCompressionAdapter extends DocumentStorageServiceProxy {\n\tprivate _isCompressionEnabled: boolean = false;\n\n\tconstructor(\n\t\tservice: IDocumentStorageService,\n\t\tprivate readonly _config: ICompressionStorageConfig,\n\t) {\n\t\tsuper(service);\n\t}\n\n\tpublic get service(): IDocumentStorageService {\n\t\treturn this.internalStorageService;\n\t}\n\n\t/**\n\t * This method returns `true` if there is a compression markup byte in the blob, otherwise `false`.\n\t * @param blob - The blob to compress.\n\t * @returns `true` if there is a compression markup byte in the blob, otherwise `false`.\n\t */\n\tprivate static hasPrefix(blob: ArrayBufferLike): boolean {\n\t\tconst firstByte = IsoBuffer.from(blob)[0];\n\t\t// eslint-disable-next-line no-bitwise\n\t\treturn (firstByte & 0xf0) === 0xb0;\n\t}\n\n\t/**\n\t * This method reads the first byte from the given blob and maps that byte to the compression algorithm.\n\t * @param blob - The maybe compressed blob.\n\t */\n\tprivate static readAlgorithmFromBlob(blob: ArrayBufferLike): number {\n\t\treturn !this.hasPrefix(blob)\n\t\t\t? SummaryCompressionAlgorithm.None\n\t\t\t: // eslint-disable-next-line no-bitwise\n\t\t\t IsoBuffer.from(blob)[0] & 0x0f;\n\t}\n\n\t/**\n\t * This method writes the given algorithm to the blob as the first byte.\n\t * @param blob - The blob to write the algorithm to.\n\t * @param algorithm - The algorithm to write.\n\t * @returns The blob with the algorithm as the first byte.\n\t */\n\tprivate static writeAlgorithmToBlob(blob: ArrayBufferLike, algorithm: number): ArrayBufferLike {\n\t\tif (algorithm === SummaryCompressionAlgorithm.None) {\n\t\t\tconst firstByte = IsoBuffer.from(blob)[0];\n\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\tif ((firstByte & 0xf0) !== 0xb0) {\n\t\t\t\treturn blob;\n\t\t\t}\n\t\t}\n\t\tassert(algorithm < 0x10, 0x6f5 /* Algorithm should be less than 0x10 */);\n\t\tconst blobView = new Uint8Array(blob);\n\t\tconst blobLength = blobView.length;\n\t\tconst newBlob = new Uint8Array(blobLength + 1);\n\t\t// eslint-disable-next-line no-bitwise\n\t\tconst prefix = 0xb0 | algorithm;\n\t\tnewBlob[0] = prefix;\n\t\tnewBlob.set(blobView, 1);\n\t\treturn IsoBuffer.from(newBlob);\n\t}\n\n\t/**\n\t * This method removes the algorithm markup prefix from the blob (1 byte)\n\t * @param blob - The blob to remove the prefix from.\n\t * @returns The blob without the prefix.\n\t */\n\tprivate static removePrefixFromBlobIfPresent(blob: ArrayBufferLike): ArrayBufferLike {\n\t\tconst blobView = new Uint8Array(blob);\n\t\treturn this.hasPrefix(blob) ? IsoBuffer.from(blobView.subarray(1)) : blob;\n\t}\n\n\t/**\n\t * This method converts the given argument to Uint8Array. If the parameter is already Uint8Array,\n\t * it is just returned as is. If the parameter is string, it is converted to Uint8Array using\n\t * TextEncoder.\n\t * @param input - The input to convert to Uint8Array.\n\t * @returns The Uint8Array representation of the input.\n\t */\n\tprivate static toBinaryArray(input: string | Uint8Array): Uint8Array {\n\t\treturn typeof input === \"string\" ? new TextEncoder().encode(input) : input;\n\t}\n\n\t/**\n\t * This method encodes the blob inside the given summary object of the SummaryType.Blob type using the given config\n\t * containing the compression algorithm.\n\t * @param input - The summary object to encode.\n\t * @param config - The config containing the compression algorithm.\n\t * @returns The summary object with the encoded blob.\n\t */\n\tprivate static readonly blobEncoder = (\n\t\tinput: SummaryObject,\n\t\tconfig: ICompressionStorageConfig,\n\t): SummaryObject => {\n\t\tif (input.type === SummaryType.Blob) {\n\t\t\tconst summaryBlob: ISummaryBlob = input;\n\t\t\tconst original: ArrayBufferLike =\n\t\t\t\tDocumentStorageServiceCompressionAdapter.toBinaryArray(summaryBlob.content);\n\t\t\tconst processed: ArrayBufferLike = DocumentStorageServiceCompressionAdapter.encodeBlob(\n\t\t\t\toriginal,\n\t\t\t\tconfig,\n\t\t\t);\n\t\t\tconst newSummaryBlob = {\n\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\tcontent: IsoBuffer.from(processed),\n\t\t\t};\n\t\t\treturn newSummaryBlob;\n\t\t} else {\n\t\t\treturn input;\n\t\t}\n\t};\n\n\t/**\n\t * This method decodes the blob inside the given summary object of the SummaryType.Blob type.\n\t * @param input - The summary object to decode.\n\t * @returns The summary object with the decoded blob.\n\t */\n\tprivate static readonly blobDecoder = (input: SummaryObject): SummaryObject => {\n\t\tif (input.type === SummaryType.Blob) {\n\t\t\tconst summaryBlob: ISummaryBlob = input;\n\t\t\tconst original: Uint8Array = DocumentStorageServiceCompressionAdapter.toBinaryArray(\n\t\t\t\tsummaryBlob.content,\n\t\t\t);\n\t\t\tconst processed: ArrayBufferLike =\n\t\t\t\tDocumentStorageServiceCompressionAdapter.decodeBlob(original);\n\t\t\tconst newSummaryBlob = {\n\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\tcontent: IsoBuffer.from(processed),\n\t\t\t};\n\t\t\treturn newSummaryBlob;\n\t\t} else {\n\t\t\treturn input;\n\t\t}\n\t};\n\n\t/**\n\t * This method encodes the given blob according to the given config.\n\t * @param file - The blob to encode.\n\t * @param config - The config to use for encoding.\n\t * @returns The encoded blob.\n\t */\n\tprivate static encodeBlob(\n\t\tfile: ArrayBufferLike,\n\t\tconfig: ICompressionStorageConfig,\n\t): ArrayBufferLike {\n\t\tlet maybeCompressed: ArrayBufferLike;\n\t\tlet algorithm = config.algorithm;\n\t\tif (new Uint8Array(file).length < config.minSizeToCompress) {\n\t\t\tmaybeCompressed = file;\n\t\t\talgorithm = SummaryCompressionAlgorithm.None;\n\t\t} else if (algorithm === SummaryCompressionAlgorithm.None) {\n\t\t\tmaybeCompressed = file;\n\t\t} else if (algorithm === SummaryCompressionAlgorithm.LZ4) {\n\t\t\tconst compressed = compress(file) as ArrayBufferLike;\n\t\t\tmaybeCompressed = compressed;\n\t\t} else {\n\t\t\tthrow new Error(`Unknown Algorithm ${config.algorithm}`);\n\t\t}\n\t\tmaybeCompressed = DocumentStorageServiceCompressionAdapter.writeAlgorithmToBlob(\n\t\t\tmaybeCompressed,\n\t\t\talgorithm,\n\t\t);\n\t\treturn maybeCompressed;\n\t}\n\n\t/**\n\t * This method decodes the given blob.\n\t * @param file - The blob to decode.\n\t * @returns The decoded blob.\n\t */\n\tprivate static decodeBlob(file: ArrayBufferLike): ArrayBufferLike {\n\t\tlet decompressed: ArrayBufferLike;\n\t\tlet originalBlob;\n\t\tlet algorithm;\n\t\tif (this.hasPrefix(file)) {\n\t\t\talgorithm = DocumentStorageServiceCompressionAdapter.readAlgorithmFromBlob(file);\n\t\t\toriginalBlob = this.removePrefixFromBlobIfPresent(file);\n\t\t} else {\n\t\t\talgorithm = SummaryCompressionAlgorithm.None;\n\t\t\toriginalBlob = file;\n\t\t}\n\t\tif (algorithm === SummaryCompressionAlgorithm.None) {\n\t\t\tdecompressed = originalBlob;\n\t\t} else if (algorithm === SummaryCompressionAlgorithm.LZ4) {\n\t\t\tdecompressed = decompress(originalBlob) as ArrayBufferLike;\n\t\t} else {\n\t\t\tthrow new Error(`Unknown Algorithm ${algorithm}`);\n\t\t}\n\t\treturn decompressed;\n\t}\n\n\t/**\n\t * This method traverses the SummaryObject recursively. If it finds the ISummaryBlob object,\n\t * it applies encoding/decoding on it according to the given isEncode flag.\n\t * @param isEncode - True if the encoding should be applied, false if the decoding should be applied.\n\t * @param input - The summary object to traverse.\n\t * @param encoder - The encoder function to use.\n\t * @param decoder - The decoder function to use.\n\t * @param config - The config to use for encoding.\n\t * @param context - The summary context.\n\t * @returns The summary object with the encoded/decoded blob.\n\t */\n\tprivate static recursivelyReplace(\n\t\tisEncode: boolean,\n\t\tinput: SummaryObject,\n\t\tencoder: (input: SummaryObject, config: ICompressionStorageConfig) => SummaryObject,\n\t\tdecoder: (input: SummaryObject) => SummaryObject,\n\t\tconfig: ICompressionStorageConfig,\n\t\tcontext?: ISummaryContext,\n\t): SummaryObject {\n\t\tassert(typeof input === \"object\", 0x6f6 /* input must be a non-null object */);\n\t\tconst maybeReplaced = isEncode ? encoder(input, config) : decoder(input);\n\n\t\tif (maybeReplaced !== input) {\n\t\t\treturn maybeReplaced;\n\t\t}\n\t\tlet clone: object | undefined;\n\t\tfor (const key of Object.keys(input)) {\n\t\t\tconst value = input[key];\n\n\t\t\tif (Boolean(value) && typeof value === \"object\") {\n\t\t\t\tconst replaced = this.recursivelyReplace(\n\t\t\t\t\tisEncode,\n\t\t\t\t\tvalue as SummaryObject,\n\t\t\t\t\tencoder,\n\t\t\t\t\tdecoder,\n\t\t\t\t\tconfig,\n\t\t\t\t\tcontext,\n\t\t\t\t);\n\t\t\t\tif (replaced !== value) {\n\t\t\t\t\tclone = clone ?? (Array.isArray(input) ? [...input] : { ...input });\n\t\t\t\t\tclone[key] = replaced;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn (clone ?? input) as SummaryObject;\n\t}\n\n\t/**\n\t * This method traverses the SummaryTree recursively. If it finds the ISummaryBlob object with the key '.metadata',\n\t * it returns the summary tree containing that blob.\n\t *\n\t * @param summary - The summary tree to traverse.\n\t * @returns The summary tree containing the metadata blob.\n\t */\n\tprivate static findMetadataHolderSummary(summary: ISummaryTree): ISummaryTree | undefined {\n\t\tassert(typeof summary === \"object\", 0x6f7 /* summary must be a non-null object */);\n\t\tfor (const key of Object.keys(summary.tree)) {\n\t\t\tconst value = summary.tree[key];\n\n\t\t\tif (Boolean(value) && value.type === SummaryType.Tree) {\n\t\t\t\tconst found = this.findMetadataHolderSummary(value);\n\t\t\t\tif (found) {\n\t\t\t\t\treturn found;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (Boolean(value) && key === metadataBlobName && value.type === SummaryType.Blob) {\n\t\t\t\treturn summary;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * This method obtains the summary tree containing the metadata blob. It returns the content\n\t * of the tree atribute.\n\t * @param summary - The summary tree to traverse.\n\t * @returns The content of the tree attribute of the summary tree containing the metadata blob.\n\t */\n\tprivate static getMetadataHolderTree(summary: ISummaryTree) {\n\t\tconst metadataHolder = this.findMetadataHolderSummary(summary);\n\t\tassert(metadataHolder !== undefined, 0x6f8 /* metadataHolder must be a non-null object */);\n\t\tconst metadataHolderTree = metadataHolder.tree;\n\t\treturn metadataHolderTree;\n\t}\n\n\t/**\n\t * This method adds the compression markup blob to the nested summary tree containing the metadata blob.\n\t * @param summary - The top summary tree to put the compression markup blob into.\n\t */\n\tprivate static putCompressionMarkup(summary: ISummaryTree): void {\n\t\tconst metadataHolderTree =\n\t\t\tDocumentStorageServiceCompressionAdapter.getMetadataHolderTree(summary);\n\t\tmetadataHolderTree[blobHeadersBlobName] = {\n\t\t\ttype: 2,\n\t\t\tcontent: \"\",\n\t\t};\n\t}\n\n\t/**\n\t * This method traverses the SnapshotTree recursively. If it finds the ISummaryBlob object with the key '.metadata',\n\t * it checks, if the SummaryTree holder of that object also contains the compression markup blob. If it is found,\n\t * it returns true, otherwise false.\n\t * @param snapshot - The snapshot tree to traverse.\n\t * @returns True if the compression markup blob is found, otherwise false.\n\t */\n\tprivate static hasCompressionMarkup(snapshot: ISnapshotTree): boolean {\n\t\tassert(typeof snapshot === \"object\", 0x6f9 /* snapshot must be a non-null object */);\n\t\tfor (const key of Object.keys(snapshot.blobs)) {\n\t\t\tif (key === metadataBlobName) {\n\t\t\t\tconst value = snapshot.blobs[blobHeadersBlobName];\n\t\t\t\tif (value !== undefined) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const key of Object.keys(snapshot.trees)) {\n\t\t\tconst value = snapshot[key] as ISnapshotTree;\n\t\t\tif (value !== undefined) {\n\t\t\t\tconst found = this.hasCompressionMarkup(value);\n\t\t\t\tif (found) {\n\t\t\t\t\treturn found;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * This method performs compression of the blobs in the summary tree.\n\t * @param summary - The summary tree to compress.\n\t * @param config - The compression config.\n\t * @returns The compressed summary tree.\n\t */\n\tpublic static compressSummary(\n\t\tsummary: ISummaryTree,\n\t\tconfig: ICompressionStorageConfig,\n\t): ISummaryTree {\n\t\tthis.putCompressionMarkup(summary);\n\t\tconst prep = DocumentStorageServiceCompressionAdapter.recursivelyReplace(\n\t\t\ttrue,\n\t\t\tsummary,\n\t\t\tDocumentStorageServiceCompressionAdapter.blobEncoder,\n\t\t\tDocumentStorageServiceCompressionAdapter.blobDecoder,\n\t\t\tconfig,\n\t\t) as ISummaryTree;\n\t\t//\tconsole.log(`Miso summary-blob Summary Upload: ${JSON.stringify(prep).length}`);\n\t\treturn prep;\n\t}\n\n\t/**\n\t * This method read blob from the storage and decompresses it if it is compressed.\n\t * @param id - The id of the blob to read.\n\t * @returns The decompressed blob.\n\t */\n\tpublic override async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\tconst originalBlob = await super.readBlob(id);\n\t\tif (!this._isCompressionEnabled) {\n\t\t\treturn originalBlob;\n\t\t} else {\n\t\t\tconst decompressedBlob =\n\t\t\t\tDocumentStorageServiceCompressionAdapter.decodeBlob(originalBlob);\n\t\t\t//\t\t\tconsole.log(`Miso summary-blob Blob read END : ${id} ${decompressedBlob.byteLength}`);\n\t\t\treturn decompressedBlob;\n\t\t}\n\t}\n\n\t/**\n\t * This method loads the snapshot tree from the server. It also checks, if the compression markup blob is present\n\t * and setups the compression flag accordingly. It also identifies the blobs that are not compressed and do not contain\n\t * algorithm byte prefix and store them.\n\t * @param version - The version of the snapshot tree to load.\n\t * @param scenarioName - The scenario name of the snapshot tree to load.\n\t * @returns The snapshot tree.\n\t */\n\tpublic override async getSnapshotTree(\n\t\tversion?: IVersion | undefined,\n\t\tscenarioName?: string | undefined,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t): Promise<ISnapshotTree | null> {\n\t\tconst snapshotTree = await super.getSnapshotTree(version, scenarioName);\n\t\tthis._isCompressionEnabled =\n\t\t\tsnapshotTree !== undefined &&\n\t\t\tsnapshotTree !== null &&\n\t\t\tDocumentStorageServiceCompressionAdapter.hasCompressionMarkup(snapshotTree);\n\t\treturn snapshotTree;\n\t}\n\n\t/**\n\t * This method uploads the summary to the storage. It performs compression of the blobs in the summary tree.\n\t * @param summary - The summary tree to upload.\n\t * @param context - The summary context.\n\t * @returns The ID of the uploaded summary.\n\t */\n\tpublic override async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tconst prep = DocumentStorageServiceCompressionAdapter.compressSummary(\n\t\t\tsummary,\n\t\t\tthis._config,\n\t\t);\n\t\treturn super.uploadSummaryWithContext(prep, context);\n\t}\n\n\t/**\n\t * This method downloads the summary from the storage and then applies decompression on the compressed blobs.\n\t * @param id - The ID of the summary to be downloaded\n\t * @returns The summary with decompressed blobs\n\t */\n\tpublic override async downloadSummary(id: ISummaryHandle): Promise<ISummaryTree> {\n\t\tconst summary = await super.downloadSummary(id);\n\t\treturn !this._isCompressionEnabled\n\t\t\t? summary\n\t\t\t: (DocumentStorageServiceCompressionAdapter.recursivelyReplace(\n\t\t\t\t\tfalse,\n\t\t\t\t\tsummary,\n\t\t\t\t\tDocumentStorageServiceCompressionAdapter.blobEncoder,\n\t\t\t\t\tDocumentStorageServiceCompressionAdapter.blobDecoder,\n\t\t\t\t\tthis._config,\n\t\t\t ) as ISummaryTree);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"documentStorageServiceSummaryBlobCompressionAdapter.js","sourceRoot":"","sources":["../../../../src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAyD;AACzD,2DAAoD;AAEpD,+EAQ8C;AAC9C,iCAA6C;AAC7C,sFAAmF;AACnF,2BAA6E;AAE7E;;GAEG;AACU,QAAA,mBAAmB,GAAG,uBAAuB,CAAC;AAC3D,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAErC;;;;;;;;;;;GAWG;AACH,MAAa,wCAAyC,SAAQ,yDAA2B;IAGxF,YACC,OAAgC,EACf,OAAk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AAC;KACtB;SAAM;QACN,OAAO,KAAK,CAAC;KACb;AACF,CAAC,AApBkC,CAoBjC;AAEF;;;;GAIG;AACqB,oDAAW,GAAG,CAAC,KAAoB,EAAiB,EAAE;IAC7E,IAAI,KAAK,CAAC,IAAI,KAAK,kCAAW,CAAC,IAAI,EAAE;QACpC,MAAM,WAAW,GAAiB,KAAK,CAAC;QACxC,MAAM,QAAQ,GAAe,wCAAwC,CAAC,aAAa,CAClF,WAAW,CAAC,OAAO,CACnB,CAAC;QACF,MAAM,SAAS,GACd,wCAAwC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC/D,MAAM,cAAc,GAAG;YACtB,IAAI,EAAE,kCAAW,CAAC,IAAI;YACtB,OAAO,EAAE,wBAAS,CAAC,IAAI,CAAC,SAAS,CAAC;SAClC,CAAC;QACF,OAAO,cAAc,CAAC;KACtB;SAAM;QACN,OAAO,KAAK,CAAC;KACb;AACF,CAAC,AAhBkC,CAgBjC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDocumentStorageService, ISummaryContext } from \"@fluidframework/driver-definitions\";\nimport {\n\tISnapshotTree,\n\tISummaryBlob,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n\tSummaryObject,\n\tSummaryType,\n} from \"@fluidframework/protocol-definitions\";\nimport { compress, decompress } from \"lz4js\";\nimport { DocumentStorageServiceProxy } from \"../../../documentStorageServiceProxy\";\nimport { ICompressionStorageConfig, SummaryCompressionAlgorithm } from \"../\";\n\n/**\n * @internal\n */\nexport const blobHeadersBlobName = \".metadata.blobHeaders\";\nconst metadataBlobName = \".metadata\";\n\n/**\n * This class is a proxy for the IDocumentStorageService that compresses and decompresses blobs in the summary.\n * The identification of the compressed blobs is done by adding a compression markup blob to the summary.\n * Even if the markup blob is present, it does not mean that all blobs are compressed. The blob,\n * which is compressed also contain the compression algorithm enumerated value from the\n * SummaryCompressionAlgorithm enumeration in the first byte . If the blob is not\n * commpressed, it contains the first byte equals to SummaryCompressionAlgorithm.None .\n * In case, the markup blob is present, it is expected that the first byte of the markup blob\n * will contain the info about the compression. If the first byte is not present, it is assumed\n * that the compression is not enabled and no first prefix byte is present in the blobs.\n * @public\n */\nexport class DocumentStorageServiceCompressionAdapter extends DocumentStorageServiceProxy {\n\tprivate _isCompressionEnabled: boolean = false;\n\n\tconstructor(\n\t\tservice: IDocumentStorageService,\n\t\tprivate readonly _config: ICompressionStorageConfig,\n\t) {\n\t\tsuper(service);\n\t}\n\n\tpublic get service(): IDocumentStorageService {\n\t\treturn this.internalStorageService;\n\t}\n\n\t/**\n\t * This method returns `true` if there is a compression markup byte in the blob, otherwise `false`.\n\t * @param blob - The blob to compress.\n\t * @returns `true` if there is a compression markup byte in the blob, otherwise `false`.\n\t */\n\tprivate static hasPrefix(blob: ArrayBufferLike): boolean {\n\t\tconst firstByte = IsoBuffer.from(blob)[0];\n\t\t// eslint-disable-next-line no-bitwise\n\t\treturn (firstByte & 0xf0) === 0xb0;\n\t}\n\n\t/**\n\t * This method reads the first byte from the given blob and maps that byte to the compression algorithm.\n\t * @param blob - The maybe compressed blob.\n\t */\n\tprivate static readAlgorithmFromBlob(blob: ArrayBufferLike): number {\n\t\treturn !this.hasPrefix(blob)\n\t\t\t? SummaryCompressionAlgorithm.None\n\t\t\t: // eslint-disable-next-line no-bitwise\n\t\t\t IsoBuffer.from(blob)[0] & 0x0f;\n\t}\n\n\t/**\n\t * This method writes the given algorithm to the blob as the first byte.\n\t * @param blob - The blob to write the algorithm to.\n\t * @param algorithm - The algorithm to write.\n\t * @returns The blob with the algorithm as the first byte.\n\t */\n\tprivate static writeAlgorithmToBlob(blob: ArrayBufferLike, algorithm: number): ArrayBufferLike {\n\t\tif (algorithm === SummaryCompressionAlgorithm.None) {\n\t\t\tconst firstByte = IsoBuffer.from(blob)[0];\n\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\tif ((firstByte & 0xf0) !== 0xb0) {\n\t\t\t\treturn blob;\n\t\t\t}\n\t\t}\n\t\tassert(algorithm < 0x10, 0x6f5 /* Algorithm should be less than 0x10 */);\n\t\tconst blobView = new Uint8Array(blob);\n\t\tconst blobLength = blobView.length;\n\t\tconst newBlob = new Uint8Array(blobLength + 1);\n\t\t// eslint-disable-next-line no-bitwise\n\t\tconst prefix = 0xb0 | algorithm;\n\t\tnewBlob[0] = prefix;\n\t\tnewBlob.set(blobView, 1);\n\t\treturn IsoBuffer.from(newBlob);\n\t}\n\n\t/**\n\t * This method removes the algorithm markup prefix from the blob (1 byte)\n\t * @param blob - The blob to remove the prefix from.\n\t * @returns The blob without the prefix.\n\t */\n\tprivate static removePrefixFromBlobIfPresent(blob: ArrayBufferLike): ArrayBufferLike {\n\t\tconst blobView = new Uint8Array(blob);\n\t\treturn this.hasPrefix(blob) ? IsoBuffer.from(blobView.subarray(1)) : blob;\n\t}\n\n\t/**\n\t * This method converts the given argument to Uint8Array. If the parameter is already Uint8Array,\n\t * it is just returned as is. If the parameter is string, it is converted to Uint8Array using\n\t * TextEncoder.\n\t * @param input - The input to convert to Uint8Array.\n\t * @returns The Uint8Array representation of the input.\n\t */\n\tprivate static toBinaryArray(input: string | Uint8Array): Uint8Array {\n\t\treturn typeof input === \"string\" ? new TextEncoder().encode(input) : input;\n\t}\n\n\t/**\n\t * This method encodes the blob inside the given summary object of the SummaryType.Blob type using the given config\n\t * containing the compression algorithm.\n\t * @param input - The summary object to encode.\n\t * @param config - The config containing the compression algorithm.\n\t * @returns The summary object with the encoded blob.\n\t */\n\tprivate static readonly blobEncoder = (\n\t\tinput: SummaryObject,\n\t\tconfig: ICompressionStorageConfig,\n\t): SummaryObject => {\n\t\tif (input.type === SummaryType.Blob) {\n\t\t\tconst summaryBlob: ISummaryBlob = input;\n\t\t\tconst original: ArrayBufferLike =\n\t\t\t\tDocumentStorageServiceCompressionAdapter.toBinaryArray(summaryBlob.content);\n\t\t\tconst processed: ArrayBufferLike = DocumentStorageServiceCompressionAdapter.encodeBlob(\n\t\t\t\toriginal,\n\t\t\t\tconfig,\n\t\t\t);\n\t\t\tconst newSummaryBlob = {\n\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\tcontent: IsoBuffer.from(processed),\n\t\t\t};\n\t\t\treturn newSummaryBlob;\n\t\t} else {\n\t\t\treturn input;\n\t\t}\n\t};\n\n\t/**\n\t * This method decodes the blob inside the given summary object of the SummaryType.Blob type.\n\t * @param input - The summary object to decode.\n\t * @returns The summary object with the decoded blob.\n\t */\n\tprivate static readonly blobDecoder = (input: SummaryObject): SummaryObject => {\n\t\tif (input.type === SummaryType.Blob) {\n\t\t\tconst summaryBlob: ISummaryBlob = input;\n\t\t\tconst original: Uint8Array = DocumentStorageServiceCompressionAdapter.toBinaryArray(\n\t\t\t\tsummaryBlob.content,\n\t\t\t);\n\t\t\tconst processed: ArrayBufferLike =\n\t\t\t\tDocumentStorageServiceCompressionAdapter.decodeBlob(original);\n\t\t\tconst newSummaryBlob = {\n\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\tcontent: IsoBuffer.from(processed),\n\t\t\t};\n\t\t\treturn newSummaryBlob;\n\t\t} else {\n\t\t\treturn input;\n\t\t}\n\t};\n\n\t/**\n\t * This method encodes the given blob according to the given config.\n\t * @param file - The blob to encode.\n\t * @param config - The config to use for encoding.\n\t * @returns The encoded blob.\n\t */\n\tprivate static encodeBlob(\n\t\tfile: ArrayBufferLike,\n\t\tconfig: ICompressionStorageConfig,\n\t): ArrayBufferLike {\n\t\tlet maybeCompressed: ArrayBufferLike;\n\t\tlet algorithm = config.algorithm;\n\t\tif (new Uint8Array(file).length < config.minSizeToCompress) {\n\t\t\tmaybeCompressed = file;\n\t\t\talgorithm = SummaryCompressionAlgorithm.None;\n\t\t} else if (algorithm === SummaryCompressionAlgorithm.None) {\n\t\t\tmaybeCompressed = file;\n\t\t} else if (algorithm === SummaryCompressionAlgorithm.LZ4) {\n\t\t\tconst compressed = compress(file) as ArrayBufferLike;\n\t\t\tmaybeCompressed = compressed;\n\t\t} else {\n\t\t\tthrow new Error(`Unknown Algorithm ${config.algorithm}`);\n\t\t}\n\t\tmaybeCompressed = DocumentStorageServiceCompressionAdapter.writeAlgorithmToBlob(\n\t\t\tmaybeCompressed,\n\t\t\talgorithm,\n\t\t);\n\t\treturn maybeCompressed;\n\t}\n\n\t/**\n\t * This method decodes the given blob.\n\t * @param file - The blob to decode.\n\t * @returns The decoded blob.\n\t */\n\tprivate static decodeBlob(file: ArrayBufferLike): ArrayBufferLike {\n\t\tlet decompressed: ArrayBufferLike;\n\t\tlet originalBlob;\n\t\tlet algorithm;\n\t\tif (this.hasPrefix(file)) {\n\t\t\talgorithm = DocumentStorageServiceCompressionAdapter.readAlgorithmFromBlob(file);\n\t\t\toriginalBlob = this.removePrefixFromBlobIfPresent(file);\n\t\t} else {\n\t\t\talgorithm = SummaryCompressionAlgorithm.None;\n\t\t\toriginalBlob = file;\n\t\t}\n\t\tif (algorithm === SummaryCompressionAlgorithm.None) {\n\t\t\tdecompressed = originalBlob;\n\t\t} else if (algorithm === SummaryCompressionAlgorithm.LZ4) {\n\t\t\tdecompressed = decompress(originalBlob) as ArrayBufferLike;\n\t\t} else {\n\t\t\tthrow new Error(`Unknown Algorithm ${algorithm}`);\n\t\t}\n\t\treturn decompressed;\n\t}\n\n\t/**\n\t * This method traverses the SummaryObject recursively. If it finds the ISummaryBlob object,\n\t * it applies encoding/decoding on it according to the given isEncode flag.\n\t * @param isEncode - True if the encoding should be applied, false if the decoding should be applied.\n\t * @param input - The summary object to traverse.\n\t * @param encoder - The encoder function to use.\n\t * @param decoder - The decoder function to use.\n\t * @param config - The config to use for encoding.\n\t * @param context - The summary context.\n\t * @returns The summary object with the encoded/decoded blob.\n\t */\n\tprivate static recursivelyReplace(\n\t\tisEncode: boolean,\n\t\tinput: SummaryObject,\n\t\tencoder: (input: SummaryObject, config: ICompressionStorageConfig) => SummaryObject,\n\t\tdecoder: (input: SummaryObject) => SummaryObject,\n\t\tconfig: ICompressionStorageConfig,\n\t\tcontext?: ISummaryContext,\n\t): SummaryObject {\n\t\tassert(typeof input === \"object\", 0x6f6 /* input must be a non-null object */);\n\t\tconst maybeReplaced = isEncode ? encoder(input, config) : decoder(input);\n\n\t\tif (maybeReplaced !== input) {\n\t\t\treturn maybeReplaced;\n\t\t}\n\t\tlet clone: object | undefined;\n\t\tfor (const key of Object.keys(input)) {\n\t\t\tconst value = input[key];\n\n\t\t\tif (Boolean(value) && typeof value === \"object\") {\n\t\t\t\tconst replaced = this.recursivelyReplace(\n\t\t\t\t\tisEncode,\n\t\t\t\t\tvalue as SummaryObject,\n\t\t\t\t\tencoder,\n\t\t\t\t\tdecoder,\n\t\t\t\t\tconfig,\n\t\t\t\t\tcontext,\n\t\t\t\t);\n\t\t\t\tif (replaced !== value) {\n\t\t\t\t\tclone = clone ?? (Array.isArray(input) ? [...input] : { ...input });\n\t\t\t\t\tclone[key] = replaced;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn (clone ?? input) as SummaryObject;\n\t}\n\n\t/**\n\t * This method traverses the SummaryTree recursively. If it finds the ISummaryBlob object with the key '.metadata',\n\t * it returns the summary tree containing that blob.\n\t *\n\t * @param summary - The summary tree to traverse.\n\t * @returns The summary tree containing the metadata blob.\n\t */\n\tprivate static findMetadataHolderSummary(summary: ISummaryTree): ISummaryTree | undefined {\n\t\tassert(typeof summary === \"object\", 0x6f7 /* summary must be a non-null object */);\n\t\tfor (const key of Object.keys(summary.tree)) {\n\t\t\tconst value = summary.tree[key];\n\n\t\t\tif (Boolean(value) && value.type === SummaryType.Tree) {\n\t\t\t\tconst found = this.findMetadataHolderSummary(value);\n\t\t\t\tif (found) {\n\t\t\t\t\treturn found;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (Boolean(value) && key === metadataBlobName && value.type === SummaryType.Blob) {\n\t\t\t\treturn summary;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * This method obtains the summary tree containing the metadata blob. It returns the content\n\t * of the tree atribute.\n\t * @param summary - The summary tree to traverse.\n\t * @returns The content of the tree attribute of the summary tree containing the metadata blob.\n\t */\n\tprivate static getMetadataHolderTree(summary: ISummaryTree) {\n\t\tconst metadataHolder = this.findMetadataHolderSummary(summary);\n\t\tassert(metadataHolder !== undefined, 0x6f8 /* metadataHolder must be a non-null object */);\n\t\tconst metadataHolderTree = metadataHolder.tree;\n\t\treturn metadataHolderTree;\n\t}\n\n\t/**\n\t * This method adds the compression markup blob to the nested summary tree containing the metadata blob.\n\t * @param summary - The top summary tree to put the compression markup blob into.\n\t */\n\tprivate static putCompressionMarkup(summary: ISummaryTree): void {\n\t\tconst metadataHolderTree =\n\t\t\tDocumentStorageServiceCompressionAdapter.getMetadataHolderTree(summary);\n\t\tmetadataHolderTree[blobHeadersBlobName] = {\n\t\t\ttype: 2,\n\t\t\tcontent: \"\",\n\t\t};\n\t}\n\n\t/**\n\t * This method traverses the SnapshotTree recursively. If it finds the ISummaryBlob object with the key '.metadata',\n\t * it checks, if the SummaryTree holder of that object also contains the compression markup blob. If it is found,\n\t * it returns true, otherwise false.\n\t * @param snapshot - The snapshot tree to traverse.\n\t * @returns True if the compression markup blob is found, otherwise false.\n\t */\n\tprivate static hasCompressionMarkup(snapshot: ISnapshotTree): boolean {\n\t\tassert(typeof snapshot === \"object\", 0x6f9 /* snapshot must be a non-null object */);\n\t\tfor (const key of Object.keys(snapshot.blobs)) {\n\t\t\tif (key === metadataBlobName) {\n\t\t\t\tconst value = snapshot.blobs[blobHeadersBlobName];\n\t\t\t\tif (value !== undefined) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const key of Object.keys(snapshot.trees)) {\n\t\t\tconst value = snapshot[key] as ISnapshotTree;\n\t\t\tif (value !== undefined) {\n\t\t\t\tconst found = this.hasCompressionMarkup(value);\n\t\t\t\tif (found) {\n\t\t\t\t\treturn found;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * This method performs compression of the blobs in the summary tree.\n\t * @param summary - The summary tree to compress.\n\t * @param config - The compression config.\n\t * @returns The compressed summary tree.\n\t */\n\tpublic static compressSummary(\n\t\tsummary: ISummaryTree,\n\t\tconfig: ICompressionStorageConfig,\n\t): ISummaryTree {\n\t\tthis.putCompressionMarkup(summary);\n\t\tconst prep = DocumentStorageServiceCompressionAdapter.recursivelyReplace(\n\t\t\ttrue,\n\t\t\tsummary,\n\t\t\tDocumentStorageServiceCompressionAdapter.blobEncoder,\n\t\t\tDocumentStorageServiceCompressionAdapter.blobDecoder,\n\t\t\tconfig,\n\t\t) as ISummaryTree;\n\t\t//\tconsole.log(`Miso summary-blob Summary Upload: ${JSON.stringify(prep).length}`);\n\t\treturn prep;\n\t}\n\n\t/**\n\t * This method read blob from the storage and decompresses it if it is compressed.\n\t * @param id - The id of the blob to read.\n\t * @returns The decompressed blob.\n\t */\n\tpublic override async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\tconst originalBlob = await super.readBlob(id);\n\t\tif (!this._isCompressionEnabled) {\n\t\t\treturn originalBlob;\n\t\t} else {\n\t\t\tconst decompressedBlob =\n\t\t\t\tDocumentStorageServiceCompressionAdapter.decodeBlob(originalBlob);\n\t\t\t//\t\t\tconsole.log(`Miso summary-blob Blob read END : ${id} ${decompressedBlob.byteLength}`);\n\t\t\treturn decompressedBlob;\n\t\t}\n\t}\n\n\t/**\n\t * This method loads the snapshot tree from the server. It also checks, if the compression markup blob is present\n\t * and setups the compression flag accordingly. It also identifies the blobs that are not compressed and do not contain\n\t * algorithm byte prefix and store them.\n\t * @param version - The version of the snapshot tree to load.\n\t * @param scenarioName - The scenario name of the snapshot tree to load.\n\t * @returns The snapshot tree.\n\t */\n\tpublic override async getSnapshotTree(\n\t\tversion?: IVersion | undefined,\n\t\tscenarioName?: string | undefined,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t): Promise<ISnapshotTree | null> {\n\t\tconst snapshotTree = await super.getSnapshotTree(version, scenarioName);\n\t\tthis._isCompressionEnabled =\n\t\t\tsnapshotTree !== undefined &&\n\t\t\tsnapshotTree !== null &&\n\t\t\tDocumentStorageServiceCompressionAdapter.hasCompressionMarkup(snapshotTree);\n\t\treturn snapshotTree;\n\t}\n\n\t/**\n\t * This method uploads the summary to the storage. It performs compression of the blobs in the summary tree.\n\t * @param summary - The summary tree to upload.\n\t * @param context - The summary context.\n\t * @returns The ID of the uploaded summary.\n\t */\n\tpublic override async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tconst prep = DocumentStorageServiceCompressionAdapter.compressSummary(\n\t\t\tsummary,\n\t\t\tthis._config,\n\t\t);\n\t\treturn super.uploadSummaryWithContext(prep, context);\n\t}\n\n\t/**\n\t * This method downloads the summary from the storage and then applies decompression on the compressed blobs.\n\t * @param id - The ID of the summary to be downloaded\n\t * @returns The summary with decompressed blobs\n\t */\n\tpublic override async downloadSummary(id: ISummaryHandle): Promise<ISummaryTree> {\n\t\tconst summary = await super.downloadSummary(id);\n\t\treturn !this._isCompressionEnabled\n\t\t\t? summary\n\t\t\t: (DocumentStorageServiceCompressionAdapter.recursivelyReplace(\n\t\t\t\t\tfalse,\n\t\t\t\t\tsummary,\n\t\t\t\t\tDocumentStorageServiceCompressionAdapter.blobEncoder,\n\t\t\t\t\tDocumentStorageServiceCompressionAdapter.blobDecoder,\n\t\t\t\t\tthis._config,\n\t\t\t ) as ISummaryTree);\n\t}\n}\n"]}
|
|
@@ -10,7 +10,7 @@ import { ICompressionStorageConfig } from "./compression";
|
|
|
10
10
|
* @param documentServiceFactory - The document service factory to apply compression to.
|
|
11
11
|
* @param config - The compression configuration.
|
|
12
12
|
* @returns The document service factory possibly with compression applied.
|
|
13
|
-
* @
|
|
13
|
+
* @internal
|
|
14
14
|
*/
|
|
15
15
|
export declare function applyStorageCompression(documentServiceFactory: IDocumentServiceFactory, config?: ICompressionStorageConfig | boolean): IDocumentServiceFactory;
|
|
16
16
|
/**
|
|
@@ -13,7 +13,7 @@ const compression_1 = require("./compression");
|
|
|
13
13
|
* @param documentServiceFactory - The document service factory to apply compression to.
|
|
14
14
|
* @param config - The compression configuration.
|
|
15
15
|
* @returns The document service factory possibly with compression applied.
|
|
16
|
-
* @
|
|
16
|
+
* @internal
|
|
17
17
|
*/
|
|
18
18
|
function applyStorageCompression(documentServiceFactory, config) {
|
|
19
19
|
if (config === undefined || config === false) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predefinedAdapters.js","sourceRoot":"","sources":["../../src/adapters/predefinedAdapters.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAEpD,+CAIuB;AAEvB;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CACtC,sBAA+C,EAC/C,MAA4C;IAE5C,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,KAAK,EAAE;QAC7C,OAAO,sBAAsB,CAAC;KAC9B;SAAM,IAAI,MAAM,KAAK,IAAI,EAAE;QAC3B,OAAO,+BAA+B,CACrC,sDAAwC,EACxC,sBAAsB,CACtB,CAAC;KACF;SAAM;QACN,IAAA,mBAAM,EAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAC5E,OAAO,+BAA+B,CACrC,sDAAwC,EACxC,sBAAsB,EACtB,MAAM,CACN,CAAC;KACF;AACF,CAAC;AAnBD,0DAmBC;AAED;;;;;GAKG;AACH,SAAS,+BAA+B,CACvC,WAK4B,EAC5B,sBAA+C,EAC/C,SAAoC,6CAA+B;IAEnE,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE;QACnC,OAAO,sBAAsB,CAAC;KAC9B;IACD,OAAO,IAAI,WAAW,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,MAAW;IAC9C,OAAO,CACN,MAAM,KAAK,SAAS;QACpB,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,IAAI,MAAM,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAC1E,CAAC;AACH,CAAC;AALD,kDAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDocumentServiceFactory } from \"@fluidframework/driver-definitions\";\nimport {\n\tDocumentServiceFactoryCompressionAdapter,\n\tICompressionStorageConfig,\n\tDefaultCompressionStorageConfig,\n} from \"./compression\";\n\n/**\n * This method optionally applies compression to the given document service factory. The compression\n * must be enabled by setting the config to true or by passing a compression config object.\n * @param documentServiceFactory - The document service factory to apply compression to.\n * @param config - The compression configuration.\n * @returns The document service factory possibly with compression applied.\n * @
|
|
1
|
+
{"version":3,"file":"predefinedAdapters.js","sourceRoot":"","sources":["../../src/adapters/predefinedAdapters.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAEpD,+CAIuB;AAEvB;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CACtC,sBAA+C,EAC/C,MAA4C;IAE5C,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,KAAK,EAAE;QAC7C,OAAO,sBAAsB,CAAC;KAC9B;SAAM,IAAI,MAAM,KAAK,IAAI,EAAE;QAC3B,OAAO,+BAA+B,CACrC,sDAAwC,EACxC,sBAAsB,CACtB,CAAC;KACF;SAAM;QACN,IAAA,mBAAM,EAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAC5E,OAAO,+BAA+B,CACrC,sDAAwC,EACxC,sBAAsB,EACtB,MAAM,CACN,CAAC;KACF;AACF,CAAC;AAnBD,0DAmBC;AAED;;;;;GAKG;AACH,SAAS,+BAA+B,CACvC,WAK4B,EAC5B,sBAA+C,EAC/C,SAAoC,6CAA+B;IAEnE,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE;QACnC,OAAO,sBAAsB,CAAC;KAC9B;IACD,OAAO,IAAI,WAAW,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,MAAW;IAC9C,OAAO,CACN,MAAM,KAAK,SAAS;QACpB,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,IAAI,MAAM,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAC1E,CAAC;AACH,CAAC;AALD,kDAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDocumentServiceFactory } from \"@fluidframework/driver-definitions\";\nimport {\n\tDocumentServiceFactoryCompressionAdapter,\n\tICompressionStorageConfig,\n\tDefaultCompressionStorageConfig,\n} from \"./compression\";\n\n/**\n * This method optionally applies compression to the given document service factory. The compression\n * must be enabled by setting the config to true or by passing a compression config object.\n * @param documentServiceFactory - The document service factory to apply compression to.\n * @param config - The compression configuration.\n * @returns The document service factory possibly with compression applied.\n * @internal\n */\nexport function applyStorageCompression(\n\tdocumentServiceFactory: IDocumentServiceFactory,\n\tconfig?: ICompressionStorageConfig | boolean,\n): IDocumentServiceFactory {\n\tif (config === undefined || config === false) {\n\t\treturn documentServiceFactory;\n\t} else if (config === true) {\n\t\treturn applyStorageCompressionInternal(\n\t\t\tDocumentServiceFactoryCompressionAdapter,\n\t\t\tdocumentServiceFactory,\n\t\t);\n\t} else {\n\t\tassert(isCompressionConfig(config), 0x6f4 /* Invalid compression config */);\n\t\treturn applyStorageCompressionInternal(\n\t\t\tDocumentServiceFactoryCompressionAdapter,\n\t\t\tdocumentServiceFactory,\n\t\t\tconfig,\n\t\t);\n\t}\n}\n\n/**\n * This method applies compression to the given document service factory.\n * @param documentServiceFactory - The document service factory to apply compression to.\n * @param config - The compression configuration.\n * @returns The document service factory with compression applied.\n */\nfunction applyStorageCompressionInternal(\n\tconstructor: new (\n\t\t// eslint-disable-next-line @typescript-eslint/no-shadow\n\t\tdocumentServiceFactory: IDocumentServiceFactory,\n\t\t// eslint-disable-next-line @typescript-eslint/no-shadow\n\t\tconfig: ICompressionStorageConfig,\n\t) => IDocumentServiceFactory,\n\tdocumentServiceFactory: IDocumentServiceFactory,\n\tconfig: ICompressionStorageConfig = DefaultCompressionStorageConfig,\n): IDocumentServiceFactory {\n\tif (config.algorithm === undefined) {\n\t\treturn documentServiceFactory;\n\t}\n\treturn new constructor(documentServiceFactory, config);\n}\n\n/**\n * This method checks whether given objects contains\n * a properties expected for the interface ICompressionStorageConfig.\n */\nexport function isCompressionConfig(config: any): config is ICompressionStorageConfig {\n\treturn (\n\t\tconfig !== undefined &&\n\t\t(config.algorithm !== undefined || config.minSizeToCompress !== undefined)\n\t);\n}\n"]}
|
package/dist/blob.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { FileMode, IBlob, IAttachment, ITree, TreeEntry } from "@fluidframework/protocol-definitions";
|
|
6
6
|
/**
|
|
7
7
|
* Basic implementation of a blob ITreeEntry
|
|
8
|
-
* @
|
|
8
|
+
* @internal
|
|
9
9
|
*/
|
|
10
10
|
export declare class BlobTreeEntry {
|
|
11
11
|
readonly path: string;
|
|
@@ -22,7 +22,7 @@ export declare class BlobTreeEntry {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Basic implementation of a tree ITreeEntry
|
|
25
|
-
* @
|
|
25
|
+
* @internal
|
|
26
26
|
*/
|
|
27
27
|
export declare class TreeTreeEntry {
|
|
28
28
|
readonly path: string;
|
|
@@ -38,7 +38,7 @@ export declare class TreeTreeEntry {
|
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* Basic implementation of an attachment ITreeEntry
|
|
41
|
-
* @
|
|
41
|
+
* @internal
|
|
42
42
|
*/
|
|
43
43
|
export declare class AttachmentTreeEntry {
|
|
44
44
|
readonly path: string;
|
package/dist/blob.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.AttachmentTreeEntry = exports.TreeTreeEntry = exports.BlobTreeEntry = vo
|
|
|
8
8
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
9
9
|
/**
|
|
10
10
|
* Basic implementation of a blob ITreeEntry
|
|
11
|
-
* @
|
|
11
|
+
* @internal
|
|
12
12
|
*/
|
|
13
13
|
class BlobTreeEntry {
|
|
14
14
|
/**
|
|
@@ -27,7 +27,7 @@ class BlobTreeEntry {
|
|
|
27
27
|
exports.BlobTreeEntry = BlobTreeEntry;
|
|
28
28
|
/**
|
|
29
29
|
* Basic implementation of a tree ITreeEntry
|
|
30
|
-
* @
|
|
30
|
+
* @internal
|
|
31
31
|
*/
|
|
32
32
|
class TreeTreeEntry {
|
|
33
33
|
/**
|
|
@@ -45,7 +45,7 @@ class TreeTreeEntry {
|
|
|
45
45
|
exports.TreeTreeEntry = TreeTreeEntry;
|
|
46
46
|
/**
|
|
47
47
|
* Basic implementation of an attachment ITreeEntry
|
|
48
|
-
* @
|
|
48
|
+
* @internal
|
|
49
49
|
*/
|
|
50
50
|
class AttachmentTreeEntry {
|
|
51
51
|
/**
|
package/dist/blob.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob.js","sourceRoot":"","sources":["../src/blob.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+EAM8C;AAE9C;;;GAGG;AACH,MAAa,aAAa;IAKzB;;;;;OAKG;IACH,YACiB,IAAY,EAC5B,QAAgB,EAChB,WAA+B,OAAO;QAFtB,SAAI,GAAJ,IAAI,CAAQ;QAXb,SAAI,GAAG,+BAAQ,CAAC,IAAI,CAAC;QACrB,SAAI,GAAG,gCAAS,CAAC,IAAI,CAAC;QAcrC,IAAI,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrC,CAAC;CACD;AAlBD,sCAkBC;AAED;;;GAGG;AACH,MAAa,aAAa;IAIzB;;;;OAIG;IACH,YACiB,IAAY,EACZ,KAAY;QADZ,SAAI,GAAJ,IAAI,CAAQ;QACZ,UAAK,GAAL,KAAK,CAAO;QAVb,SAAI,GAAG,+BAAQ,CAAC,SAAS,CAAC;QAC1B,SAAI,GAAG,gCAAS,CAAC,IAAI,CAAC;IAUnC,CAAC;CACJ;AAbD,sCAaC;AAED;;;GAGG;AACH,MAAa,mBAAmB;IAK/B;;;;OAIG;IACH,YACiB,IAAY,EACZ,EAAU;QADV,SAAI,GAAJ,IAAI,CAAQ;QACZ,OAAE,GAAF,EAAE,CAAQ;QAXX,SAAI,GAAG,+BAAQ,CAAC,IAAI,CAAC;QACrB,SAAI,GAAG,gCAAS,CAAC,UAAU,CAAC;QAY3C,IAAI,CAAC,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC;IACrB,CAAC;CACD;AAhBD,kDAgBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tFileMode,\n\tIBlob,\n\tIAttachment,\n\tITree,\n\tTreeEntry,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Basic implementation of a blob ITreeEntry\n * @
|
|
1
|
+
{"version":3,"file":"blob.js","sourceRoot":"","sources":["../src/blob.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+EAM8C;AAE9C;;;GAGG;AACH,MAAa,aAAa;IAKzB;;;;;OAKG;IACH,YACiB,IAAY,EAC5B,QAAgB,EAChB,WAA+B,OAAO;QAFtB,SAAI,GAAJ,IAAI,CAAQ;QAXb,SAAI,GAAG,+BAAQ,CAAC,IAAI,CAAC;QACrB,SAAI,GAAG,gCAAS,CAAC,IAAI,CAAC;QAcrC,IAAI,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrC,CAAC;CACD;AAlBD,sCAkBC;AAED;;;GAGG;AACH,MAAa,aAAa;IAIzB;;;;OAIG;IACH,YACiB,IAAY,EACZ,KAAY;QADZ,SAAI,GAAJ,IAAI,CAAQ;QACZ,UAAK,GAAL,KAAK,CAAO;QAVb,SAAI,GAAG,+BAAQ,CAAC,SAAS,CAAC;QAC1B,SAAI,GAAG,gCAAS,CAAC,IAAI,CAAC;IAUnC,CAAC;CACJ;AAbD,sCAaC;AAED;;;GAGG;AACH,MAAa,mBAAmB;IAK/B;;;;OAIG;IACH,YACiB,IAAY,EACZ,EAAU;QADV,SAAI,GAAJ,IAAI,CAAQ;QACZ,OAAE,GAAF,EAAE,CAAQ;QAXX,SAAI,GAAG,+BAAQ,CAAC,IAAI,CAAC;QACrB,SAAI,GAAG,gCAAS,CAAC,UAAU,CAAC;QAY3C,IAAI,CAAC,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC;IACrB,CAAC;CACD;AAhBD,kDAgBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tFileMode,\n\tIBlob,\n\tIAttachment,\n\tITree,\n\tTreeEntry,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Basic implementation of a blob ITreeEntry\n * @internal\n */\nexport class BlobTreeEntry {\n\tpublic readonly mode = FileMode.File;\n\tpublic readonly type = TreeEntry.Blob;\n\tpublic readonly value: IBlob;\n\n\t/**\n\t * Creates a blob ITreeEntry\n\t * @param path - path of entry\n\t * @param contents - blob contents\n\t * @param encoding - encoding of contents; defaults to utf-8\n\t */\n\tconstructor(\n\t\tpublic readonly path: string,\n\t\tcontents: string,\n\t\tencoding: \"utf-8\" | \"base64\" = \"utf-8\",\n\t) {\n\t\tthis.value = { contents, encoding };\n\t}\n}\n\n/**\n * Basic implementation of a tree ITreeEntry\n * @internal\n */\nexport class TreeTreeEntry {\n\tpublic readonly mode = FileMode.Directory;\n\tpublic readonly type = TreeEntry.Tree;\n\n\t/**\n\t * Creates a tree ITreeEntry\n\t * @param path - path of entry\n\t * @param value - subtree\n\t */\n\tconstructor(\n\t\tpublic readonly path: string,\n\t\tpublic readonly value: ITree,\n\t) {}\n}\n\n/**\n * Basic implementation of an attachment ITreeEntry\n * @internal\n */\nexport class AttachmentTreeEntry {\n\tpublic readonly mode = FileMode.File;\n\tpublic readonly type = TreeEntry.Attachment;\n\tpublic readonly value: IAttachment;\n\n\t/**\n\t * Creates an attachment ITreeEntry\n\t * @param path - path of entry\n\t * @param id - id of external blob attachment\n\t */\n\tconstructor(\n\t\tpublic readonly path: string,\n\t\tpublic readonly id: string,\n\t) {\n\t\tthis.value = { id };\n\t}\n}\n"]}
|