Skip to content
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

Revert the revert of Shared Directory changes and make them non breaking in main #9659

Merged
merged 9 commits into from
Mar 30, 2022
4 changes: 4 additions & 0 deletions BREAKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ There are a few steps you can take to write a good change note and avoid needing
# 0.58

## 0.58 Upcoming changes
- [Doing operations not allowed on deleted sub directory](#Doing-operations-not-allowed-on-deleted-sub-directory)
- [raiseContainerWarning removed from IContainerContext](#raiseContainerWarning-removed-from-IContainerContext)

### Doing operations not allowed on deleted sub directory
Users will not be allowed to do operations on a deleted directory. Users can subscribe to `disposed` event to know if a sub directory is deleted. Accessing deleted sub directory will throw `UsageError` exception now.

### raiseContainerWarning removed from IContainerContext
`raiseContainerWarning` property will be removed from `IContainerContext` interface and `ContainerContext` class. Please refer to [raiseContainerWarning property](#Remove-raisecontainerwarning-property) for more details.

Expand Down
9 changes: 8 additions & 1 deletion api-report/map.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { IChannelAttributes } from '@fluidframework/datastore-definitions';
import { IChannelFactory } from '@fluidframework/datastore-definitions';
import { IChannelServices } from '@fluidframework/datastore-definitions';
import { IChannelStorageService } from '@fluidframework/datastore-definitions';
import { IDisposable } from '@fluidframework/common-definitions';
import { IEvent } from '@fluidframework/common-definitions';
import { IEventProvider } from '@fluidframework/common-definitions';
import { IEventThisPlaceHolder } from '@fluidframework/common-definitions';
Expand Down Expand Up @@ -37,7 +38,7 @@ export class DirectoryFactory {
}

// @public
export interface IDirectory extends Map<string, any>, IEventProvider<IDirectoryEvents> {
export interface IDirectory extends Map<string, any>, IEventProvider<IDirectoryEvents>, Partial<IDisposable> {
readonly absolutePath: string;
createSubDirectory(subdirName: string): IDirectory;
deleteSubDirectory(subdirName: string): boolean;
Expand Down Expand Up @@ -65,6 +66,8 @@ export interface IDirectoryDataObject {
export interface IDirectoryEvents extends IEvent {
// (undocumented)
(event: "containedValueChanged", listener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void): any;
// (undocumented)
(event: "disposed", listener: (target: IEventThisPlaceHolder) => void): any;
}

// @public (undocumented)
Expand Down Expand Up @@ -171,6 +174,10 @@ export class SharedDirectory extends SharedObject<ISharedDirectoryEvents> implem
createSubDirectory(subdirName: string): IDirectory;
delete(key: string): boolean;
deleteSubDirectory(subdirName: string): boolean;
// (undocumented)
dispose(error?: Error): void;
jatgarg marked this conversation as resolved.
Show resolved Hide resolved
// (undocumented)
get disposed(): boolean;
entries(): IterableIterator<[string, any]>;
forEach(callback: (value: any, key: string, map: Map<string, any>) => void): void;
get<T = any>(key: string): T | undefined;
Expand Down
24 changes: 12 additions & 12 deletions lerna-package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/dds/map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ To "navigate" the subdirectory structure, `IDirectory` provides a `getWorkingDir
#### Eventing

`valueChanged` events additionally provide the absolute path to the subdirectory storing the value that changed.

`dispose` events are fired on sub directory which is deleted. Any access to this sub directory will throw an error once it is disposed.
1 change: 1 addition & 0 deletions packages/dds/map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"dependencies": {
"@fluidframework/common-definitions": "^0.20.1",
"@fluidframework/common-utils": "^0.32.1",
"@fluidframework/container-utils": "^0.58.3000",
"@fluidframework/core-interfaces": "^0.42.0",
"@fluidframework/datastore-definitions": "^0.58.3000",
"@fluidframework/driver-utils": "^0.58.3000",
Expand Down
Loading