@fluidframework/odsp-driver 2.0.4 → 2.0.6
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/createFile.d.ts.map +1 -1
- package/dist/createFile.js +1 -1
- package/dist/createFile.js.map +1 -1
- package/dist/createNewContainerOnExistingFile.d.ts.map +1 -1
- package/dist/createNewContainerOnExistingFile.js +2 -1
- package/dist/createNewContainerOnExistingFile.js.map +1 -1
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/epochTracker.js +3 -3
- package/dist/epochTracker.js.map +1 -1
- package/dist/odspDocumentStorageManager.d.ts +1 -0
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js +4 -3
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspUtils.d.ts +3 -2
- package/dist/odspUtils.d.ts.map +1 -1
- package/dist/odspUtils.js +7 -3
- package/dist/odspUtils.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/prefetchLatestSnapshot.d.ts.map +1 -1
- package/dist/prefetchLatestSnapshot.js +2 -2
- package/dist/prefetchLatestSnapshot.js.map +1 -1
- package/lib/createFile.d.ts.map +1 -1
- package/lib/createFile.js +3 -3
- package/lib/createFile.js.map +1 -1
- package/lib/createNewContainerOnExistingFile.d.ts.map +1 -1
- package/lib/createNewContainerOnExistingFile.js +3 -2
- package/lib/createNewContainerOnExistingFile.js.map +1 -1
- package/lib/epochTracker.d.ts.map +1 -1
- package/lib/epochTracker.js +4 -4
- package/lib/epochTracker.js.map +1 -1
- package/lib/odspDocumentStorageManager.d.ts +1 -0
- package/lib/odspDocumentStorageManager.d.ts.map +1 -1
- package/lib/odspDocumentStorageManager.js +5 -4
- package/lib/odspDocumentStorageManager.js.map +1 -1
- package/lib/odspUtils.d.ts +3 -2
- package/lib/odspUtils.d.ts.map +1 -1
- package/lib/odspUtils.js +6 -3
- package/lib/odspUtils.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/prefetchLatestSnapshot.d.ts.map +1 -1
- package/lib/prefetchLatestSnapshot.js +3 -3
- package/lib/prefetchLatestSnapshot.js.map +1 -1
- package/package.json +11 -11
- package/src/createFile.ts +9 -1
- package/src/createNewContainerOnExistingFile.ts +16 -3
- package/src/epochTracker.ts +4 -3
- package/src/odspDocumentStorageManager.ts +18 -3
- package/src/odspUtils.ts +13 -2
- package/src/packageVersion.ts +1 -1
- package/src/prefetchLatestSnapshot.ts +3 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/odsp-driver",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Socket storage implementation for SPO and ODC",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -77,15 +77,15 @@
|
|
|
77
77
|
"temp-directory": "nyc/.nyc_output"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@fluid-internal/client-utils": "~2.0.
|
|
81
|
-
"@fluidframework/core-interfaces": "~2.0.
|
|
82
|
-
"@fluidframework/core-utils": "~2.0.
|
|
83
|
-
"@fluidframework/driver-base": "~2.0.
|
|
84
|
-
"@fluidframework/driver-definitions": "~2.0.
|
|
85
|
-
"@fluidframework/driver-utils": "~2.0.
|
|
86
|
-
"@fluidframework/odsp-doclib-utils": "~2.0.
|
|
87
|
-
"@fluidframework/odsp-driver-definitions": "~2.0.
|
|
88
|
-
"@fluidframework/telemetry-utils": "~2.0.
|
|
80
|
+
"@fluid-internal/client-utils": "~2.0.6",
|
|
81
|
+
"@fluidframework/core-interfaces": "~2.0.6",
|
|
82
|
+
"@fluidframework/core-utils": "~2.0.6",
|
|
83
|
+
"@fluidframework/driver-base": "~2.0.6",
|
|
84
|
+
"@fluidframework/driver-definitions": "~2.0.6",
|
|
85
|
+
"@fluidframework/driver-utils": "~2.0.6",
|
|
86
|
+
"@fluidframework/odsp-doclib-utils": "~2.0.6",
|
|
87
|
+
"@fluidframework/odsp-driver-definitions": "~2.0.6",
|
|
88
|
+
"@fluidframework/telemetry-utils": "~2.0.6",
|
|
89
89
|
"node-fetch": "^2.6.9",
|
|
90
90
|
"socket.io-client": "^4.7.3",
|
|
91
91
|
"uuid": "^9.0.0"
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
95
95
|
"@biomejs/biome": "^1.7.3",
|
|
96
|
-
"@fluid-internal/mocha-test-setup": "~2.0.
|
|
96
|
+
"@fluid-internal/mocha-test-setup": "~2.0.6",
|
|
97
97
|
"@fluid-tools/build-cli": "^0.39.0",
|
|
98
98
|
"@fluidframework/build-common": "^2.0.3",
|
|
99
99
|
"@fluidframework/build-tools": "^0.39.0",
|
package/src/createFile.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from "@fluidframework/odsp-driver-definitions/internal";
|
|
17
17
|
import {
|
|
18
18
|
ITelemetryLoggerExt,
|
|
19
|
+
loggerToMonitoringContext,
|
|
19
20
|
PerformanceEvent,
|
|
20
21
|
} from "@fluidframework/telemetry-utils/internal";
|
|
21
22
|
|
|
@@ -36,6 +37,7 @@ import {
|
|
|
36
37
|
buildOdspShareLinkReqParams,
|
|
37
38
|
createCacheSnapshotKey,
|
|
38
39
|
getWithRetryForTokenRefresh,
|
|
40
|
+
snapshotWithLoadingGroupIdSupported,
|
|
39
41
|
} from "./odspUtils.js";
|
|
40
42
|
import { pkgVersion as driverVersion } from "./packageVersion.js";
|
|
41
43
|
import { runWithRetry } from "./retryUtils.js";
|
|
@@ -110,7 +112,13 @@ export async function createNewFluidFile(
|
|
|
110
112
|
summaryHandle,
|
|
111
113
|
);
|
|
112
114
|
// caching the converted summary
|
|
113
|
-
await epochTracker.put(
|
|
115
|
+
await epochTracker.put(
|
|
116
|
+
createCacheSnapshotKey(
|
|
117
|
+
odspResolvedUrl,
|
|
118
|
+
snapshotWithLoadingGroupIdSupported(loggerToMonitoringContext(logger).config),
|
|
119
|
+
),
|
|
120
|
+
snapshot,
|
|
121
|
+
);
|
|
114
122
|
}
|
|
115
123
|
return odspResolvedUrl;
|
|
116
124
|
}
|
|
@@ -11,7 +11,10 @@ import {
|
|
|
11
11
|
IOdspResolvedUrl,
|
|
12
12
|
InstrumentedStorageTokenFetcher,
|
|
13
13
|
} from "@fluidframework/odsp-driver-definitions/internal";
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
ITelemetryLoggerExt,
|
|
16
|
+
loggerToMonitoringContext,
|
|
17
|
+
} from "@fluidframework/telemetry-utils/internal";
|
|
15
18
|
|
|
16
19
|
import { IWriteSummaryResponse } from "./contracts.js";
|
|
17
20
|
import { ClpCompliantAppHeader } from "./contractsPublic.js";
|
|
@@ -24,7 +27,11 @@ import { createOdspUrl } from "./createOdspUrl.js";
|
|
|
24
27
|
import { EpochTracker } from "./epochTracker.js";
|
|
25
28
|
import { OdspDriverUrlResolver } from "./odspDriverUrlResolver.js";
|
|
26
29
|
import { getApiRoot } from "./odspUrlHelper.js";
|
|
27
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
IExistingFileInfo,
|
|
32
|
+
createCacheSnapshotKey,
|
|
33
|
+
snapshotWithLoadingGroupIdSupported,
|
|
34
|
+
} from "./odspUtils.js";
|
|
28
35
|
|
|
29
36
|
/**
|
|
30
37
|
* Creates a new Fluid container on an existing file.
|
|
@@ -87,7 +94,13 @@ export async function createNewContainerOnExistingFile(
|
|
|
87
94
|
summaryHandle,
|
|
88
95
|
);
|
|
89
96
|
// caching the converted summary
|
|
90
|
-
await epochTracker.put(
|
|
97
|
+
await epochTracker.put(
|
|
98
|
+
createCacheSnapshotKey(
|
|
99
|
+
odspResolvedUrl,
|
|
100
|
+
snapshotWithLoadingGroupIdSupported(loggerToMonitoringContext(logger).config),
|
|
101
|
+
),
|
|
102
|
+
snapshot,
|
|
103
|
+
);
|
|
91
104
|
}
|
|
92
105
|
|
|
93
106
|
return odspResolvedUrl;
|
package/src/epochTracker.ts
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
OdspErrorTypes,
|
|
22
22
|
maximumCacheDurationMs,
|
|
23
23
|
snapshotKey,
|
|
24
|
+
snapshotWithLoadingGroupIdKey,
|
|
24
25
|
} from "@fluidframework/odsp-driver-definitions/internal";
|
|
25
26
|
import {
|
|
26
27
|
ITelemetryLoggerExt,
|
|
@@ -146,7 +147,7 @@ export class EpochTracker implements IPersistedFileCache {
|
|
|
146
147
|
}
|
|
147
148
|
// Expire the cached snapshot if it's older than snapshotCacheExpiryTimeoutMs and immediately
|
|
148
149
|
// expire all old caches that do not have cacheEntryTime
|
|
149
|
-
if (entry.type === snapshotKey) {
|
|
150
|
+
if (entry.type === snapshotKey || entry.type === snapshotWithLoadingGroupIdKey) {
|
|
150
151
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
151
152
|
const cacheTime = value.value?.cacheEntryTime;
|
|
152
153
|
const currentTime = Date.now();
|
|
@@ -177,7 +178,7 @@ export class EpochTracker implements IPersistedFileCache {
|
|
|
177
178
|
assert(this._fluidEpoch !== undefined, 0x1dd /* "no epoch" */);
|
|
178
179
|
// For snapshots, the value should have the cacheEntryTime.
|
|
179
180
|
// This will be used to expire snapshots older than snapshotCacheExpiryTimeoutMs.
|
|
180
|
-
if (entry.type === snapshotKey) {
|
|
181
|
+
if (entry.type === snapshotKey || entry.type === snapshotWithLoadingGroupIdKey) {
|
|
181
182
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
182
183
|
value.cacheEntryTime = value.cacheEntryTime ?? Date.now();
|
|
183
184
|
}
|
|
@@ -519,7 +520,7 @@ export class EpochTrackerWithRedemption extends EpochTracker {
|
|
|
519
520
|
let result = super.get(entry);
|
|
520
521
|
|
|
521
522
|
// equivalence of what happens in fetchAndParseAsJSON()
|
|
522
|
-
if (entry.type === snapshotKey) {
|
|
523
|
+
if (entry.type === snapshotKey || entry.type === snapshotWithLoadingGroupIdKey) {
|
|
523
524
|
result = result
|
|
524
525
|
.then((value) => {
|
|
525
526
|
// If there is nothing in cache, we need to wait for network call to complete (and do redemption)
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
loggerToMonitoringContext,
|
|
33
33
|
normalizeError,
|
|
34
34
|
overwriteStack,
|
|
35
|
+
type IConfigProvider,
|
|
35
36
|
} from "@fluidframework/telemetry-utils/internal";
|
|
36
37
|
|
|
37
38
|
import {
|
|
@@ -62,6 +63,7 @@ import {
|
|
|
62
63
|
getWithRetryForTokenRefresh,
|
|
63
64
|
isInstanceOfISnapshot,
|
|
64
65
|
isSnapshotFetchForLoadingGroup,
|
|
66
|
+
snapshotWithLoadingGroupIdSupported,
|
|
65
67
|
useLegacyFlowWithoutGroupsForSnapshotFetch,
|
|
66
68
|
type TokenFetchOptionsEx,
|
|
67
69
|
} from "./odspUtils.js";
|
|
@@ -85,6 +87,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
85
87
|
private readonly snapshotUrl: string | undefined;
|
|
86
88
|
private readonly attachmentPOSTUrl: string | undefined;
|
|
87
89
|
private readonly attachmentGETUrl: string | undefined;
|
|
90
|
+
private readonly config: IConfigProvider;
|
|
88
91
|
// Driver specified limits for snapshot size and time.
|
|
89
92
|
/**
|
|
90
93
|
* NOTE: While commit cfff6e3 added restrictions to prevent large payloads, snapshot failures will continue to
|
|
@@ -115,6 +118,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
115
118
|
this.snapshotUrl = this.odspResolvedUrl.endpoints.snapshotStorageUrl;
|
|
116
119
|
this.attachmentPOSTUrl = this.odspResolvedUrl.endpoints.attachmentPOSTStorageUrl;
|
|
117
120
|
this.attachmentGETUrl = this.odspResolvedUrl.endpoints.attachmentGETStorageUrl;
|
|
121
|
+
this.config = loggerToMonitoringContext(logger).config;
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
public get isFirstSnapshotFromNetwork(): boolean | undefined {
|
|
@@ -278,7 +282,12 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
278
282
|
// Here's the logic to grab the persistent cache snapshot implemented by the host
|
|
279
283
|
// Epoch tracker is responsible for communicating with the persistent cache, handling epochs and cache versions
|
|
280
284
|
const cachedSnapshotP: Promise<ISnapshot | undefined> = this.epochTracker
|
|
281
|
-
.get(
|
|
285
|
+
.get(
|
|
286
|
+
createCacheSnapshotKey(
|
|
287
|
+
this.odspResolvedUrl,
|
|
288
|
+
snapshotWithLoadingGroupIdSupported(this.config),
|
|
289
|
+
),
|
|
290
|
+
)
|
|
282
291
|
.then(
|
|
283
292
|
async (
|
|
284
293
|
// eslint-disable-next-line import/no-deprecated
|
|
@@ -564,7 +573,10 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
564
573
|
// for initial snapshot, don't consult the prefetch cache.
|
|
565
574
|
if (!this.hostPolicy.avoidPrefetchSnapshotCache && this.firstSnapshotFetchCall) {
|
|
566
575
|
const prefetchCacheKey = getKeyForCacheEntry(
|
|
567
|
-
createCacheSnapshotKey(
|
|
576
|
+
createCacheSnapshotKey(
|
|
577
|
+
this.odspResolvedUrl,
|
|
578
|
+
snapshotWithLoadingGroupIdSupported(this.config),
|
|
579
|
+
),
|
|
568
580
|
);
|
|
569
581
|
const result = await this.cache.snapshotPrefetchResultCache
|
|
570
582
|
?.get(prefetchCacheKey)
|
|
@@ -627,7 +639,10 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
627
639
|
};
|
|
628
640
|
const putInCache = async (valueWithEpoch: IVersionedValueWithEpoch): Promise<void> => {
|
|
629
641
|
return this.cache.persistedCache.put(
|
|
630
|
-
createCacheSnapshotKey(
|
|
642
|
+
createCacheSnapshotKey(
|
|
643
|
+
this.odspResolvedUrl,
|
|
644
|
+
snapshotWithLoadingGroupIdSupported(this.config),
|
|
645
|
+
),
|
|
631
646
|
// Epoch tracker will add the epoch and version to the value here. So just send value to cache.
|
|
632
647
|
valueWithEpoch.value,
|
|
633
648
|
);
|
package/src/odspUtils.ts
CHANGED
|
@@ -38,8 +38,10 @@ import {
|
|
|
38
38
|
isTokenFromCache,
|
|
39
39
|
snapshotKey,
|
|
40
40
|
tokenFromResponse,
|
|
41
|
+
snapshotWithLoadingGroupIdKey,
|
|
41
42
|
} from "@fluidframework/odsp-driver-definitions/internal";
|
|
42
43
|
import {
|
|
44
|
+
type IConfigProvider,
|
|
43
45
|
type IFluidErrorBase,
|
|
44
46
|
ITelemetryLoggerExt,
|
|
45
47
|
PerformanceEvent,
|
|
@@ -452,9 +454,12 @@ export function toInstrumentedOdspTokenFetcher(
|
|
|
452
454
|
};
|
|
453
455
|
}
|
|
454
456
|
|
|
455
|
-
export function createCacheSnapshotKey(
|
|
457
|
+
export function createCacheSnapshotKey(
|
|
458
|
+
odspResolvedUrl: IOdspResolvedUrl,
|
|
459
|
+
snapshotWithLoadingGroupId: boolean | undefined,
|
|
460
|
+
): ICacheEntry {
|
|
456
461
|
const cacheEntry: ICacheEntry = {
|
|
457
|
-
type: snapshotKey,
|
|
462
|
+
type: snapshotWithLoadingGroupId ? snapshotWithLoadingGroupIdKey : snapshotKey,
|
|
458
463
|
key: odspResolvedUrl.fileVersion ?? "",
|
|
459
464
|
file: {
|
|
460
465
|
resolvedUrl: odspResolvedUrl,
|
|
@@ -464,6 +469,12 @@ export function createCacheSnapshotKey(odspResolvedUrl: IOdspResolvedUrl): ICach
|
|
|
464
469
|
return cacheEntry;
|
|
465
470
|
}
|
|
466
471
|
|
|
472
|
+
export function snapshotWithLoadingGroupIdSupported(
|
|
473
|
+
config: IConfigProvider,
|
|
474
|
+
): boolean | undefined {
|
|
475
|
+
return config.getBoolean("Fluid.Container.UseLoadingGroupIdForSnapshotFetch2");
|
|
476
|
+
}
|
|
477
|
+
|
|
467
478
|
// 80KB is the max body size that we can put in ump post body for server to be able to accept it.
|
|
468
479
|
// Keeping it 78KB to be a little cautious. As per the telemetry 99p is less than 78KB.
|
|
469
480
|
export const maxUmpPostBodySize = 79872;
|
package/src/packageVersion.ts
CHANGED
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
createCacheSnapshotKey,
|
|
36
36
|
createOdspLogger,
|
|
37
37
|
getOdspResolvedUrl,
|
|
38
|
+
snapshotWithLoadingGroupIdSupported,
|
|
38
39
|
toInstrumentedOdspStorageTokenFetcher,
|
|
39
40
|
type TokenFetchOptionsEx,
|
|
40
41
|
} from "./odspUtils.js";
|
|
@@ -75,9 +76,7 @@ export async function prefetchLatestSnapshot(
|
|
|
75
76
|
): Promise<boolean> {
|
|
76
77
|
const mc = createChildMonitoringContext({ logger, namespace: "PrefetchSnapshot" });
|
|
77
78
|
const odspLogger = createOdspLogger(mc.logger);
|
|
78
|
-
const useGroupIdsForSnapshotFetch = mc.config
|
|
79
|
-
"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2",
|
|
80
|
-
);
|
|
79
|
+
const useGroupIdsForSnapshotFetch = snapshotWithLoadingGroupIdSupported(mc.config);
|
|
81
80
|
// For prefetch, we just want to fetch the ungrouped data and want to use the new API if the
|
|
82
81
|
// feature gate is set, so provide an empty array.
|
|
83
82
|
const loadingGroupIds = useGroupIdsForSnapshotFetch ? [] : undefined;
|
|
@@ -112,7 +111,7 @@ export async function prefetchLatestSnapshot(
|
|
|
112
111
|
controller,
|
|
113
112
|
);
|
|
114
113
|
};
|
|
115
|
-
const snapshotKey = createCacheSnapshotKey(odspResolvedUrl);
|
|
114
|
+
const snapshotKey = createCacheSnapshotKey(odspResolvedUrl, useGroupIdsForSnapshotFetch);
|
|
116
115
|
let cacheP: Promise<void> | undefined;
|
|
117
116
|
let snapshotEpoch: string | undefined;
|
|
118
117
|
const putInCache = async (valueWithEpoch: IVersionedValueWithEpoch): Promise<void> => {
|