Skip to content

Commit

Permalink
Remove _createDataStoreWithProps (#22996)
Browse files Browse the repository at this point in the history
[AB#856](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/856)
#22993

### Description
Removes APIs that have been deprecated. We have tried to move away from
`_createDataStoreWithProps` as this causes collisions when creating live
datastores. Solutions involved aliasing. The original issue with the
removal was that there was no way to put in props. Added the
`initialState` parameter to
`PureDataObjectFactory.createInstanceWithDataStore` as pass in props.

### Remove APIs
- `IContainerRuntimeBase._createDataStoreWithProps`
- `ContainerRuntime._createDataStoreWithProps`

### Alternatives
- `PureDataObjectFactory.createInstanceWithDataStore` allows props to be
passed in via the `initialState` parameter.

### Merge Notes
- Merge only after `main` is ready for 2.20 changes.

---------

Co-authored-by: Tyler Butler <tylerbu@microsoft.com>
  • Loading branch information
tyler-cai-microsoft and tylerbutler authored Jan 8, 2025
1 parent ba65d67 commit bd243fb
Show file tree
Hide file tree
Showing 17 changed files with 92 additions and 47 deletions.
21 changes: 21 additions & 0 deletions .changeset/gold-maps-cut.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
"@fluidframework/aqueduct": minor
"@fluidframework/container-runtime": minor
"@fluidframework/container-runtime-definitions": minor
"@fluidframework/datastore": minor
"@fluidframework/runtime-definitions": minor
"@fluidframework/test-runtime-utils": minor
---

# The createDataStoreWithProps APIs on ContainerRuntime and IContainerRuntimeBase have been removed

`ContainerRuntime.createDataStoreWithProps` and `IContainerRuntimeBase.createDataStoreWithProps`
have been removed.

Replace uses of these APIs with `PureDataObjectFactory.createInstanceWithDataStore` and pass in props via the `initialState`
parameter.

# Initial deprecation/removal announcement

The initial deprecations of the now changed or removed types were announced [#1537](https://github.com/microsoft/FluidFramework/issues/1537)
in Fluid Framework v0.25 [#2931](https://github.com/microsoft/FluidFramework/pull/2931)
6 changes: 5 additions & 1 deletion packages/framework/aqueduct/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {},
"broken": {
"Interface_IDataObjectProps": {
"backCompat": false
}
},
"entrypoint": "legacy"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,5 @@ declare type old_as_current_for_Interface_IDataObjectProps = requireAssignableTo
* typeValidation.broken:
* "Interface_IDataObjectProps": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IDataObjectProps = requireAssignableTo<TypeOnly<current.IDataObjectProps>, TypeOnly<old.IDataObjectProps>>
12 changes: 11 additions & 1 deletion packages/runtime/container-runtime-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,17 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {},
"broken": {
"Interface_IContainerRuntime": {
"backCompat": false
},
"Interface_IContainerRuntimeWithResolveHandle_Deprecated": {
"backCompat": false
},
"TypeAlias_IContainerRuntimeBaseWithCombinedEvents": {
"backCompat": false
}
},
"entrypoint": "legacy"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ declare type MakeUnusedImportErrorsGoAway<T> = TypeOnly<T> | MinimalType<T> | Fu
* typeValidation.broken:
* "Interface_IContainerRuntime": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IContainerRuntime = requireAssignableTo<TypeOnly<current.IContainerRuntime>, TypeOnly<old.IContainerRuntime>>

/*
Expand Down Expand Up @@ -49,6 +50,7 @@ declare type old_as_current_for_Interface_IContainerRuntimeWithResolveHandle_Dep
* typeValidation.broken:
* "Interface_IContainerRuntimeWithResolveHandle_Deprecated": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IContainerRuntimeWithResolveHandle_Deprecated = requireAssignableTo<TypeOnly<current.IContainerRuntimeWithResolveHandle_Deprecated>, TypeOnly<old.IContainerRuntimeWithResolveHandle_Deprecated>>

/*
Expand Down Expand Up @@ -85,6 +87,7 @@ declare type current_as_old_for_Interface_ISummarizerObservabilityProps = requir
* typeValidation.broken:
* "TypeAlias_IContainerRuntimeBaseWithCombinedEvents": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_TypeAlias_IContainerRuntimeBaseWithCombinedEvents = requireAssignableTo<TypeOnly<current.IContainerRuntimeBaseWithCombinedEvents>, TypeOnly<old.IContainerRuntimeBaseWithCombinedEvents>>

/*
Expand Down
12 changes: 11 additions & 1 deletion packages/runtime/container-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,17 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {},
"broken": {
"Class_ContainerRuntime": {
"backCompat": false
},
"Class_DocumentsSchemaController": {
"forwardCompat": false
},
"ClassStatics_ContainerRuntime": {
"backCompat": false
}
},
"entrypoint": "legacy"
}
}
19 changes: 0 additions & 19 deletions packages/runtime/container-runtime/src/containerRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3431,25 +3431,6 @@ export class ContainerRuntime
);
}

/**
* @deprecated 0.16 Issue #1537, #3631
*/
public async _createDataStoreWithProps(
pkg: Readonly<string | string[]>,
props?: any,
): Promise<IDataStore> {
const context = this.channelCollection.createDataStoreContext(
Array.isArray(pkg) ? pkg : [pkg],
props,
);
return channelToDataStore(
await context.realize(),
context.id,
this.channelCollection,
this.mc.logger,
);
}

private canSendOps() {
// Note that the real (non-proxy) delta manager is needed here to get the readonly info. This is because
// container runtime's ability to send ops depend on the actual readonly state of the delta manager.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ declare type old_as_current_for_Class_ContainerRuntime = requireAssignableTo<Typ
* typeValidation.broken:
* "Class_ContainerRuntime": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Class_ContainerRuntime = requireAssignableTo<TypeOnly<current.ContainerRuntime>, TypeOnly<old.ContainerRuntime>>

/*
Expand Down Expand Up @@ -85,6 +86,7 @@ declare type current_as_old_for_Class_SummaryCollection = requireAssignableTo<Ty
* typeValidation.broken:
* "ClassStatics_ContainerRuntime": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_ClassStatics_ContainerRuntime = requireAssignableTo<TypeOnly<typeof current.ContainerRuntime>, TypeOnly<typeof old.ContainerRuntime>>

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ export interface IContainerRuntimeBase extends IEventProvider<IContainerRuntimeB
// (undocumented)
readonly clientDetails: IClientDetails;
createDataStore(pkg: Readonly<string | string[]>, loadingGroupId?: string): Promise<IDataStore>;
// @deprecated (undocumented)
_createDataStoreWithProps(pkg: Readonly<string | string[]>, props?: any, id?: string): Promise<IDataStore>;
createDetachedDataStore(pkg: Readonly<string[]>, loadingGroupId?: string): IFluidDataStoreContextDetached;
// (undocumented)
readonly disposed: boolean;
Expand Down
15 changes: 14 additions & 1 deletion packages/runtime/runtime-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,20 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {},
"broken": {
"Interface_IContainerRuntimeBase": {
"backCompat": false
},
"Interface_IFluidDataStoreContext": {
"backCompat": false
},
"Interface_IFluidDataStoreContextDetached": {
"backCompat": false
},
"Interface_IFluidParentContext": {
"backCompat": false
}
},
"entrypoint": "legacy"
}
}
9 changes: 0 additions & 9 deletions packages/runtime/runtime-definitions/src/dataStoreContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,6 @@ export interface IContainerRuntimeBase extends IEventProvider<IContainerRuntimeB
*/
submitSignal: (type: string, content: unknown, targetClientId?: string) => void;

/**
* @deprecated 0.16 Issue #1537, #3631
*/
_createDataStoreWithProps(
pkg: Readonly<string | string[]>,
props?: any,
id?: string,
): Promise<IDataStore>;

/**
* Creates a data store and returns an object that exposes a handle to the data store's entryPoint, and also serves
* as the data store's router. The data store is not bound to a container, and in such state is not persisted to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ declare type current_as_old_for_Interface_IAttachMessage = requireAssignableTo<T
* typeValidation.broken:
* "Interface_IContainerRuntimeBase": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IContainerRuntimeBase = requireAssignableTo<TypeOnly<current.IContainerRuntimeBase>, TypeOnly<old.IContainerRuntimeBase>>

/*
Expand Down Expand Up @@ -211,6 +212,7 @@ declare type old_as_current_for_Interface_IFluidDataStoreContext = requireAssign
* typeValidation.broken:
* "Interface_IFluidDataStoreContext": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IFluidDataStoreContext = requireAssignableTo<TypeOnly<current.IFluidDataStoreContext>, TypeOnly<old.IFluidDataStoreContext>>

/*
Expand All @@ -229,6 +231,7 @@ declare type old_as_current_for_Interface_IFluidDataStoreContextDetached = requi
* typeValidation.broken:
* "Interface_IFluidDataStoreContextDetached": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IFluidDataStoreContextDetached = requireAssignableTo<TypeOnly<current.IFluidDataStoreContextDetached>, TypeOnly<old.IFluidDataStoreContextDetached>>

/*
Expand Down Expand Up @@ -283,6 +286,7 @@ declare type old_as_current_for_Interface_IFluidParentContext = requireAssignabl
* typeValidation.broken:
* "Interface_IFluidParentContext": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IFluidParentContext = requireAssignableTo<TypeOnly<current.IFluidParentContext>, TypeOnly<old.IFluidParentContext>>

/*
Expand Down
9 changes: 8 additions & 1 deletion packages/runtime/test-runtime-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,14 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {},
"broken": {
"Class_MockFluidDataStoreContext": {
"backCompat": false
},
"ClassStatics_MockFluidDataStoreContext": {
"backCompat": false
}
},
"entrypoint": "legacy"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ declare type old_as_current_for_Class_MockFluidDataStoreContext = requireAssigna
* typeValidation.broken:
* "Class_MockFluidDataStoreContext": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Class_MockFluidDataStoreContext = requireAssignableTo<TypeOnly<current.MockFluidDataStoreContext>, TypeOnly<old.MockFluidDataStoreContext>>

/*
Expand Down Expand Up @@ -364,6 +365,7 @@ declare type current_as_old_for_ClassStatics_MockDeltaQueue = requireAssignableT
* typeValidation.broken:
* "ClassStatics_MockFluidDataStoreContext": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_ClassStatics_MockFluidDataStoreContext = requireAssignableTo<TypeOnly<typeof current.MockFluidDataStoreContext>, TypeOnly<typeof old.MockFluidDataStoreContext>>

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ describeCompat("Named root data stores", "FullCompat", (getTestObjectProvider) =
const runtimeOf = (dataObject: ITestFluidObject): IContainerRuntime =>
dataObject.context.containerRuntime as IContainerRuntime;

const createDataStoreWithProps = async (dataObject: ITestFluidObject, id: string) =>
runtimeOf(dataObject)._createDataStoreWithProps(packageName, {}, id);

/**
* Gets an aliased data store with the given id. Throws an error if the data store cannot be retrieved.
*/
Expand All @@ -78,14 +75,6 @@ describeCompat("Named root data stores", "FullCompat", (getTestObjectProvider) =
return dataStore;
}

describe("Legacy APIs", () => {
it("Datastore creation with legacy API returns datastore which can be aliased", async () => {
const ds = await createDataStoreWithProps(dataObject1, "1");
const aliasResult = await ds.trySetAlias("2");
assert.equal(aliasResult, "Success");
});
});

describe("Aliasing", () => {
const alias = "alias";

Expand Down
9 changes: 8 additions & 1 deletion packages/test/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,14 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {},
"broken": {
"Interface_IProvideTestFluidObject": {
"backCompat": false
},
"Interface_ITestFluidObject": {
"backCompat": false
}
},
"entrypoint": "legacy"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ declare type old_as_current_for_Interface_IProvideTestFluidObject = requireAssig
* typeValidation.broken:
* "Interface_IProvideTestFluidObject": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IProvideTestFluidObject = requireAssignableTo<TypeOnly<current.IProvideTestFluidObject>, TypeOnly<old.IProvideTestFluidObject>>

/*
Expand All @@ -103,4 +104,5 @@ declare type old_as_current_for_Interface_ITestFluidObject = requireAssignableTo
* typeValidation.broken:
* "Interface_ITestFluidObject": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_ITestFluidObject = requireAssignableTo<TypeOnly<current.ITestFluidObject>, TypeOnly<old.ITestFluidObject>>

0 comments on commit bd243fb

Please sign in to comment.