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

(Op bunching) Removed deprecated process function #23664

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .changeset/three-sheep-stick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
"@fluidframework/container-runtime": minor
"@fluidframework/datastore": minor
"@fluidframework/datastore-definitions": minor
"@fluidframework/runtime-definitions": minor
"@fluidframework/test-runtime-utils": minor
---
---
"section": legacy
---

The functions `process` and `processDocumentSchemaOp` have been removed.

`process` has been replaced by `processMessages` from the following:
- `DocumentsSchemaController`
- `FluidDataStoreRuntime`
- `IDeltaHandler`
- `IFluidDataStoreChannel`
- `MockFluidDataStoreRuntime`
- `MockDeltaConnection`

`processDocumentSchemaOp` has been replaced by `processDocumentSchemaMessages` from `DocumentsSchemaController`.

See the [deprecation release note](https://github.com/microsoft/FluidFramework/releases/tag/client_v2.5.0#user-content-the-process-function-on-ifluiddatastorechannel-ideltahandler-mockfluiddatastoreruntime-and-mockdeltaconnection-is-now-deprecated-22840) for more details.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { assert } from '@fluidframework/core-utils/internal';
import { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';
import { MessageType, type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';
import type { IRuntimeMessageCollection } from '@fluidframework/runtime-definitions/internal';
import type { IRuntimeMessageCollection, IRuntimeMessagesContent } from '@fluidframework/runtime-definitions/internal';

import { type IOpContents, type IShimDeltaHandler } from './types.js';
import { attributesMatch, isBarrierOp, isStampedOp } from './utils.js';
Expand Down Expand Up @@ -81,7 +81,7 @@ export class MigrationShimDeltaHandler implements IShimDeltaHandler {
assert(this.isUsingNewV2(), 0x7e5 /* Should be using new handler after swap */);
}

public process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {
private process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {
// This allows us to process the migrate op and prevent the shared object from processing the wrong ops
assert(!this.isPreAttachState(), 0x82c /* Can't process ops before attaching tree handler */);
if (message.type !== MessageType.Operation) {
Expand All @@ -97,8 +97,15 @@ export class MigrationShimDeltaHandler implements IShimDeltaHandler {
if (this.shouldDropOp(contents)) {
return;
}
const messagesContent: IRuntimeMessagesContent[] = [
{
contents,
localOpMetadata,
clientSequenceNumber: message.clientSequenceNumber,
},
];
// Another thought, flatten the IShimDeltaHandler and the MigrationShim into one class
return this.treeDeltaHandler.process(message, local, localOpMetadata);
return this.treeDeltaHandler.processMessages({ envelope: message, messagesContent, local });
}

public processMessages(messagesCollection: IRuntimeMessageCollection): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { assert } from '@fluidframework/core-utils/internal';
import { type IChannelAttributes, type IDeltaHandler } from '@fluidframework/datastore-definitions/internal';
import { MessageType, type ISequencedDocumentMessage } from '@fluidframework/driver-definitions/internal';
import type { IRuntimeMessageCollection } from '@fluidframework/runtime-definitions/internal';
import type { IRuntimeMessageCollection, IRuntimeMessagesContent } from '@fluidframework/runtime-definitions/internal';

import { type IOpContents, type IShimDeltaHandler } from './types.js';
import { attributesMatch, isStampedOp } from './utils.js';
Expand Down Expand Up @@ -48,7 +48,7 @@ export class SharedTreeShimDeltaHandler implements IShimDeltaHandler {
return this._handler !== undefined;
}

public process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {
private process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {
// This allows us to process the migrate op and prevent the shared object from processing the wrong ops
// Drop v1 ops
assert(this.hasTreeDeltaHandler(), 0x831 /* Can't process ops before attaching tree handler */);
Expand All @@ -60,7 +60,14 @@ export class SharedTreeShimDeltaHandler implements IShimDeltaHandler {
if (this.shouldDropOp(contents)) {
return;
}
return this.handler.process(message, local, localOpMetadata);
const messagesContent: IRuntimeMessagesContent[] = [
{
contents,
localOpMetadata,
clientSequenceNumber: message.clientSequenceNumber,
},
];
return this.handler.processMessages({ envelope: message, messagesContent, local });
}

public processMessages(messagesCollection: IRuntimeMessageCollection): void {
Expand Down
11 changes: 0 additions & 11 deletions packages/dds/shared-object-base/src/sharedObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,17 +492,6 @@ export abstract class SharedObjectCore<
);
// attachDeltaHandler is only called after services is assigned
this.services.deltaConnection.attach({
process: (
message: ISequencedDocumentMessage,
local: boolean,
localOpMetadata: unknown,
) => {
this.process(
{ ...message, contents: parseHandles(message.contents, this.serializer) },
local,
localOpMetadata,
);
},
processMessages: (messagesCollection: IRuntimeMessageCollection) => {
this.processMessages(messagesCollection);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
VisibilityState,
type ISummaryTreeWithStats,
type ITelemetryContext,
type IRuntimeMessageCollection,
} from "@fluidframework/runtime-definitions/internal";
import {
ITelemetryLoggerExt,
Expand Down Expand Up @@ -135,13 +136,9 @@ export class RuntimeAttributorDataStoreChannel
}

/**
* {@inheritdoc IFluidDataStoreChannel.process}
* {@inheritdoc IFluidDataStoreChannel.processMessages}
*/
public process(
message: ISequencedDocumentMessage,
local: boolean,
localOpMetadata: unknown,
): void {
public processMessages(messageCollection: IRuntimeMessageCollection): void {
throw new Error("Attributor should not receive messages yet");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ export class DocumentsSchemaController {
// (undocumented)
onDisconnect(): void;
processDocumentSchemaMessages(contents: IDocumentSchemaChangeMessage[], local: boolean, sequenceNumber: number): boolean;
// @deprecated
processDocumentSchemaOp(content: IDocumentSchemaChangeMessage, local: boolean, sequenceNumber: number): boolean;
// (undocumented)
sessionSchema: IDocumentSchemaCurrent;
// (undocumented)
Expand Down
9 changes: 8 additions & 1 deletion packages/runtime/container-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,14 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {},
"broken": {
"Class_DocumentsSchemaController": {
"backCompat": false
},
"ClassStatics_DocumentsSchemaController": {
"backCompat": false
}
},
"entrypoint": "legacy"
}
}
23 changes: 0 additions & 23 deletions packages/runtime/container-runtime/src/channelCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -859,29 +859,6 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
}
}

/**
* This is still here for back-compat purposes because channel collection implements
* IFluidDataStoreChannel. Once it is removed from the interface, this method can be removed.
* Container runtime calls `processMessages` instead.
*/
public process(
message: ISequencedDocumentMessage,
local: boolean,
localOpMetadata: unknown,
): void {
this.processMessages({
envelope: message,
messagesContent: [
{
contents: message.contents,
localOpMetadata,
clientSequenceNumber: message.clientSequenceNumber,
},
],
local,
});
}

/**
* Process channel messages. The messages here are contiguous channel type messages in a batch. Bunch
* of contiguous messages for a data store should be sent to it together.
Expand Down
28 changes: 2 additions & 26 deletions packages/runtime/container-runtime/src/dataStoreContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,30 +609,6 @@ export abstract class FluidDataStoreContext
this.channel!.setConnectionState(connected, clientId);
}

/**
* back-compat ADO 21575: This is temporary and will be removed once the compat requirement across Runtime and
* Datastore boundary is satisfied.
* Process the messages to maintain backwards compatibility. The `processMessages` function is added to
* IFluidDataStoreChannel in 2.5.0. For channels before that, call `process` for each message.
*/
private processMessagesCompat(
channel: IFluidDataStoreChannel,
messageCollection: IRuntimeMessageCollection,
): void {
if (channel.processMessages !== undefined) {
channel.processMessages(messageCollection);
} else {
const { envelope, messagesContent, local } = messageCollection;
for (const { contents, localOpMetadata, clientSequenceNumber } of messagesContent) {
channel.process(
{ ...envelope, contents, clientSequenceNumber },
local,
localOpMetadata,
);
}
}
}

/**
* Process messages for this data store. The messages here are contiguous messages for this data store in a batch.
* @param messageCollection - The collection of messages to process.
Expand All @@ -648,7 +624,7 @@ export abstract class FluidDataStoreContext

if (this.loaded) {
assert(this.channel !== undefined, 0xa68 /* Channel is not loaded */);
this.processMessagesCompat(this.channel, messageCollection);
this.channel.processMessages(messageCollection);
} else {
assert(!local, 0x142 /* "local store channel is not loaded" */);
assert(
Expand Down Expand Up @@ -886,7 +862,7 @@ export abstract class FluidDataStoreContext
for (const messageCollection of this.pendingMessagesState.messageCollections) {
// Only process ops whose seq number is greater than snapshot sequence number from which it loaded.
if (messageCollection.envelope.sequenceNumber > baseSequenceNumber) {
this.processMessagesCompat(channel, messageCollection);
channel.processMessages(messageCollection);
}
}

Expand Down
17 changes: 0 additions & 17 deletions packages/runtime/container-runtime/src/summary/documentSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,23 +614,6 @@ export class DocumentsSchemaController {
}
}

/**
* Process document schema change message
* Called by ContainerRuntime whenever it sees document schema messages.
* @param content - content of the message
* @param local - whether op is local
* @param sequenceNumber - sequence number of the op
* @returns - true if schema was accepted, otherwise false (rejected due to failed CAS)
* @deprecated It has been replaced by processDocumentSchemaMessages instead.
*/
public processDocumentSchemaOp(
content: IDocumentSchemaChangeMessage,
local: boolean,
sequenceNumber: number,
): boolean {
return this.processDocumentSchemaMessages([content], local, sequenceNumber);
}

/**
* Process document schema change messages
* Called by ContainerRuntime whenever it sees document schema messages.
Expand Down
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:
* "Class_DocumentsSchemaController": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Class_DocumentsSchemaController = requireAssignableTo<TypeOnly<current.DocumentsSchemaController>, TypeOnly<old.DocumentsSchemaController>>

/*
Expand Down Expand Up @@ -67,6 +68,7 @@ declare type current_as_old_for_Class_SummaryCollection = requireAssignableTo<Ty
* typeValidation.broken:
* "ClassStatics_DocumentsSchemaController": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_ClassStatics_DocumentsSchemaController = requireAssignableTo<TypeOnly<typeof current.DocumentsSchemaController>, TypeOnly<typeof old.DocumentsSchemaController>>

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ export interface IDeltaConnection {
// @alpha
export interface IDeltaHandler {
applyStashedOp(message: any): void;
// @deprecated
process: (message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) => void;
processMessages?: (messageCollection: IRuntimeMessageCollection) => void;
processMessages: (messageCollection: IRuntimeMessageCollection) => void;
reSubmit(message: any, localOpMetadata: unknown): void;
rollback?(message: any, localOpMetadata: unknown): void;
setConnectionState(connected: boolean): void;
Expand Down
7 changes: 6 additions & 1 deletion packages/runtime/datastore-definitions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {},
"broken": {
"Interface_IDeltaHandler": {
"forwardCompat": false,
"backCompat": false
}
},
"entrypoint": "legacy"
}
}
17 changes: 1 addition & 16 deletions packages/runtime/datastore-definitions/src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

import type { IFluidLoadable } from "@fluidframework/core-interfaces";
import type { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
import type {
IExperimentalIncrementalSummaryContext,
IGarbageCollectionData,
Expand Down Expand Up @@ -125,25 +124,11 @@ export interface IChannel extends IFluidLoadable {
* @alpha
*/
export interface IDeltaHandler {
/**
* Processes the op.
* @param message - The message to process
* @param local - Whether the message originated from the local client
* @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
* For messages from a remote client, this will be undefined.
* @deprecated - Use processMessages instead to process messages.
*/
process: (
message: ISequencedDocumentMessage,
local: boolean,
localOpMetadata: unknown,
) => void;

/**
* Process messages for this channel. The messages here are contiguous messages for this channel in a batch.
* @param messageCollection - The collection of messages to process.
*/
processMessages?: (messageCollection: IRuntimeMessageCollection) => void;
processMessages: (messageCollection: IRuntimeMessageCollection) => void;

/**
* State change events to indicate changes to the delta connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ declare type current_as_old_for_Interface_IDeltaConnection = requireAssignableTo
* typeValidation.broken:
* "Interface_IDeltaHandler": {"forwardCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type old_as_current_for_Interface_IDeltaHandler = requireAssignableTo<TypeOnly<old.IDeltaHandler>, TypeOnly<current.IDeltaHandler>>

/*
Expand All @@ -139,6 +140,7 @@ declare type old_as_current_for_Interface_IDeltaHandler = requireAssignableTo<Ty
* typeValidation.broken:
* "Interface_IDeltaHandler": {"backCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type current_as_old_for_Interface_IDeltaHandler = requireAssignableTo<TypeOnly<current.IDeltaHandler>, TypeOnly<old.IDeltaHandler>>

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export class FluidDataStoreRuntime extends TypedEventEmitter<IFluidDataStoreRunt
get objectsRoutingContext(): this;
// (undocumented)
readonly options: Record<string | number, any>;
process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
processMessages(messageCollection: IRuntimeMessageCollection): void;
// (undocumented)
processSignal(message: IInboundSignalMessage, local: boolean): void;
Expand Down
9 changes: 8 additions & 1 deletion packages/runtime/datastore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,14 @@
"typescript": "~5.4.5"
},
"typeValidation": {
"broken": {},
"broken": {
"Class_FluidDataStoreRuntime": {
"backCompat": false
},
"ClassStatics_FluidDataStoreRuntime": {
"backCompat": false
}
},
"entrypoint": "legacy"
}
}
Loading
Loading