@fluidframework/odsp-driver 2.0.0-dev-rc.5.0.0.263932 → 2.0.0-dev-rc.5.0.0.267932
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/api-report/odsp-driver.api.md +3 -3
- package/dist/ReadBufferUtils.js.map +1 -1
- package/dist/WriteBufferUtils.js +1 -1
- package/dist/WriteBufferUtils.js.map +1 -1
- package/dist/checkUrl.js.map +1 -1
- package/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/compactSnapshotParser.js +4 -4
- package/dist/compactSnapshotParser.js.map +1 -1
- package/dist/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/compactSnapshotWriter.js +2 -2
- package/dist/compactSnapshotWriter.js.map +1 -1
- package/dist/contracts.d.ts +4 -4
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/createFile.d.ts +1 -1
- package/dist/createFile.d.ts.map +1 -1
- package/dist/createFile.js.map +1 -1
- package/dist/createNewContainerOnExistingFile.d.ts +1 -1
- package/dist/createNewContainerOnExistingFile.d.ts.map +1 -1
- package/dist/createNewContainerOnExistingFile.js.map +1 -1
- package/dist/createNewUtils.d.ts +1 -1
- package/dist/createNewUtils.d.ts.map +1 -1
- package/dist/createNewUtils.js +10 -10
- package/dist/createNewUtils.js.map +1 -1
- package/dist/createOdspUrl.js.map +1 -1
- package/dist/epochTracker.js.map +1 -1
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/getFileLink.js.map +1 -1
- package/dist/getQueryString.js.map +1 -1
- package/dist/getUrlAndHeadersWithAuth.js.map +1 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts +1 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.d.ts +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +1 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +4 -4
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
- package/dist/odspCache.js.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.d.ts +1 -1
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
- package/dist/odspDeltaStorageService.d.ts +1 -1
- package/dist/odspDeltaStorageService.d.ts.map +1 -1
- package/dist/odspDeltaStorageService.js.map +1 -1
- package/dist/odspDocumentDeltaConnection.d.ts +2 -2
- package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/odspDocumentDeltaConnection.js +2 -2
- package/dist/odspDocumentDeltaConnection.js.map +1 -1
- package/dist/odspDocumentService.d.ts +1 -1
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/odspDocumentService.js.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.d.ts +1 -1
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
- package/dist/odspDocumentStorageManager.d.ts +7 -7
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspDocumentStorageServiceBase.d.ts +13 -13
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/odspDocumentStorageServiceBase.js +1 -0
- package/dist/odspDocumentStorageServiceBase.js.map +1 -1
- package/dist/odspDriverUrlResolver.js.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/dist/odspError.js.map +1 -1
- package/dist/odspFluidFileLink.js.map +1 -1
- package/dist/odspPublicUtils.d.ts +2 -1
- package/dist/odspPublicUtils.d.ts.map +1 -1
- package/dist/odspPublicUtils.js.map +1 -1
- package/dist/odspSnapshotParser.d.ts.map +1 -1
- package/dist/odspSnapshotParser.js.map +1 -1
- package/dist/odspSummaryUploadManager.d.ts +2 -2
- package/dist/odspSummaryUploadManager.d.ts.map +1 -1
- package/dist/odspSummaryUploadManager.js +5 -28
- package/dist/odspSummaryUploadManager.js.map +1 -1
- package/dist/odspUrlHelper.js.map +1 -1
- package/dist/odspUtils.js +1 -1
- package/dist/odspUtils.js.map +1 -1
- package/dist/opsCaching.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/retryErrorsStorageAdapter.d.ts +2 -2
- package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/dist/retryErrorsStorageAdapter.js.map +1 -1
- package/dist/retryUtils.js.map +1 -1
- package/dist/vroom.js.map +1 -1
- package/dist/zipItDataRepresentationUtils.d.ts +24 -24
- package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/dist/zipItDataRepresentationUtils.js.map +1 -1
- package/lib/ReadBufferUtils.js.map +1 -1
- package/lib/WriteBufferUtils.js +1 -1
- package/lib/WriteBufferUtils.js.map +1 -1
- package/lib/checkUrl.js.map +1 -1
- package/lib/compactSnapshotParser.d.ts.map +1 -1
- package/lib/compactSnapshotParser.js +4 -4
- package/lib/compactSnapshotParser.js.map +1 -1
- package/lib/compactSnapshotWriter.d.ts.map +1 -1
- package/lib/compactSnapshotWriter.js +2 -2
- package/lib/compactSnapshotWriter.js.map +1 -1
- package/lib/contracts.d.ts +4 -4
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/createFile.d.ts +1 -1
- package/lib/createFile.d.ts.map +1 -1
- package/lib/createFile.js.map +1 -1
- package/lib/createNewContainerOnExistingFile.d.ts +1 -1
- package/lib/createNewContainerOnExistingFile.d.ts.map +1 -1
- package/lib/createNewContainerOnExistingFile.js.map +1 -1
- package/lib/createNewUtils.d.ts +1 -1
- package/lib/createNewUtils.d.ts.map +1 -1
- package/lib/createNewUtils.js +1 -1
- package/lib/createNewUtils.js.map +1 -1
- package/lib/createOdspUrl.js.map +1 -1
- package/lib/epochTracker.js.map +1 -1
- package/lib/fetchSnapshot.d.ts.map +1 -1
- package/lib/fetchSnapshot.js.map +1 -1
- package/lib/getFileLink.js.map +1 -1
- package/lib/getQueryString.js.map +1 -1
- package/lib/getUrlAndHeadersWithAuth.js.map +1 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts +1 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentService.d.ts +1 -1
- package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentService.js.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts +1 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts +4 -4
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
- package/lib/odspCache.js.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.d.ts +1 -1
- package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.js.map +1 -1
- package/lib/odspDeltaStorageService.d.ts +1 -1
- package/lib/odspDeltaStorageService.d.ts.map +1 -1
- package/lib/odspDeltaStorageService.js.map +1 -1
- package/lib/odspDocumentDeltaConnection.d.ts +2 -2
- package/lib/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/lib/odspDocumentDeltaConnection.js +2 -2
- package/lib/odspDocumentDeltaConnection.js.map +1 -1
- package/lib/odspDocumentService.d.ts +1 -1
- package/lib/odspDocumentService.d.ts.map +1 -1
- package/lib/odspDocumentService.js.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.d.ts +1 -1
- package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.js.map +1 -1
- package/lib/odspDocumentStorageManager.d.ts +7 -7
- package/lib/odspDocumentStorageManager.d.ts.map +1 -1
- package/lib/odspDocumentStorageManager.js.map +1 -1
- package/lib/odspDocumentStorageServiceBase.d.ts +13 -13
- package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/lib/odspDocumentStorageServiceBase.js +1 -0
- package/lib/odspDocumentStorageServiceBase.js.map +1 -1
- package/lib/odspDriverUrlResolver.js.map +1 -1
- package/lib/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/lib/odspError.js.map +1 -1
- package/lib/odspFluidFileLink.js.map +1 -1
- package/lib/odspPublicUtils.d.ts +2 -1
- package/lib/odspPublicUtils.d.ts.map +1 -1
- package/lib/odspPublicUtils.js.map +1 -1
- package/lib/odspSnapshotParser.d.ts.map +1 -1
- package/lib/odspSnapshotParser.js.map +1 -1
- package/lib/odspSummaryUploadManager.d.ts +2 -2
- package/lib/odspSummaryUploadManager.d.ts.map +1 -1
- package/lib/odspSummaryUploadManager.js +5 -5
- package/lib/odspSummaryUploadManager.js.map +1 -1
- package/lib/odspUrlHelper.js.map +1 -1
- package/lib/odspUtils.js +1 -1
- package/lib/odspUtils.js.map +1 -1
- package/lib/opsCaching.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/retryErrorsStorageAdapter.d.ts +2 -2
- package/lib/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/lib/retryErrorsStorageAdapter.js.map +1 -1
- package/lib/retryUtils.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/vroom.js.map +1 -1
- package/lib/zipItDataRepresentationUtils.d.ts +24 -24
- package/lib/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/lib/zipItDataRepresentationUtils.js.map +1 -1
- package/package.json +16 -17
- package/src/compactSnapshotParser.ts +6 -7
- package/src/compactSnapshotWriter.ts +4 -8
- package/src/contracts.ts +4 -4
- package/src/createFile.ts +1 -1
- package/src/createNewContainerOnExistingFile.ts +1 -1
- package/src/createNewUtils.ts +7 -8
- package/src/fetchSnapshot.ts +1 -2
- package/src/localOdspDriver/localOdspDeltaStorageService.ts +1 -1
- package/src/localOdspDriver/localOdspDocumentService.ts +1 -1
- package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +1 -1
- package/src/localOdspDriver/localOdspDocumentStorageManager.ts +5 -4
- package/src/odspDelayLoadedDeltaStream.ts +6 -6
- package/src/odspDeltaStorageService.ts +1 -1
- package/src/odspDocumentDeltaConnection.ts +8 -6
- package/src/odspDocumentService.ts +1 -1
- package/src/odspDocumentServiceFactoryCore.ts +1 -1
- package/src/odspDocumentStorageManager.ts +11 -8
- package/src/odspDocumentStorageServiceBase.ts +24 -18
- package/src/odspPublicUtils.ts +2 -1
- package/src/odspSnapshotParser.ts +5 -6
- package/src/odspSummaryUploadManager.ts +9 -12
- package/src/packageVersion.ts +1 -1
- package/src/retryErrorsStorageAdapter.ts +2 -5
|
@@ -7,11 +7,15 @@ import { performance } from "@fluid-internal/client-utils";
|
|
|
7
7
|
import { LogLevel } from "@fluidframework/core-interfaces";
|
|
8
8
|
import { assert, delay } from "@fluidframework/core-utils/internal";
|
|
9
9
|
import { promiseRaceWithWinner } from "@fluidframework/driver-base/internal";
|
|
10
|
+
import { ISummaryTree } from "@fluidframework/driver-definitions";
|
|
10
11
|
import {
|
|
11
12
|
FetchSource,
|
|
12
13
|
ISnapshot,
|
|
13
14
|
ISnapshotFetchOptions,
|
|
14
15
|
ISummaryContext,
|
|
16
|
+
ICreateBlobResponse,
|
|
17
|
+
IVersion,
|
|
18
|
+
ISnapshotTree,
|
|
15
19
|
} from "@fluidframework/driver-definitions/internal";
|
|
16
20
|
import { NonRetryableError, RateLimiter } from "@fluidframework/driver-utils/internal";
|
|
17
21
|
import {
|
|
@@ -21,7 +25,6 @@ import {
|
|
|
21
25
|
OdspErrorTypes,
|
|
22
26
|
getKeyForCacheEntry,
|
|
23
27
|
} from "@fluidframework/odsp-driver-definitions/internal";
|
|
24
|
-
import * as api from "@fluidframework/protocol-definitions";
|
|
25
28
|
import {
|
|
26
29
|
ITelemetryLoggerExt,
|
|
27
30
|
PerformanceEvent,
|
|
@@ -117,7 +120,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
117
120
|
return this._isFirstSnapshotFromNetwork;
|
|
118
121
|
}
|
|
119
122
|
|
|
120
|
-
public async createBlob(file: ArrayBufferLike): Promise<
|
|
123
|
+
public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {
|
|
121
124
|
this.checkAttachmentPOSTUrl();
|
|
122
125
|
|
|
123
126
|
const response = await getWithRetryForTokenRefresh(async (options) => {
|
|
@@ -138,7 +141,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
138
141
|
},
|
|
139
142
|
async (event) => {
|
|
140
143
|
const res = await this.createBlobRateLimiter.schedule(async () =>
|
|
141
|
-
this.epochTracker.fetchAndParseAsJSON<
|
|
144
|
+
this.epochTracker.fetchAndParseAsJSON<ICreateBlobResponse>(
|
|
142
145
|
url,
|
|
143
146
|
{
|
|
144
147
|
body: file,
|
|
@@ -208,10 +211,10 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
208
211
|
}
|
|
209
212
|
|
|
210
213
|
public async getSnapshotTree(
|
|
211
|
-
version?:
|
|
214
|
+
version?: IVersion,
|
|
212
215
|
scenarioName?: string,
|
|
213
216
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
214
|
-
): Promise<
|
|
217
|
+
): Promise<ISnapshotTree | null> {
|
|
215
218
|
if (!this.snapshotUrl) {
|
|
216
219
|
// eslint-disable-next-line unicorn/no-null
|
|
217
220
|
return null;
|
|
@@ -446,7 +449,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
446
449
|
count: number,
|
|
447
450
|
scenarioName?: string,
|
|
448
451
|
fetchSource?: FetchSource,
|
|
449
|
-
): Promise<
|
|
452
|
+
): Promise<IVersion[]> {
|
|
450
453
|
// Regular load workflow uses blobId === documentID to indicate "latest".
|
|
451
454
|
if (blobid !== this.documentId && blobid) {
|
|
452
455
|
// FluidFetch & FluidDebugger tools use empty sting to query for versions
|
|
@@ -685,7 +688,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
685
688
|
}
|
|
686
689
|
|
|
687
690
|
public async uploadSummaryWithContext(
|
|
688
|
-
summary:
|
|
691
|
+
summary: ISummaryTree,
|
|
689
692
|
context: ISummaryContext,
|
|
690
693
|
): Promise<string> {
|
|
691
694
|
this.checkSnapshotUrl();
|
|
@@ -804,7 +807,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
804
807
|
protected async fetchTreeFromSnapshot(
|
|
805
808
|
id: string,
|
|
806
809
|
scenarioName?: string,
|
|
807
|
-
): Promise<
|
|
810
|
+
): Promise<ISnapshotTree | undefined> {
|
|
808
811
|
return getWithRetryForTokenRefresh(async (options) => {
|
|
809
812
|
const storageToken = await this.getStorageToken(options, "ReadCommit");
|
|
810
813
|
const snapshotDownloader = async (
|
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import {
|
|
8
|
+
ISequencedDocumentMessage,
|
|
9
|
+
ISummaryHandle,
|
|
10
|
+
ISummaryTree,
|
|
11
|
+
} from "@fluidframework/driver-definitions";
|
|
7
12
|
import {
|
|
8
13
|
FetchSource,
|
|
9
14
|
FiveDaysMs,
|
|
@@ -13,9 +18,11 @@ import {
|
|
|
13
18
|
ISnapshotFetchOptions,
|
|
14
19
|
ISummaryContext,
|
|
15
20
|
LoaderCachingPolicy,
|
|
21
|
+
ISnapshotTree,
|
|
22
|
+
ICreateBlobResponse,
|
|
23
|
+
IVersion,
|
|
16
24
|
} from "@fluidframework/driver-definitions/internal";
|
|
17
25
|
import { maximumCacheDurationMs } from "@fluidframework/odsp-driver-definitions/internal";
|
|
18
|
-
import * as api from "@fluidframework/protocol-definitions";
|
|
19
26
|
import { IConfigProvider } from "@fluidframework/telemetry-utils/internal";
|
|
20
27
|
|
|
21
28
|
class BlobCache {
|
|
@@ -139,20 +146,20 @@ export abstract class OdspDocumentStorageServiceBase implements IDocumentStorage
|
|
|
139
146
|
maximumCacheDurationMs: maximumCacheDurationMsInEffect,
|
|
140
147
|
};
|
|
141
148
|
}
|
|
142
|
-
protected readonly commitCache: Map<string,
|
|
149
|
+
protected readonly commitCache: Map<string, ISnapshotTree> = new Map();
|
|
143
150
|
|
|
144
|
-
private _ops:
|
|
151
|
+
private _ops: ISequencedDocumentMessage[] | undefined;
|
|
145
152
|
|
|
146
153
|
private _snapshotSequenceNumber: number | undefined;
|
|
147
154
|
|
|
148
155
|
protected readonly blobCache = new BlobCache();
|
|
149
156
|
|
|
150
|
-
public set ops(ops:
|
|
157
|
+
public set ops(ops: ISequencedDocumentMessage[] | undefined) {
|
|
151
158
|
assert(this._ops === undefined, 0x0a5 /* "Trying to set ops when they are already set!" */);
|
|
152
159
|
this._ops = ops;
|
|
153
160
|
}
|
|
154
161
|
|
|
155
|
-
public get ops():
|
|
162
|
+
public get ops(): ISequencedDocumentMessage[] | undefined {
|
|
156
163
|
return this._ops;
|
|
157
164
|
}
|
|
158
165
|
|
|
@@ -160,7 +167,7 @@ export abstract class OdspDocumentStorageServiceBase implements IDocumentStorage
|
|
|
160
167
|
return this._snapshotSequenceNumber;
|
|
161
168
|
}
|
|
162
169
|
|
|
163
|
-
public abstract createBlob(file: ArrayBufferLike): Promise<
|
|
170
|
+
public abstract createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
|
|
164
171
|
|
|
165
172
|
private async readBlobCore(blobId: string): Promise<ArrayBuffer> {
|
|
166
173
|
const { blobContent, evicted } = this.blobCache.getBlob(blobId);
|
|
@@ -174,10 +181,10 @@ export abstract class OdspDocumentStorageServiceBase implements IDocumentStorage
|
|
|
174
181
|
}
|
|
175
182
|
|
|
176
183
|
public async getSnapshotTree(
|
|
177
|
-
version?:
|
|
184
|
+
version?: IVersion,
|
|
178
185
|
scenarioName?: string,
|
|
179
186
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
180
|
-
): Promise<
|
|
187
|
+
): Promise<ISnapshotTree | null> {
|
|
181
188
|
let id: string;
|
|
182
189
|
if (version?.id) {
|
|
183
190
|
id = version.id;
|
|
@@ -208,18 +215,18 @@ export abstract class OdspDocumentStorageServiceBase implements IDocumentStorage
|
|
|
208
215
|
count: number,
|
|
209
216
|
scenarioName?: string,
|
|
210
217
|
fetchSource?: FetchSource,
|
|
211
|
-
): Promise<
|
|
218
|
+
): Promise<IVersion[]>;
|
|
212
219
|
|
|
213
220
|
public abstract uploadSummaryWithContext(
|
|
214
|
-
summary:
|
|
221
|
+
summary: ISummaryTree,
|
|
215
222
|
context: ISummaryContext,
|
|
216
223
|
): Promise<string>;
|
|
217
224
|
|
|
218
|
-
public async downloadSummary(commit:
|
|
225
|
+
public async downloadSummary(commit: ISummaryHandle): Promise<ISummaryTree> {
|
|
219
226
|
throw new Error("Not implemented yet");
|
|
220
227
|
}
|
|
221
228
|
|
|
222
|
-
protected setRootTree(id: string, tree:
|
|
229
|
+
protected setRootTree(id: string, tree: ISnapshotTree): void {
|
|
223
230
|
this.commitCache.set(id, tree);
|
|
224
231
|
}
|
|
225
232
|
|
|
@@ -227,7 +234,7 @@ export abstract class OdspDocumentStorageServiceBase implements IDocumentStorage
|
|
|
227
234
|
this.blobCache.addBlobs(blobs);
|
|
228
235
|
}
|
|
229
236
|
|
|
230
|
-
private async readTree(id: string, scenarioName?: string): Promise<
|
|
237
|
+
private async readTree(id: string, scenarioName?: string): Promise<ISnapshotTree | null> {
|
|
231
238
|
let tree = this.commitCache.get(id);
|
|
232
239
|
if (!tree) {
|
|
233
240
|
tree = await this.fetchTreeFromSnapshot(id, scenarioName);
|
|
@@ -240,22 +247,21 @@ export abstract class OdspDocumentStorageServiceBase implements IDocumentStorage
|
|
|
240
247
|
protected abstract fetchTreeFromSnapshot(
|
|
241
248
|
id: string,
|
|
242
249
|
scenarioName?: string,
|
|
243
|
-
): Promise<
|
|
250
|
+
): Promise<ISnapshotTree | undefined>;
|
|
244
251
|
|
|
245
|
-
protected combineProtocolAndAppSnapshotTree(
|
|
246
|
-
snapshotTree: api.ISnapshotTree,
|
|
247
|
-
): api.ISnapshotTree {
|
|
252
|
+
protected combineProtocolAndAppSnapshotTree(snapshotTree: ISnapshotTree): ISnapshotTree {
|
|
248
253
|
// When we upload the container snapshot, we upload appTree in ".app" and protocol tree in ".protocol"
|
|
249
254
|
// So when we request the snapshot we get ".app" as tree and not as commit node as in the case just above.
|
|
250
255
|
const hierarchicalAppTree = snapshotTree.trees[".app"];
|
|
251
256
|
const hierarchicalProtocolTree = snapshotTree.trees[".protocol"];
|
|
252
|
-
const summarySnapshotTree:
|
|
257
|
+
const summarySnapshotTree: ISnapshotTree = {
|
|
253
258
|
blobs: {
|
|
254
259
|
...hierarchicalAppTree.blobs,
|
|
255
260
|
},
|
|
256
261
|
trees: {
|
|
257
262
|
...hierarchicalAppTree.trees,
|
|
258
263
|
},
|
|
264
|
+
id: snapshotTree.id,
|
|
259
265
|
};
|
|
260
266
|
|
|
261
267
|
// The app tree could have a .protocol in that case we want to server protocol to override it.
|
package/src/odspPublicUtils.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { IsoBuffer, hashFile } from "@fluid-internal/client-utils";
|
|
7
|
-
import { ISequencedDocumentMessage
|
|
7
|
+
import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions";
|
|
8
|
+
import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Creates a unique and stable id for a document stored in ODSP which doesn't expose the driveId and itemId of
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { stringToBuffer } from "@fluid-internal/client-utils";
|
|
7
7
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
|
-
import { ISnapshot } from "@fluidframework/driver-definitions/internal";
|
|
9
|
-
import * as api from "@fluidframework/protocol-definitions";
|
|
8
|
+
import { ISnapshot, ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
10
9
|
|
|
11
10
|
import { IOdspSnapshot, IOdspSnapshotCommit } from "./contracts.js";
|
|
12
11
|
|
|
@@ -17,10 +16,10 @@ import { IOdspSnapshot, IOdspSnapshotCommit } from "./contracts.js";
|
|
|
17
16
|
* @param blobsShaToPathCache - Map with blobs sha as keys and values as path of the blob.
|
|
18
17
|
* @returns the hierarchical tree
|
|
19
18
|
*/
|
|
20
|
-
function buildHierarchy(flatTree: IOdspSnapshotCommit):
|
|
21
|
-
const lookup: { [path: string]:
|
|
19
|
+
function buildHierarchy(flatTree: IOdspSnapshotCommit): ISnapshotTree {
|
|
20
|
+
const lookup: { [path: string]: ISnapshotTree } = {};
|
|
22
21
|
// id is required for root tree as it will be used to determine the version we loaded from.
|
|
23
|
-
const root:
|
|
22
|
+
const root: ISnapshotTree = { id: flatTree.id, blobs: {}, trees: {} };
|
|
24
23
|
lookup[""] = root;
|
|
25
24
|
|
|
26
25
|
for (const entry of flatTree.entries) {
|
|
@@ -33,7 +32,7 @@ function buildHierarchy(flatTree: IOdspSnapshotCommit): api.ISnapshotTree {
|
|
|
33
32
|
|
|
34
33
|
// Add in either the blob or tree
|
|
35
34
|
if (entry.type === "tree") {
|
|
36
|
-
const newTree:
|
|
35
|
+
const newTree: ISnapshotTree = {
|
|
37
36
|
blobs: {},
|
|
38
37
|
trees: {},
|
|
39
38
|
unreferenced: entry.unreferenced,
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
import { Uint8ArrayToString } from "@fluid-internal/client-utils";
|
|
7
7
|
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
8
|
+
import { ISummaryTree, SummaryType, SummaryObject } from "@fluidframework/driver-definitions";
|
|
8
9
|
import { ISummaryContext } from "@fluidframework/driver-definitions/internal";
|
|
9
10
|
import { isCombinedAppAndProtocolSummary } from "@fluidframework/driver-utils/internal";
|
|
10
11
|
import { InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions/internal";
|
|
11
12
|
import { getGitType } from "@fluidframework/protocol-base";
|
|
12
|
-
import * as api from "@fluidframework/protocol-definitions";
|
|
13
13
|
import {
|
|
14
14
|
ITelemetryLoggerExt,
|
|
15
15
|
MonitoringContext,
|
|
@@ -49,10 +49,7 @@ export class OdspSummaryUploadManager {
|
|
|
49
49
|
this.mc = loggerToMonitoringContext(logger);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
public async writeSummaryTree(
|
|
53
|
-
tree: api.ISummaryTree,
|
|
54
|
-
context: ISummaryContext,
|
|
55
|
-
): Promise<string> {
|
|
52
|
+
public async writeSummaryTree(tree: ISummaryTree, context: ISummaryContext): Promise<string> {
|
|
56
53
|
// If the last proposed handle is not the proposed handle of the acked summary(could happen when the last summary get nacked),
|
|
57
54
|
// then re-initialize the caches with the previous ones else just update the previous caches with the caches from acked summary.
|
|
58
55
|
// Don't bother logging if lastSummaryProposalHandle hasn't been set before; only log on a positive mismatch.
|
|
@@ -82,7 +79,7 @@ export class OdspSummaryUploadManager {
|
|
|
82
79
|
private async writeSummaryTreeCore(
|
|
83
80
|
parentHandle: string | undefined,
|
|
84
81
|
referenceSequenceNumber: number,
|
|
85
|
-
tree:
|
|
82
|
+
tree: ISummaryTree,
|
|
86
83
|
): Promise<IWriteSummaryResponse> {
|
|
87
84
|
const containsProtocolTree = isCombinedAppAndProtocolSummary(tree);
|
|
88
85
|
const { snapshotTree, blobs } = await this.convertSummaryToSnapshotTree(
|
|
@@ -161,7 +158,7 @@ export class OdspSummaryUploadManager {
|
|
|
161
158
|
*/
|
|
162
159
|
private async convertSummaryToSnapshotTree(
|
|
163
160
|
parentHandle: string | undefined,
|
|
164
|
-
tree:
|
|
161
|
+
tree: ISummaryTree,
|
|
165
162
|
rootNodeName: string,
|
|
166
163
|
markUnreferencedNodes: boolean = this.mc.config.getBoolean(
|
|
167
164
|
"Fluid.Driver.Odsp.MarkUnreferencedNodes",
|
|
@@ -189,7 +186,7 @@ export class OdspSummaryUploadManager {
|
|
|
189
186
|
let unreferenced: true | undefined;
|
|
190
187
|
let groupId: string | undefined;
|
|
191
188
|
switch (summaryObject.type) {
|
|
192
|
-
case
|
|
189
|
+
case SummaryType.Tree: {
|
|
193
190
|
const result = await this.convertSummaryToSnapshotTree(
|
|
194
191
|
parentHandle,
|
|
195
192
|
summaryObject,
|
|
@@ -201,7 +198,7 @@ export class OdspSummaryUploadManager {
|
|
|
201
198
|
blobs += result.blobs;
|
|
202
199
|
break;
|
|
203
200
|
}
|
|
204
|
-
case
|
|
201
|
+
case SummaryType.Blob: {
|
|
205
202
|
value =
|
|
206
203
|
typeof summaryObject.content === "string"
|
|
207
204
|
? {
|
|
@@ -217,7 +214,7 @@ export class OdspSummaryUploadManager {
|
|
|
217
214
|
blobs++;
|
|
218
215
|
break;
|
|
219
216
|
}
|
|
220
|
-
case
|
|
217
|
+
case SummaryType.Handle: {
|
|
221
218
|
if (!parentHandle) {
|
|
222
219
|
throw new Error("Parent summary does not exist to reference by handle.");
|
|
223
220
|
}
|
|
@@ -229,14 +226,14 @@ export class OdspSummaryUploadManager {
|
|
|
229
226
|
id = `${parentHandle}/${pathKey}`;
|
|
230
227
|
break;
|
|
231
228
|
}
|
|
232
|
-
case
|
|
229
|
+
case SummaryType.Attachment: {
|
|
233
230
|
id = summaryObject.id;
|
|
234
231
|
break;
|
|
235
232
|
}
|
|
236
233
|
default: {
|
|
237
234
|
unreachableCase(
|
|
238
235
|
summaryObject,
|
|
239
|
-
`Unknown type: ${(summaryObject as
|
|
236
|
+
`Unknown type: ${(summaryObject as SummaryObject).type}`,
|
|
240
237
|
);
|
|
241
238
|
}
|
|
242
239
|
}
|
package/src/packageVersion.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { IDisposable } from "@fluidframework/core-interfaces";
|
|
7
|
+
import { ISummaryHandle, ISummaryTree } from "@fluidframework/driver-definitions";
|
|
7
8
|
import {
|
|
8
9
|
FetchSource,
|
|
9
10
|
IDocumentStorageService,
|
|
@@ -11,14 +12,10 @@ import {
|
|
|
11
12
|
ISnapshot,
|
|
12
13
|
ISnapshotFetchOptions,
|
|
13
14
|
ISummaryContext,
|
|
14
|
-
} from "@fluidframework/driver-definitions/internal";
|
|
15
|
-
import {
|
|
16
15
|
ICreateBlobResponse,
|
|
17
16
|
ISnapshotTree,
|
|
18
|
-
ISummaryHandle,
|
|
19
|
-
ISummaryTree,
|
|
20
17
|
IVersion,
|
|
21
|
-
} from "@fluidframework/
|
|
18
|
+
} from "@fluidframework/driver-definitions/internal";
|
|
22
19
|
import {
|
|
23
20
|
ITelemetryLoggerExt,
|
|
24
21
|
LoggingError,
|