Skip to content

Commit fe54c53

Browse files
agarwal-navinanthony-murphy-agent
authored andcommitted
getSnapshotTree is required on IChannelStorageService (microsoft#25707)
## Description The property `getSnapshotTree` is now required on `IChannelStorageService`. ## Breaking Changes This is a breaking change. This API was added and the upcoming break was announced in release 2.51.0 [here](https://github.com/microsoft/FluidFramework/releases/tag/client_v2.51.0#user-content-new-getsnapshottree-api-on-ichannelstorageservice-24970).
1 parent 9212b86 commit fe54c53

File tree

7 files changed

+23
-5
lines changed

7 files changed

+23
-5
lines changed

.changeset/heavy-mails-pay.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@fluidframework/datastore-definitions": minor
3+
"@fluidframework/test-runtime-utils": minor
4+
"__section": breaking
5+
---
6+
getSnapshotTree is now required in IChannelStorageService
7+
8+
The `getSnapshotTree` property was added as optional to `IChannelStorageService` in version 2.51.0. It is now a required property.
9+
See this [github issue](https://github.com/microsoft/FluidFramework/issues/25178) for more details.

packages/dds/tree/src/shared-tree-core/sharedTreeCore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ function scopeStorageService(
719719
return service.list(`${scope}${path}`);
720720
},
721721
getSnapshotTree(): ISnapshotTree | undefined {
722-
const snapshotTree = service.getSnapshotTree?.();
722+
const snapshotTree = service.getSnapshotTree();
723723
if (snapshotTree === undefined) {
724724
return undefined;
725725
}

packages/runtime/datastore-definitions/api-report/datastore-definitions.legacy.beta.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export interface IChannelServices {
4242
// @beta @legacy
4343
export interface IChannelStorageService {
4444
contains(path: string): Promise<boolean>;
45-
getSnapshotTree?(): ISnapshotTree | undefined;
45+
getSnapshotTree(): ISnapshotTree | undefined;
4646
list(path: string): Promise<string[]>;
4747
readBlob(path: string): Promise<ArrayBufferLike>;
4848
}

packages/runtime/datastore-definitions/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@
101101
"typescript": "~5.4.5"
102102
},
103103
"typeValidation": {
104-
"broken": {},
104+
"broken": {
105+
"Interface_IChannelServices": {
106+
"forwardCompat": false
107+
},
108+
"Interface_IChannelStorageService": {
109+
"forwardCompat": false
110+
}
111+
},
105112
"entrypoint": "legacy"
106113
}
107114
}

packages/runtime/datastore-definitions/src/channel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ export interface IChannelStorageService {
250250
* Returns the snapshot tree for the channel. This will help channels examine their snapshot when it consists
251251
* of dynamic trees and blobs, i.e., the number of tree and blobs and / or their keys are not known in advance.
252252
*/
253-
getSnapshotTree?(): ISnapshotTree | undefined;
253+
getSnapshotTree(): ISnapshotTree | undefined;
254254
}
255255

256256
/**

packages/runtime/datastore-definitions/src/test/types/validateDatastoreDefinitionsPrevious.generated.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ declare type current_as_old_for_Interface_IChannelFactory = requireAssignableTo<
7676
* typeValidation.broken:
7777
* "Interface_IChannelServices": {"forwardCompat": false}
7878
*/
79+
// @ts-expect-error compatibility expected to be broken
7980
declare type old_as_current_for_Interface_IChannelServices = requireAssignableTo<TypeOnly<old.IChannelServices>, TypeOnly<current.IChannelServices>>
8081

8182
/*
@@ -94,6 +95,7 @@ declare type current_as_old_for_Interface_IChannelServices = requireAssignableTo
9495
* typeValidation.broken:
9596
* "Interface_IChannelStorageService": {"forwardCompat": false}
9697
*/
98+
// @ts-expect-error compatibility expected to be broken
9799
declare type old_as_current_for_Interface_IChannelStorageService = requireAssignableTo<TypeOnly<old.IChannelStorageService>, TypeOnly<current.IChannelStorageService>>
98100

99101
/*

packages/runtime/runtime-utils/src/objectstoragepartition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ export class ObjectStoragePartition implements IChannelStorageService {
3333
}
3434

3535
public getSnapshotTree(): ISnapshotTree | undefined {
36-
return this.storage.getSnapshotTree?.();
36+
return this.storage.getSnapshotTree();
3737
}
3838
}

0 commit comments

Comments
 (0)