diff --git a/packages/dds/matrix/src/matrix.ts b/packages/dds/matrix/src/matrix.ts index 2dc38960aa79..052a6d1a85c0 100644 --- a/packages/dds/matrix/src/matrix.ts +++ b/packages/dds/matrix/src/matrix.ts @@ -17,7 +17,6 @@ import { } from "@fluidframework/datastore-definitions/internal"; import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal"; import { - // eslint-disable-next-line import/no-deprecated Client, IJSONSegment, IMergeTreeOp, @@ -25,8 +24,6 @@ import { type LocalReferencePosition, MergeTreeDeltaType, ReferenceType, - // eslint-disable-next-line import/no-deprecated - SegmentGroup, segmentIsRemoved, } from "@fluidframework/merge-tree/internal"; import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions/internal"; @@ -755,7 +752,6 @@ export class SharedMatrix } private rebasePosition( - // eslint-disable-next-line import/no-deprecated client: Client, ref: LocalReferencePosition, localSeq: number, @@ -813,23 +809,11 @@ export class SharedMatrix } else { switch (content.target) { case SnapshotPath.cols: { - this.submitColMessage( - this.cols.regeneratePendingOp( - content, - // eslint-disable-next-line import/no-deprecated - localOpMetadata as SegmentGroup | SegmentGroup[], - ), - ); + this.submitColMessage(this.cols.regeneratePendingOp(content, localOpMetadata)); break; } case SnapshotPath.rows: { - this.submitRowMessage( - this.rows.regeneratePendingOp( - content, - // eslint-disable-next-line import/no-deprecated - localOpMetadata as SegmentGroup | SegmentGroup[], - ), - ); + this.submitRowMessage(this.rows.regeneratePendingOp(content, localOpMetadata)); break; } default: { diff --git a/packages/dds/matrix/src/permutationvector.ts b/packages/dds/matrix/src/permutationvector.ts index 3bfb592f5176..aae2aaa5e924 100644 --- a/packages/dds/matrix/src/permutationvector.ts +++ b/packages/dds/matrix/src/permutationvector.ts @@ -11,7 +11,7 @@ import { } from "@fluidframework/datastore-definitions/internal"; import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal"; import { - BaseSegment, // eslint-disable-next-line import/no-deprecated + BaseSegment, Client, IJSONSegment, IMergeTreeDeltaCallbackArgs, diff --git a/packages/dds/merge-tree/src/client.ts b/packages/dds/merge-tree/src/client.ts index c773bb13942c..a5f139c8391e 100644 --- a/packages/dds/merge-tree/src/client.ts +++ b/packages/dds/merge-tree/src/client.ts @@ -192,12 +192,7 @@ export class Client extends TypedEventEmitter { * @param count - The number segment groups to get peek from the tail of the queue. Default 1. */ - public peekPendingSegmentGroups(): SegmentGroup | undefined; - - public peekPendingSegmentGroups(count: number): SegmentGroup | SegmentGroup[] | undefined; - public peekPendingSegmentGroups( - count: number = 1, - ): SegmentGroup | SegmentGroup[] | undefined { + public peekPendingSegmentGroups(count: number = 1): unknown { const pending = this._mergeTree.pendingSegments; let node = pending?.last; if (count === 1 || pending === undefined) { @@ -876,7 +871,7 @@ export class Client extends TypedEventEmitter { private resetPendingDeltaToOps( resetOp: IMergeTreeDeltaOp, - segmentGroup: SegmentGroup, + segmentGroup: SegmentGroup, ): IMergeTreeDeltaOp[] { assert(!!segmentGroup, 0x033 /* "Segment group undefined" */); const NACKedSegmentGroup = this.pendingRebase?.shift()?.data; @@ -1193,11 +1188,8 @@ export class Client extends TypedEventEmitter { * @param resetOp - The op to reset * @param segmentGroup - The segment group associated with the op */ - public regeneratePendingOp( - resetOp: IMergeTreeOp, - - segmentGroup: SegmentGroup | SegmentGroup[], - ): IMergeTreeOp { + public regeneratePendingOp(resetOp: IMergeTreeOp, localOpMetadata: unknown): IMergeTreeOp { + const segmentGroup = localOpMetadata as SegmentGroup | SegmentGroup[]; if (this.pendingRebase === undefined || this.pendingRebase.empty) { let firstGroup: SegmentGroup; if (Array.isArray(segmentGroup)) { diff --git a/packages/dds/merge-tree/src/index.ts b/packages/dds/merge-tree/src/index.ts index a5d3cb182cb3..35f1d761dd12 100644 --- a/packages/dds/merge-tree/src/index.ts +++ b/packages/dds/merge-tree/src/index.ts @@ -58,7 +58,6 @@ export { export { BaseSegment, CollaborationWindow, - debugMarkerToString, IJSONMarkerSegment, IMergeNodeCommon, segmentIsRemoved, @@ -67,8 +66,6 @@ export { Marker, reservedMarkerIdKey, reservedMarkerSimpleTypeKey, - SegmentGroup, - ObliterateInfo, ISegmentInternal, } from "./mergeTreeNodes.js"; export { diff --git a/packages/dds/merge-tree/src/mergeTree.ts b/packages/dds/merge-tree/src/mergeTree.ts index b50949ee5bca..37bea60256f6 100644 --- a/packages/dds/merge-tree/src/mergeTree.ts +++ b/packages/dds/merge-tree/src/mergeTree.ts @@ -2400,7 +2400,7 @@ export class MergeTree { throw new Error("Rollback op doesn't match last edit"); } let i = 0; - for (const segment of pendingSegmentGroup.segments as ISegmentPrivate[]) { + for (const segment of pendingSegmentGroup.segments) { const segmentSegmentGroup = segment?.segmentGroups?.pop?.(); assert( segmentSegmentGroup === pendingSegmentGroup, diff --git a/packages/dds/merge-tree/src/mergeTreeNodes.ts b/packages/dds/merge-tree/src/mergeTreeNodes.ts index 37bc02180c1f..487f2d321dc4 100644 --- a/packages/dds/merge-tree/src/mergeTreeNodes.ts +++ b/packages/dds/merge-tree/src/mergeTreeNodes.ts @@ -19,11 +19,7 @@ import { IJSONSegment, IMarkerDef, ReferenceType } from "./ops.js"; import { computeHierarchicalOrdinal } from "./ordinal.js"; import type { PartialSequenceLengths } from "./partialLengths.js"; import { PropertySet, clone, createMap, type MapLike } from "./properties.js"; -import { - ReferencePosition, - refGetTileLabels, - refTypeIncludesFlag, -} from "./referencePositions.js"; +import { ReferencePosition } from "./referencePositions.js"; import { SegmentGroupCollection } from "./segmentGroupCollection.js"; import { isInserted, @@ -273,14 +269,6 @@ export function segmentIsRemoved(segment: ISegment): boolean { return leaf.removedSeq !== undefined; } -/** - * @internal - */ -export interface IMarkerModifiedAction { - // eslint-disable-next-line @typescript-eslint/prefer-function-type - (marker: Marker): void; -} - /** * @legacy * @alpha @@ -297,16 +285,10 @@ export interface ISegmentAction { accum: TClientData, ): boolean; } -/** - * @internal - */ export interface ISegmentChanges { - next?: ISegmentInternal; - replaceCurrent?: ISegmentInternal; + next?: ISegmentPrivate; + replaceCurrent?: ISegmentPrivate; } -/** - * @internal - */ export interface BlockAction { // eslint-disable-next-line @typescript-eslint/prefer-function-type ( @@ -320,49 +302,16 @@ export interface BlockAction { ): boolean; } -/** - * @internal - */ -export interface NodeAction { - // eslint-disable-next-line @typescript-eslint/prefer-function-type - ( - node: IMergeNode, - pos: number, - refSeq: number, - clientId: number, - start: number | undefined, - end: number | undefined, - clientData: TClientData, - ): boolean; -} - -/** - * @internal - */ export interface InsertContext { - candidateSegment?: ISegmentInternal; + candidateSegment?: ISegmentPrivate; leaf: ( - segment: ISegmentInternal | undefined, + segment: ISegmentPrivate | undefined, pos: number, ic: InsertContext, ) => ISegmentChanges; continuePredicate?: (continueFromBlock: MergeBlock) => boolean; } -/** - * @internal - */ -export interface SegmentActions { - leaf?: ISegmentAction; - shift?: NodeAction; - contains?: NodeAction; - pre?: BlockAction; - post?: BlockAction; -} - -/** - * @internal - */ export interface ObliterateInfo { start: LocalReferencePosition; end: LocalReferencePosition; @@ -373,11 +322,8 @@ export interface ObliterateInfo { segmentGroup: SegmentGroup | undefined; } -/** - * @internal - */ -export interface SegmentGroup { - segments: S[]; +export interface SegmentGroup { + segments: ISegmentPrivate[]; previousProps?: PropertySet[]; localSeq?: number; refSeq: number; @@ -389,12 +335,8 @@ export interface SegmentGroup { * the MergeTree always inserts first, then checks for overflow and splits if the child count equals * `MaxNodesInBlock`. (i.e., `MaxNodesInBlock` contains 1 extra slot for temporary storage to * facilitate splits.) - * @internal */ export const MaxNodesInBlock = 8; -/** - * @internal - */ export class MergeBlock implements IMergeNodeCommon { public children: IMergeNode[]; public needsScour?: boolean; @@ -873,47 +815,3 @@ export const compareNumbers = (a: number, b: number): number => a - b; * Compares two strings. */ export const compareStrings = (a: string, b: string): number => a.localeCompare(b); - -/** - * Get a human-readable string for a given {@link Marker}. - * - * @remarks This function is intended for debugging only. The exact format of - * this string should not be relied upon between versions. - * @internal - */ -export function debugMarkerToString(marker: Marker): string { - let bbuf = ""; - if (refTypeIncludesFlag(marker, ReferenceType.Tile)) { - bbuf += "Tile"; - } - let lbuf = ""; - const id = marker.getId(); - if (id) { - bbuf += ` (${id}) `; - } - const tileLabels = refGetTileLabels(marker); - if (tileLabels) { - lbuf += "tile -- "; - for (let i = 0, len = tileLabels.length; i < len; i++) { - const tileLabel = tileLabels[i]; - if (i > 0) { - lbuf += "; "; - } - lbuf += tileLabel; - } - } - - let pbuf = ""; - if (marker.properties) { - pbuf += JSON.stringify(marker.properties, (key, value) => { - // Avoid circular reference when stringifying makers containing handles. - // (Substitute a debug string instead.) - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access - const handle = !!value && value.IFluidHandle; - - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access - return handle ? `#Handle(${handle.routeContext.path}/${handle.path})` : value; - }); - } - return `M ${bbuf}: ${lbuf} ${pbuf}`; -} diff --git a/packages/dds/merge-tree/src/segmentGroupCollection.ts b/packages/dds/merge-tree/src/segmentGroupCollection.ts index 3ce4354901b3..665e06672c07 100644 --- a/packages/dds/merge-tree/src/segmentGroupCollection.ts +++ b/packages/dds/merge-tree/src/segmentGroupCollection.ts @@ -7,10 +7,10 @@ import { DoublyLinkedList, walkList } from "./collections/index.js"; import { SegmentGroup, type ISegmentPrivate } from "./mergeTreeNodes.js"; export class SegmentGroupCollection { - private readonly segmentGroups: DoublyLinkedList>; + private readonly segmentGroups: DoublyLinkedList; constructor(private readonly segment: ISegmentPrivate) { - this.segmentGroups = new DoublyLinkedList>(); + this.segmentGroups = new DoublyLinkedList(); } public get size(): number { @@ -21,16 +21,16 @@ export class SegmentGroupCollection { return this.segmentGroups.empty; } - public enqueue(segmentGroup: SegmentGroup): void { + public enqueue(segmentGroup: SegmentGroup): void { this.segmentGroups.push(segmentGroup); segmentGroup.segments.push(this.segment); } - public dequeue(): SegmentGroup | undefined { + public dequeue(): SegmentGroup | undefined { return this.segmentGroups.shift()?.data; } - public remove?(segmentGroup: SegmentGroup): boolean { + public remove?(segmentGroup: SegmentGroup): boolean { const found = this.segmentGroups.find((v) => v.data === segmentGroup); if (found === undefined) { return false; @@ -39,7 +39,7 @@ export class SegmentGroupCollection { return true; } - public pop?(): SegmentGroup | undefined { + public pop?(): SegmentGroup | undefined { return this.segmentGroups.pop ? this.segmentGroups.pop()?.data : undefined; } @@ -47,10 +47,7 @@ export class SegmentGroupCollection { walkList(this.segmentGroups, (sg) => segmentGroups.enqueueOnCopy(sg.data, this.segment)); } - private enqueueOnCopy( - segmentGroup: SegmentGroup, - sourceSegment: ISegmentPrivate, - ): void { + private enqueueOnCopy(segmentGroup: SegmentGroup, sourceSegment: ISegmentPrivate): void { this.enqueue(segmentGroup); if (segmentGroup.previousProps) { // duplicate the previousProps for this segment diff --git a/packages/dds/merge-tree/src/test/index.ts b/packages/dds/merge-tree/src/test/index.ts index c61b166cdc46..c0c7afabc1da 100644 --- a/packages/dds/merge-tree/src/test/index.ts +++ b/packages/dds/merge-tree/src/test/index.ts @@ -62,7 +62,6 @@ export { createInsertSegmentOp, createMap, createRemoveRangeOp, - debugMarkerToString, DetachedReferencePosition, discardMergeTreeDeltaRevertible, IJSONMarkerSegment, @@ -119,7 +118,6 @@ export { reservedMarkerSimpleTypeKey, reservedTileLabelsKey, revertMergeTreeDeltaRevertibles, - SegmentGroup, SortedSegmentSet, SortedSegmentSetItem, SortedSet, diff --git a/packages/dds/merge-tree/src/test/reconnectHelper.ts b/packages/dds/merge-tree/src/test/reconnectHelper.ts index 5ccefec3786d..dd130c4fff99 100644 --- a/packages/dds/merge-tree/src/test/reconnectHelper.ts +++ b/packages/dds/merge-tree/src/test/reconnectHelper.ts @@ -8,12 +8,12 @@ import { strict as assert } from "node:assert"; import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal"; import { - SegmentGroup, endpointPosAndSide, type IMergeTreeOptions, type InteriorSequencePlace, type SequencePlace, } from "../index.js"; +import type { SegmentGroup } from "../mergeTreeNodes.js"; import { IMergeTreeDeltaOp, type IMergeTreeInsertMsg, diff --git a/packages/dds/merge-tree/src/test/testClient.ts b/packages/dds/merge-tree/src/test/testClient.ts index 70224d034e6a..fbf33f8eafc8 100644 --- a/packages/dds/merge-tree/src/test/testClient.ts +++ b/packages/dds/merge-tree/src/test/testClient.ts @@ -29,7 +29,13 @@ import { forwardExcursion, walkAllChildSegments, } from "../mergeTreeNodeWalk.js"; -import { MergeBlock, ISegmentPrivate, Marker, MaxNodesInBlock } from "../mergeTreeNodes.js"; +import { + MergeBlock, + ISegmentPrivate, + Marker, + MaxNodesInBlock, + type SegmentGroup, +} from "../mergeTreeNodes.js"; import { createAnnotateRangeOp, createInsertSegmentOp, @@ -479,6 +485,15 @@ export class TestClient extends Client { return seqs; } + public peekPendingSegmentGroups(): SegmentGroup | undefined; + public peekPendingSegmentGroups(count: number): SegmentGroup | SegmentGroup[] | undefined; + public peekPendingSegmentGroups( + count: number = 1, + ): SegmentGroup | SegmentGroup[] | undefined { + // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion + return super.peekPendingSegmentGroups(count) as SegmentGroup | SegmentGroup[] | undefined; + } + /** * Override and add some test only metrics */ diff --git a/packages/dds/sequence/src/sequence.ts b/packages/dds/sequence/src/sequence.ts index 186f992d8b7c..8d6cad956d77 100644 --- a/packages/dds/sequence/src/sequence.ts +++ b/packages/dds/sequence/src/sequence.ts @@ -16,7 +16,6 @@ import { ISequencedDocumentMessage, } from "@fluidframework/driver-definitions/internal"; import { - // eslint-disable-next-line import/no-deprecated Client, IJSONSegment, IMergeTreeAnnotateMsg, @@ -36,8 +35,6 @@ import { PropertySet, ReferencePosition, ReferenceType, - // eslint-disable-next-line import/no-deprecated - SegmentGroup, SlidingPreference, createAnnotateRangeOp, // eslint-disable-next-line import/no-deprecated @@ -504,7 +501,6 @@ export abstract class SharedSegmentSequence return this.ongoingResubmitRefSeq ?? this.deltaManager.lastSequenceNumber; } - // eslint-disable-next-line import/no-deprecated protected client: Client; private messagesSinceMSNChange: ISequencedDocumentMessage[] = []; private readonly intervalCollections: IntervalCollectionMap; @@ -543,7 +539,6 @@ export abstract class SharedSegmentSequence dataStoreRuntime.options, ); - // eslint-disable-next-line import/no-deprecated this.client = new Client( segmentFromSpec, createChildLogger({ @@ -812,11 +807,7 @@ export abstract class SharedSegmentSequence ) ) { this.submitSequenceMessage( - this.client.regeneratePendingOp( - content as IMergeTreeOp, - // eslint-disable-next-line import/no-deprecated - localOpMetadata as SegmentGroup | SegmentGroup[], - ), + this.client.regeneratePendingOp(content as IMergeTreeOp, localOpMetadata), ); } });