From 38e9856f1616989d7deee4826fc448a0ffc159d0 Mon Sep 17 00:00:00 2001 From: Curtis Man Date: Wed, 5 Feb 2020 16:13:24 -0800 Subject: [PATCH 1/2] Remove back-compat support in ScheduleManager --- BREAKING.md | 6 ++++++ .../runtime/container-runtime/src/containerRuntime.ts | 10 +--------- .../src/test/containerRuntime.spec.ts | 1 - 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/BREAKING.md b/BREAKING.md index bd057d15e960..b2e2c7519eca 100644 --- a/BREAKING.md +++ b/BREAKING.md @@ -1,6 +1,7 @@ # 0.14 Breaking Changes - [Samples and chaincode have been renamed to examples and components respectively](##Samples-and-chaincode-have-been-renamed-to-examples-and-components-respectively) - [Top-level `type` on `IClient` removed](#Top-level-type-on-IClient-removed) +- [Remove back-compat support for loader <= 0.8](#remove-back-compat-support-for-loader-0.8) ## Samples and chaincode have been renamed to examples and components respectively The directories themselves have been renamed. @@ -10,6 +11,11 @@ All path references in the dockerfile and json manifests have been updated along The `type` field on `IClient` has been removed. +## Remove back-compat support for loader <= 0.8 + +Back-compat support code in ScheduleManager is removed for loader <= 0.8, which doesn't support group ops. +Any component based on runtime >= 0.14 will no longer with with loader <= 0.8 + # 0.13 Breaking Changes - [Fluid Packages Require Consumers on TypeScript `>=3.6`](##Fluid-Packages-Require-Consumers-on-TypeScript->=3.6) diff --git a/packages/runtime/container-runtime/src/containerRuntime.ts b/packages/runtime/container-runtime/src/containerRuntime.ts index d2a6f10f862a..2ca76b00ba32 100644 --- a/packages/runtime/container-runtime/src/containerRuntime.ts +++ b/packages/runtime/container-runtime/src/containerRuntime.ts @@ -148,7 +148,6 @@ interface IRuntimeMessageMetadata { } export class ScheduleManager { - private readonly messageScheduler: IMessageScheduler | undefined; private readonly deltaManager: IDeltaManager; private readonly deltaScheduler: DeltaScheduler; private pauseSequenceNumber: number | undefined; @@ -159,16 +158,10 @@ export class ScheduleManager { private batchClientId: string; constructor( - messageScheduler: IMessageScheduler | undefined, + private readonly messageScheduler: IMessageScheduler, private readonly emitter: EventEmitter, - legacyDeltaManager: IDeltaManager, private readonly logger: ITelemetryLogger, ) { - if (!messageScheduler || !("toArray" in messageScheduler.deltaManager.inbound as any)) { - this.deltaManager = legacyDeltaManager; - return; - } - this.messageScheduler = messageScheduler; this.deltaManager = this.messageScheduler.deltaManager; this.deltaScheduler = new DeltaScheduler( @@ -590,7 +583,6 @@ export class ContainerRuntime extends EventEmitter implements IHostRuntime, IRun this.scheduleManager = new ScheduleManager( context.IMessageScheduler, this, - context.deltaManager, ChildLogger.create(this.logger, "ScheduleManager"), ); diff --git a/packages/runtime/container-runtime/src/test/containerRuntime.spec.ts b/packages/runtime/container-runtime/src/test/containerRuntime.spec.ts index 32249007aa16..e2e6ee185056 100644 --- a/packages/runtime/container-runtime/src/test/containerRuntime.spec.ts +++ b/packages/runtime/container-runtime/src/test/containerRuntime.spec.ts @@ -126,7 +126,6 @@ describe("Runtime", () => { scheduleManager = new ScheduleManager( messageScheduler, emitter, - deltaManager, DebugLogger.create("fluid:testScheduleManager"), ); From 866463ec6e807247a1222f6985765fc9790a5183 Mon Sep 17 00:00:00 2001 From: Curtis Man Date: Wed, 5 Feb 2020 19:39:17 -0800 Subject: [PATCH 2/2] Remove more checks and PR feedback --- BREAKING.md | 2 +- .../container-runtime/src/containerRuntime.ts | 17 +++-------------- .../src/test/containerRuntime.spec.ts | 8 +++----- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/BREAKING.md b/BREAKING.md index b2e2c7519eca..d33bcb3fc763 100644 --- a/BREAKING.md +++ b/BREAKING.md @@ -14,7 +14,7 @@ The `type` field on `IClient` has been removed. ## Remove back-compat support for loader <= 0.8 Back-compat support code in ScheduleManager is removed for loader <= 0.8, which doesn't support group ops. -Any component based on runtime >= 0.14 will no longer with with loader <= 0.8 +Any component based on runtime >= 0.14 will no longer work with loader <= 0.8 # 0.13 Breaking Changes diff --git a/packages/runtime/container-runtime/src/containerRuntime.ts b/packages/runtime/container-runtime/src/containerRuntime.ts index 2ca76b00ba32..ca7e9f6918e9 100644 --- a/packages/runtime/container-runtime/src/containerRuntime.ts +++ b/packages/runtime/container-runtime/src/containerRuntime.ts @@ -22,7 +22,6 @@ import { IDeltaManager, IDeltaSender, ILoader, - IMessageScheduler, IRuntime, } from "@microsoft/fluid-container-definitions"; import { @@ -148,7 +147,6 @@ interface IRuntimeMessageMetadata { } export class ScheduleManager { - private readonly deltaManager: IDeltaManager; private readonly deltaScheduler: DeltaScheduler; private pauseSequenceNumber: number | undefined; private pauseClientId: string | undefined; @@ -158,12 +156,10 @@ export class ScheduleManager { private batchClientId: string; constructor( - private readonly messageScheduler: IMessageScheduler, + private readonly deltaManager: IDeltaManager, private readonly emitter: EventEmitter, private readonly logger: ITelemetryLogger, ) { - this.messageScheduler = messageScheduler; - this.deltaManager = this.messageScheduler.deltaManager; this.deltaScheduler = new DeltaScheduler( this.deltaManager, ChildLogger.create(this.logger, "DeltaScheduler"), @@ -210,13 +206,6 @@ export class ScheduleManager { } public beginOperation(message: ISequencedDocumentMessage) { - // If in legacy mode every operation is a batch - if (!this.messageScheduler) { - this.emitter.emit("batchBegin", message); - this.deltaScheduler.batchBegin(); - return; - } - if (this.batchClientId !== message.clientId) { // As a back stop for any bugs marking the end of a batch - if the client ID flipped, we // consider the previous batch over. @@ -245,7 +234,7 @@ export class ScheduleManager { } public endOperation(error: any | undefined, message: ISequencedDocumentMessage) { - if (!this.messageScheduler || error) { + if (error) { this.batchClientId = undefined; this.emitter.emit("batchEnd", error, message); this.deltaScheduler.batchEnd(); @@ -581,7 +570,7 @@ export class ContainerRuntime extends EventEmitter implements IHostRuntime, IRun this.logger = context.logger; this.scheduleManager = new ScheduleManager( - context.IMessageScheduler, + context.IMessageScheduler.deltaManager, this, ChildLogger.create(this.logger, "ScheduleManager"), ); diff --git a/packages/runtime/container-runtime/src/test/containerRuntime.spec.ts b/packages/runtime/container-runtime/src/test/containerRuntime.spec.ts index e2e6ee185056..c0f8eadaa87d 100644 --- a/packages/runtime/container-runtime/src/test/containerRuntime.spec.ts +++ b/packages/runtime/container-runtime/src/test/containerRuntime.spec.ts @@ -18,8 +18,8 @@ import { ISequencedDocumentMessage, MessageType, } from "@microsoft/fluid-protocol-definitions"; -import { IDeltaManager, IMessageScheduler } from "@microsoft/fluid-container-definitions"; -import { MockDeltaManager, MockMessageScheduler } from "@microsoft/fluid-test-runtime-utils"; +import { IDeltaManager } from "@microsoft/fluid-container-definitions"; +import { MockDeltaManager } from "@microsoft/fluid-test-runtime-utils"; import { IConvertedSummaryResults, SummaryTreeConverter } from "../summaryTreeConverter"; import { ScheduleManager } from "../containerRuntime"; @@ -116,15 +116,13 @@ describe("Runtime", () => { let batchEnd: number = 0; let emitter: EventEmitter; let deltaManager: IDeltaManager; - let messageScheduler: IMessageScheduler; let scheduleManager: ScheduleManager; beforeEach(() => { emitter = new EventEmitter(); deltaManager = new MockDeltaManager(); - messageScheduler = new MockMessageScheduler(deltaManager); scheduleManager = new ScheduleManager( - messageScheduler, + deltaManager, emitter, DebugLogger.create("fluid:testScheduleManager"), );