@fluidframework/routerlicious-driver 0.57.1 → 0.58.0-55561
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/definitions.d.ts +10 -0
- package/dist/definitions.d.ts.map +1 -0
- package/dist/definitions.js +7 -0
- package/dist/definitions.js.map +1 -0
- package/dist/documentService.d.ts +3 -2
- package/dist/documentService.d.ts.map +1 -1
- package/dist/documentService.js.map +1 -1
- package/dist/documentServiceFactory.d.ts.map +1 -1
- package/dist/documentServiceFactory.js.map +1 -1
- package/dist/documentStorageService.d.ts +2 -1
- package/dist/documentStorageService.d.ts.map +1 -1
- package/dist/documentStorageService.js.map +1 -1
- package/dist/errorUtils.d.ts +2 -2
- package/dist/errorUtils.d.ts.map +1 -1
- package/dist/errorUtils.js +11 -11
- package/dist/errorUtils.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/restWrapper.js +3 -2
- package/dist/restWrapper.js.map +1 -1
- package/dist/shreddedSummaryDocumentStorageService.d.ts +3 -2
- package/dist/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/shreddedSummaryDocumentStorageService.js +3 -3
- package/dist/shreddedSummaryDocumentStorageService.js.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.d.ts +2 -1
- package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.js +16 -13
- package/dist/wholeSummaryDocumentStorageService.js.map +1 -1
- package/lib/definitions.d.ts +10 -0
- package/lib/definitions.d.ts.map +1 -0
- package/lib/definitions.js +6 -0
- package/lib/definitions.js.map +1 -0
- package/lib/documentService.d.ts +3 -2
- package/lib/documentService.d.ts.map +1 -1
- package/lib/documentService.js.map +1 -1
- package/lib/documentServiceFactory.d.ts.map +1 -1
- package/lib/documentServiceFactory.js.map +1 -1
- package/lib/documentStorageService.d.ts +2 -1
- package/lib/documentStorageService.d.ts.map +1 -1
- package/lib/documentStorageService.js.map +1 -1
- package/lib/errorUtils.d.ts +2 -2
- package/lib/errorUtils.d.ts.map +1 -1
- package/lib/errorUtils.js +11 -11
- package/lib/errorUtils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/restWrapper.js +3 -2
- package/lib/restWrapper.js.map +1 -1
- package/lib/shreddedSummaryDocumentStorageService.d.ts +3 -2
- package/lib/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
- package/lib/shreddedSummaryDocumentStorageService.js +3 -3
- package/lib/shreddedSummaryDocumentStorageService.js.map +1 -1
- package/lib/wholeSummaryDocumentStorageService.d.ts +2 -1
- package/lib/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/lib/wholeSummaryDocumentStorageService.js +16 -13
- package/lib/wholeSummaryDocumentStorageService.js.map +1 -1
- package/package.json +9 -9
- package/src/definitions.ts +11 -0
- package/src/documentService.ts +3 -2
- package/src/documentServiceFactory.ts +3 -2
- package/src/documentStorageService.ts +3 -2
- package/src/errorUtils.ts +7 -11
- package/src/packageVersion.ts +1 -1
- package/src/restWrapper.ts +4 -4
- package/src/shreddedSummaryDocumentStorageService.ts +6 -6
- package/src/wholeSummaryDocumentStorageService.ts +20 -16
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
import { buildHierarchy } from "@fluidframework/protocol-base";
|
|
17
17
|
import {
|
|
18
18
|
ICreateBlobResponse,
|
|
19
|
-
ISnapshotTree,
|
|
20
19
|
ISnapshotTreeEx,
|
|
21
20
|
ISummaryHandle,
|
|
22
21
|
ISummaryTree,
|
|
@@ -32,6 +31,7 @@ import { PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
|
32
31
|
import { IRouterliciousDriverPolicies } from "./policies";
|
|
33
32
|
import { ICache, InMemoryCache } from "./cache";
|
|
34
33
|
import { RetriableGitManager } from "./retriableGitManager";
|
|
34
|
+
import { ISnapshotTreeVersion } from "./definitions";
|
|
35
35
|
|
|
36
36
|
const isNode = typeof window === "undefined";
|
|
37
37
|
|
|
@@ -45,7 +45,7 @@ export class ShreddedSummaryDocumentStorageService implements IDocumentStorageSe
|
|
|
45
45
|
// empty strings as values.
|
|
46
46
|
protected readonly blobsShaCache = new Map<string, string>();
|
|
47
47
|
private readonly blobCache: ICache<ArrayBufferLike> | undefined;
|
|
48
|
-
private readonly snapshotTreeCache: ICache<
|
|
48
|
+
private readonly snapshotTreeCache: ICache<ISnapshotTreeVersion> | undefined;
|
|
49
49
|
private readonly summaryUploadManager: ISummaryUploadManager;
|
|
50
50
|
|
|
51
51
|
public get repositoryUrl(): string {
|
|
@@ -59,7 +59,7 @@ export class ShreddedSummaryDocumentStorageService implements IDocumentStorageSe
|
|
|
59
59
|
public readonly policies: IDocumentStorageServicePolicies = {},
|
|
60
60
|
driverPolicies?: IRouterliciousDriverPolicies,
|
|
61
61
|
blobCache?: ICache<ArrayBufferLike>,
|
|
62
|
-
snapshotTreeCache?: ICache<
|
|
62
|
+
snapshotTreeCache?: ICache<ISnapshotTreeVersion>) {
|
|
63
63
|
this.summaryUploadManager = new SummaryTreeUploadManager(
|
|
64
64
|
new RetriableGitManager(manager, logger),
|
|
65
65
|
this.blobsShaCache,
|
|
@@ -67,7 +67,7 @@ export class ShreddedSummaryDocumentStorageService implements IDocumentStorageSe
|
|
|
67
67
|
);
|
|
68
68
|
if (driverPolicies?.enableRestLess === true || isNode) {
|
|
69
69
|
this.blobCache = blobCache ?? new InMemoryCache();
|
|
70
|
-
this.snapshotTreeCache =
|
|
70
|
+
this.snapshotTreeCache = snapshotTreeCache ?? new InMemoryCache();
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -102,7 +102,7 @@ export class ShreddedSummaryDocumentStorageService implements IDocumentStorageSe
|
|
|
102
102
|
|
|
103
103
|
const cachedSnapshotTree = await this.snapshotTreeCache?.get(requestVersion.treeId);
|
|
104
104
|
if (cachedSnapshotTree) {
|
|
105
|
-
return cachedSnapshotTree;
|
|
105
|
+
return cachedSnapshotTree.snapshotTree as ISnapshotTreeEx;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
const rawTree = await PerformanceEvent.timedExecAsync(
|
|
@@ -120,7 +120,7 @@ export class ShreddedSummaryDocumentStorageService implements IDocumentStorageSe
|
|
|
120
120
|
},
|
|
121
121
|
);
|
|
122
122
|
const tree = buildHierarchy(rawTree, this.blobsShaCache, true);
|
|
123
|
-
await this.snapshotTreeCache?.put(tree.id, tree);
|
|
123
|
+
await this.snapshotTreeCache?.put(tree.id, { id: requestVersion.id, snapshotTree: tree });
|
|
124
124
|
return tree;
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
} from "@fluidframework/server-services-client";
|
|
31
31
|
import { PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
32
32
|
import { ICache, InMemoryCache } from "./cache";
|
|
33
|
+
import { ISnapshotTreeVersion } from "./definitions";
|
|
33
34
|
|
|
34
35
|
const latestSnapshotId: string = "latest";
|
|
35
36
|
|
|
@@ -47,13 +48,13 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
|
|
|
47
48
|
protected readonly logger: ITelemetryLogger,
|
|
48
49
|
public readonly policies: IDocumentStorageServicePolicies = {},
|
|
49
50
|
private readonly blobCache: ICache<ArrayBufferLike> = new InMemoryCache(),
|
|
50
|
-
private readonly snapshotTreeCache: ICache<
|
|
51
|
+
private readonly snapshotTreeCache: ICache<ISnapshotTreeVersion> = new InMemoryCache()) {
|
|
51
52
|
this.summaryUploadManager = new WholeSummaryUploadManager(manager);
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {
|
|
55
56
|
if (versionId !== this.id && versionId !== null) {
|
|
56
|
-
// Blobs in this scenario will never have multiple versions, so return
|
|
57
|
+
// Blobs/Trees in this scenario will never have multiple versions, so return versionId as is
|
|
57
58
|
return [{
|
|
58
59
|
id: versionId,
|
|
59
60
|
treeId: undefined!,
|
|
@@ -63,9 +64,10 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
|
|
|
63
64
|
// Fetch latest summary, cache it, and return its id.
|
|
64
65
|
if (this.firstVersionsCall && count === 1) {
|
|
65
66
|
this.firstVersionsCall = false;
|
|
67
|
+
const { id, snapshotTree } = await this.fetchAndCacheSnapshotTree(latestSnapshotId);
|
|
66
68
|
return [{
|
|
67
|
-
id
|
|
68
|
-
treeId:
|
|
69
|
+
id,
|
|
70
|
+
treeId: snapshotTree.id!,
|
|
69
71
|
}];
|
|
70
72
|
}
|
|
71
73
|
|
|
@@ -83,7 +85,7 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
|
|
|
83
85
|
return commits.map((commit) => ({
|
|
84
86
|
date: commit.commit.author.date,
|
|
85
87
|
id: commit.sha,
|
|
86
|
-
treeId:
|
|
88
|
+
treeId: commit.commit.tree.sha,
|
|
87
89
|
}));
|
|
88
90
|
}
|
|
89
91
|
|
|
@@ -168,10 +170,10 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
|
|
|
168
170
|
);
|
|
169
171
|
}
|
|
170
172
|
|
|
171
|
-
private async fetchAndCacheSnapshotTree(versionId: string): Promise<
|
|
172
|
-
const
|
|
173
|
-
if (
|
|
174
|
-
return { id:
|
|
173
|
+
private async fetchAndCacheSnapshotTree(versionId: string): Promise<ISnapshotTreeVersion> {
|
|
174
|
+
const cachedSnapshotTreeVersion = await this.snapshotTreeCache.get(versionId);
|
|
175
|
+
if (cachedSnapshotTreeVersion !== undefined) {
|
|
176
|
+
return { id: cachedSnapshotTreeVersion.id, snapshotTree: cachedSnapshotTreeVersion.snapshotTree };
|
|
175
177
|
}
|
|
176
178
|
|
|
177
179
|
const wholeFlatSummary = await PerformanceEvent.timedExecAsync(
|
|
@@ -189,30 +191,32 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
|
|
|
189
191
|
},
|
|
190
192
|
);
|
|
191
193
|
const normalizedWholeSummary = convertWholeFlatSummaryToSnapshotTreeAndBlobs(wholeFlatSummary);
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
+
const wholeFlatSummaryId: string = wholeFlatSummary.id;
|
|
195
|
+
const snapshotTreeId = normalizedWholeSummary.snapshotTree.id;
|
|
196
|
+
assert(snapshotTreeId !== undefined, 0x275 /* "Root tree should contain the id" */);
|
|
197
|
+
const snapshotTreeVersion = { id: wholeFlatSummaryId , snapshotTree: normalizedWholeSummary.snapshotTree };
|
|
194
198
|
|
|
195
199
|
const cachePs: Promise<any>[] = [
|
|
196
200
|
this.snapshotTreeCache.put(
|
|
197
|
-
|
|
198
|
-
|
|
201
|
+
snapshotTreeId,
|
|
202
|
+
snapshotTreeVersion,
|
|
199
203
|
),
|
|
200
204
|
this.initBlobCache(normalizedWholeSummary.blobs),
|
|
201
205
|
];
|
|
202
|
-
if (
|
|
206
|
+
if (snapshotTreeId !== versionId) {
|
|
203
207
|
// versionId could be "latest". When summarizer checks cache for "latest", we want it to be available.
|
|
204
208
|
// TODO: For in-memory cache, <latest,snapshotTree> will be a shared pointer with <snapshotId,snapshotTree>,
|
|
205
209
|
// However, for something like Redis, this will cache the same value twice. Alternatively, could we simply
|
|
206
210
|
// cache with versionId?
|
|
207
211
|
cachePs.push(this.snapshotTreeCache.put(
|
|
208
212
|
versionId,
|
|
209
|
-
|
|
213
|
+
snapshotTreeVersion,
|
|
210
214
|
));
|
|
211
215
|
}
|
|
212
216
|
|
|
213
217
|
await Promise.all(cachePs);
|
|
214
218
|
|
|
215
|
-
return
|
|
219
|
+
return snapshotTreeVersion;
|
|
216
220
|
}
|
|
217
221
|
|
|
218
222
|
private async initBlobCache(blobs: Map<string, ArrayBuffer>): Promise<void> {
|