Skip to content

expose runtime option overrides in createDOProviderContainerRuntimeFactory #24689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions packages/framework/fluid-static/src/rootDataObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import type { IRuntimeFactory } from "@fluidframework/container-definitions/internal";
import {
FluidDataStoreRegistry,
type IContainerRuntimeOptions,
type MinimumVersionForCollab,
} from "@fluidframework/container-runtime/internal";
import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
Expand Down Expand Up @@ -192,6 +193,18 @@ export function createDOProviderContainerRuntimeFactory(props: {
* If not provided, one will be created based on the schema.
*/
rootDataStoreRegistry?: IFluidDataStoreRegistry;
/**
* Optional overrides for the container runtime options.
* If not provided, only the default options for the given compatibilityMode will be used.
*/
runtimeOptionOverrides?: Partial<IContainerRuntimeOptions>;
/**
* Optional override for minimum version for collab.
* If not provided, the default for the given compatibilityMode will be used.
* @remarks
* This is useful when runtime options are overridden and change the minimum version for collab.
*/
minVersionForCollabOverride?: MinimumVersionForCollab;
}): IRuntimeFactory {
const [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(props.schema);
const registry = props.rootDataStoreRegistry ?? new FluidDataStoreRegistry(registryEntries);
Expand All @@ -200,6 +213,10 @@ export function createDOProviderContainerRuntimeFactory(props: {
props.schema,
props.compatibilityMode,
new RootDataObjectFactory(sharedObjects, registry),
{
runtimeOptions: props.runtimeOptionOverrides,
minVersionForCollab: props.minVersionForCollabOverride,
},
);
}

Expand Down Expand Up @@ -238,6 +255,10 @@ class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
RootDataObject,
{ InitialState: RootDataObjectProps }
>,
overrides?: Partial<{
runtimeOptions: Partial<IContainerRuntimeOptions>;
minVersionForCollab: MinimumVersionForCollab;
}>,
) {
const provideEntryPoint = async (
containerRuntime: IContainerRuntime,
Expand All @@ -251,9 +272,14 @@ class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
};
super({
registryEntries: [rootDataObjectFactory.registryEntry],
runtimeOptions: compatibilityModeRuntimeOptions[compatibilityMode],
runtimeOptions: {
...compatibilityModeRuntimeOptions[compatibilityMode],
...overrides?.runtimeOptions,
},
provideEntryPoint,
minVersionForCollab: compatibilityModeToMinVersionForCollab[compatibilityMode],
minVersionForCollab:
overrides?.minVersionForCollab ??
compatibilityModeToMinVersionForCollab[compatibilityMode],
});
this.rootDataObjectFactory = rootDataObjectFactory;
this.initialObjects = schema.initialObjects;
Expand Down
Loading