-
Notifications
You must be signed in to change notification settings - Fork 578
Expand file tree
/
Copy pathdataStoreLayerCompatState.ts
More file actions
86 lines (80 loc) · 2.35 KB
/
Copy pathdataStoreLayerCompatState.ts
File metadata and controls
86 lines (80 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
import {
generation,
LayerCompatibilityPolicyWindowMonths,
type ILayerCompatDetails,
type ILayerCompatSupportRequirements,
} from "@fluid-internal/client-utils";
import {
validateLayerCompatibility,
type MonitoringContext,
} from "@fluidframework/telemetry-utils/internal";
import { pkgVersion } from "./packageVersion.js";
/**
* The core compatibility details of the DataStore layer that is the same across all layer boundaries.
* @internal
*/
export const dataStoreCoreCompatDetails = {
/**
* The package version of the DataStore layer.
*/
pkgVersion,
/**
* The current generation of the DataStore layer.
*/
generation,
} as const;
/**
* DataStore's compatibility details that is exposed to the Runtime layer.
* @internal
*/
export const dataStoreCompatDetailsForRuntime: ILayerCompatDetails = {
...dataStoreCoreCompatDetails,
/**
* The features supported by the DataStore layer across the DataStore / Runtime boundary.
*/
supportedFeatures: new Set<string>(),
};
/**
* The requirements that the Runtime layer must meet to be compatible with this DataStore.
* @internal
*/
export const runtimeSupportRequirementsForDataStore: ILayerCompatSupportRequirements = {
/**
* Minimum generation that Runtime must be at to be compatible with this DataStore. This is calculated
* based on the LayerCompatibilityPolicyWindowMonths.DataStoreRuntime value which defines how many months old can
* the Runtime layer be compared to the DataStore layer for them to still be considered compatible.
* The minimum valid generation value is 0.
*/
minSupportedGeneration: Math.max(
0,
dataStoreCoreCompatDetails.generation -
LayerCompatibilityPolicyWindowMonths.DataStoreRuntime,
),
/**
* The features that the Runtime must support to be compatible with DataStore.
*/
requiredFeatures: [],
};
/**
* Validates that the Runtime layer is compatible with this DataStore.
* @internal
*/
export function validateRuntimeCompatibility(
maybeRuntimeCompatDetails: ILayerCompatDetails | undefined,
disposeFn: () => void,
mc: MonitoringContext,
): void {
validateLayerCompatibility(
"dataStore",
"runtime",
dataStoreCompatDetailsForRuntime,
runtimeSupportRequirementsForDataStore,
maybeRuntimeCompatDetails,
disposeFn,
mc,
);
}