Skip to content

Commit

Permalink
Merge pull request #9786 from heliocliu/MainToNext0407
Browse files Browse the repository at this point in the history
Integrate main (up to tip) to next
  • Loading branch information
heliocliu authored Apr 8, 2022
2 parents cb4daaa + e61840a commit c9b608e
Show file tree
Hide file tree
Showing 24 changed files with 290 additions and 92 deletions.
16 changes: 16 additions & 0 deletions BREAKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ As a short term fix the return type of this method can be safely casted to an IF
- [IDirectory extends IDisposable](#IDirectory-extends-IDisposable)
- [raiseContainerWarning removed from IContainerContext](#raiseContainerWarning-removed-from-IContainerContext)
- [`IContainerRuntimeBase.setFlushMode` is deprecated](#icontainerruntimebasesetflushmode-is-deprecated)
- [connected deprecated from IContainer, IFluidContainer, and FluidContainer](#connected-deprecated-from-IContainer-IFluidContainer-and-FluidContainer)
- [setAutoReconnect and resume deprecated from IContainer and Container](#setAutoReconnect-and-resume-deprecated-from-IContainer-and-Container)
- [IContainer.connect() and IContainer.disconnect() will be made mandatory in future major release](#icontainer-connect-and-icontainer-disconnect-will-be-made-mandatory-in-future-major-release)

### 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.
Expand All @@ -149,6 +152,19 @@ IDirectory has started extending IDisposable. This means that users implementing
### `IContainerRuntimeBase.setFlushMode` is deprecated
`IContainerRuntimeBase.setFlushMode` is deprecated and will be removed in a future release. FlushMode will become an immutable property for the container runtime, optionally provided at creation time via the `IContainerRuntimeOptions` interface. See [#9480](https://github.com/microsoft/FluidFramework/issues/9480#issuecomment-1084790977)

### connected deprecated from IContainer, IFluidContainer, and FluidContainer
`connected` has been deprecated from `IContainer`, `IFluidContainer`, and `FluidContainer`. It will be removed in a future major release. Use `connectionState` property on the respective interfaces/classes instead. Please switch to the new APIs as soon as possible, and provide any feedback to the FluidFramework team if necessary.
``` diff
- if (fluidContainer.connected)
+ if (fluidContainer.connectionState === ConnectionState.Connected)
```

### setAutoReconnect and resume deprecated from IContainer and Container
`setAutoReconnect()` and `resume()` have been deprecated from `IContainer` and `Container`. They will be removed in a future major release. Use `connect()` instead of `setAutoReconnect(true)` and `resume()`, and use `disconnect()` instead of `setAutoReconnect(false)`. Note, when using these new functions you will need to ensure that the container is both attached and not closed to prevent an error being thrown. Please switch to the new APIs as soon as possible, and provide any feedback to the FluidFramework team if necessary.

### IContainer.connect() and IContainer.disconnect() will be made mandatory in future major release
In major release 1.0, the optional functions `IContainer.connect()` `IContainer.disconnect()` will be made mandatory functions.

## 0.58 Breaking changes
- [Move IntervalType from merge-tree to sequence package](#Move-IntervalType-from-merge-tree-to-sequence-package)
- [Remove logger property from IContainerContext](#Remove-logger-property-from-IContainerContext)
Expand Down
8 changes: 6 additions & 2 deletions api-report/container-loader.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,16 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
// (undocumented)
get closeSignal(): AbortSignal;
// (undocumented)
connect(): void;
// (undocumented)
get connected(): boolean;
// (undocumented)
get connectionState(): ConnectionState;
static createDetached(loader: Loader, codeDetails: IFluidCodeDetails): Promise<Container>;
// (undocumented)
get deltaManager(): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
// (undocumented)
disconnect(): void;
forceReadonly(readonly: boolean): void;
// (undocumented)
getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
Expand All @@ -96,13 +100,13 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
request(path: IRequest): Promise<IResponse>;
// (undocumented)
get resolvedUrl(): IResolvedUrl | undefined;
// (undocumented)
// @deprecated
resume(): void;
get scopes(): string[] | undefined;
// (undocumented)
serialize(): string;
get serviceConfiguration(): IClientConfiguration | undefined;
// (undocumented)
// @deprecated
setAutoReconnect(reconnect: boolean): void;
// (undocumented)
get storage(): IDocumentStorageService;
Expand Down
4 changes: 4 additions & 0 deletions api-report/fluid-static.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { AttachState } from '@fluidframework/container-definitions';
import { BaseContainerRuntimeFactory } from '@fluidframework/aqueduct';
import { ConnectionState } from '@fluidframework/container-definitions';
import { DataObject } from '@fluidframework/aqueduct';
import { IAudience } from '@fluidframework/container-definitions';
import { IChannelFactory } from '@fluidframework/datastore-definitions';
Expand Down Expand Up @@ -42,6 +43,7 @@ export class FluidContainer extends TypedEventEmitter<IFluidContainerEvents> imp
attach(): Promise<string>;
get attachState(): AttachState;
get connected(): boolean;
get connectionState(): ConnectionState;
create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;
dispose(): void;
get disposed(): boolean;
Expand All @@ -59,7 +61,9 @@ export interface IConnection {
export interface IFluidContainer extends IEventProvider<IFluidContainerEvents> {
attach(): Promise<string>;
readonly attachState: AttachState;
// @deprecated
readonly connected: boolean;
readonly connectionState: ConnectionState;
create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;
dispose(): void;
readonly disposed: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,12 @@ export interface IContainer extends IEventProvider<IContainerEvents>, IFluidRout
close(error?: ICriticalContainerError): void;
closeAndGetPendingLocalState(): string;
readonly closed: boolean;
connect?(): void;
// @deprecated
readonly connected: boolean;
readonly connectionState: ConnectionState;
deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
disconnect?(): void;
// @alpha
forceReadonly?(readonly: boolean): any;
getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
Expand All @@ -143,10 +146,10 @@ export interface IContainer extends IEventProvider<IContainerEvents>, IFluidRout
readonly readOnlyInfo: ReadOnlyInfo;
request(request: IRequest): Promise<IResponse>;
resolvedUrl: IResolvedUrl | undefined;
// @alpha
// @deprecated
resume?(): void;
serialize(): string;
// @alpha
// @deprecated
setAutoReconnect?(reconnect: boolean): void;
}

Expand Down
21 changes: 19 additions & 2 deletions common/lib/container-definitions/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,37 @@ export interface IContainer extends IEventProvider<IContainerEvents>, IFluidRout

/**
* Boolean indicating whether the container is currently connected or not
* @deprecated - 0.58, This API will be removed in 1.0
* Check `connectionState === ConnectionState.Connected` instead
* See https://github.com/microsoft/FluidFramework/issues/9167 for context
*/
readonly connected: boolean;

/**
* Attempts to connect the container to the delta stream and process ops
*/
connect?(): void;

/**
* Disconnects the container from the delta stream and stops processing ops
*/
disconnect?(): void;

/**
* Dictates whether or not the current container will automatically attempt to reconnect to the delta stream
* after receiving a disconnect event
* @param reconnect - Boolean indicating if reconnect should automatically occur
* @alpha
* @deprecated - 0.58, This API will be removed in 1.0
* Use `connect()` and `disconnect()` instead of `setAutoReconnect(true)` and `setAutoReconnect(false)` respectively
* See https://github.com/microsoft/FluidFramework/issues/9167 for context
*/
setAutoReconnect?(reconnect: boolean): void;

/**
* Have the container attempt to resume processing ops
* @alpha
* @deprecated - 0.58, This API will be removed in 1.0
* Use `connect()` instead
* See https://github.com/microsoft/FluidFramework/issues/9167 for context
*/
resume?(): void;

Expand Down
4 changes: 2 additions & 2 deletions examples/data-objects/webflow/src/document/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export class FlowDocument extends LazyLoadedDataObject<ISharedDirectory, IFlowDo

public create() {
// For 'findTile(..)', we must enable tracking of left/rightmost tiles:
Object.assign(this.runtime, { options: { ...(this.runtime.options || {}), blockUpdateMarkers: true } });
Object.assign(this.runtime, { options: { ...(this.runtime.options || {}) } });

this.sharedString = SharedString.create(this.runtime);
this.root.set(textId, this.sharedString.handle);
Expand All @@ -172,7 +172,7 @@ export class FlowDocument extends LazyLoadedDataObject<ISharedDirectory, IFlowDo

public async load() {
// For 'findTile(..)', we must enable tracking of left/rightmost tiles:
Object.assign(this.runtime, { options: { ...(this.runtime.options || {}), blockUpdateMarkers: true } });
Object.assign(this.runtime, { options: { ...(this.runtime.options || {}) } });

const handle = this.root.get<IFluidHandle<SharedString>>(textId);
if (handle === undefined) {
Expand Down
11 changes: 1 addition & 10 deletions packages/dds/merge-tree/src/mergeTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1036,10 +1036,6 @@ export class MergeTree {

private static readonly initBlockUpdateActions: BlockUpdateActions;
private static readonly theUnfinishedNode = <IMergeBlock>{ childCount: -1 };
// WARNING:
// Setting blockUpdateMarkers to false will result in eventual consistency issues
// for property updates on markers when loading from snapshots
private static readonly blockUpdateMarkers = true;

root: IMergeBlock;
private readonly blockUpdateActions: BlockUpdateActions = MergeTree.initBlockUpdateActions;
Expand All @@ -1060,12 +1056,7 @@ export class MergeTree {
}

private makeBlock(childCount: number) {
let block: MergeBlock;
if (MergeTree.blockUpdateMarkers) {
block = new HierMergeBlock(childCount);
} else {
block = new MergeBlock(childCount);
}
const block: MergeBlock = new HierMergeBlock(childCount);
block.ordinal = "";
return block;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/dds/merge-tree/src/test/beastTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ export class DocumentTree {
}

private generateClient() {
const client = new TestClient({ blockUpdateMarkers: true });
const client = new TestClient();
client.startOrUpdateCollaboration("Fred");
for (const child of this.children) {
this.addToMergeTree(client, child);
Expand Down Expand Up @@ -1730,7 +1730,7 @@ export class DocumentTree {
}

function findReplacePerf(filename: string) {
const client = new TestClient({ blockUpdateMarkers: true });
const client = new TestClient();
loadTextFromFile(filename, client.mergeTree);

const clockStart = clock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe("MergeTree.Client", () => {
const mt = random.engines.mt19937();
mt.seedWithArray([0xDEADBEEF, 0xFEEDBED, minLength]);

const clients: TestClient[] = [new TestClient({ blockUpdateMarkers: true })];
const clients: TestClient[] = [new TestClient()];
clients.forEach(
(c, i) => c.startOrUpdateCollaboration(clientNames[i]));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe("MergeTree.Client", () => {
const mt = random.engines.mt19937();
mt.seedWithArray([0xDEADBEEF, 0xFEEDBED, clientCount]);

const clients: TestClient[] = [new TestClient({ blockUpdateMarkers: true })];
const clients: TestClient[] = [new TestClient()];
clients.forEach(
(c, i) => c.startOrUpdateCollaboration(clientNames[i]));

Expand Down
2 changes: 1 addition & 1 deletion packages/dds/merge-tree/src/test/wordUnitTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function makeBookmarks(client: TestClient, bookmarkCount: number) {

function measureFetch(startFile: string, withBookmarks = false) {
const bookmarkCount = 20000;
const client = new TestClient({ blockUpdateMarkers: true });
const client = new TestClient();
loadTextFromFileWithMarkers(startFile, client.mergeTree);
if (withBookmarks) {
makeBookmarks(client, bookmarkCount);
Expand Down
Loading

0 comments on commit c9b608e

Please sign in to comment.