Skip to content

Commit

Permalink
Prepare to move sharedSequence to sequence-deprecated package (#16829)
Browse files Browse the repository at this point in the history
sharedSequence is only used by dds in the sequence-deprecated package,
so is not needed in the sequence package, this change begins the process
of deprecating and moving sharedSequence to sequence-deprecated

---------

Co-authored-by: Tony Murphy <[email protected]>
  • Loading branch information
anthony-murphy and anthony-murphy authored Aug 16, 2023
1 parent eefcfcf commit 0cf2b6d
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 6 deletions.
11 changes: 11 additions & 0 deletions .changeset/real-webs-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@fluidframework/sequence": minor
---

Deprecate SharedSequence, SubSequence, and IJSONRunSegment

The types SharedSequence, SubSequence, and IJSONRunSegment are being deprecated and moved.

They are now, and will continue to be exposed from the @fluid-experimental/sequence-deprecated package.

New usages of these types should not be added, but they may be necessary for migration.
7 changes: 7 additions & 0 deletions api-report/sequence-deprecated.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { IChannelFactory } from '@fluidframework/datastore-definitions';
import { IChannelServices } from '@fluidframework/datastore-definitions';
import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
import { IFluidHandle } from '@fluidframework/core-interfaces';
import { IJSONRunSegment } from '@fluidframework/sequence';
import { IJSONSegment } from '@fluidframework/merge-tree';
import { ISegment } from '@fluidframework/merge-tree';
import { ISharedObject } from '@fluidframework/shared-object-base';
Expand All @@ -20,6 +21,8 @@ import { SharedSegmentSequence } from '@fluidframework/sequence';
import { SharedSequence } from '@fluidframework/sequence';
import { SubSequence } from '@fluidframework/sequence';

export { IJSONRunSegment }

// @public @deprecated (undocumented)
export type MatrixSegment = RunSegment | PaddingSegment;

Expand Down Expand Up @@ -136,6 +139,8 @@ export class SharedObjectSequence<T> extends SharedSequence<T> {
id: string;
}

export { SharedSequence }

// @public @deprecated (undocumented)
export class SparseMatrix extends SharedSegmentSequence<MatrixSegment> {
constructor(document: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes);
Expand Down Expand Up @@ -189,6 +194,8 @@ export class SparseMatrixFactory implements IChannelFactory {
// @public @deprecated (undocumented)
export type SparseMatrixItem = Serializable;

export { SubSequence }

// (No @packageDocumentation comment for this package)

```
6 changes: 3 additions & 3 deletions api-report/sequence.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export interface IIntervalHelpers<TInterval extends ISerializableInterval> {
create(label: string, start: number | undefined, end: number | undefined, client: Client | undefined, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean, stickiness?: IntervalStickiness): TInterval;
}

// @public (undocumented)
// @public @deprecated (undocumented)
export interface IJSONRunSegment<T> extends IJSONSegment {
// (undocumented)
items: Serializable<T>[];
Expand Down Expand Up @@ -587,7 +587,7 @@ export abstract class SharedSegmentSequence<T extends ISegment> extends SharedOb
walkSegments<TClientData>(handler: ISegmentAction<TClientData>, start?: number, end?: number, accum?: TClientData, splitRange?: boolean): void;
}

// @public (undocumented)
// @public @deprecated (undocumented)
export class SharedSequence<T> extends SharedSegmentSequence<SubSequence<T>> {
constructor(document: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes, specToSegment: (spec: IJSONSegment) => ISegment);
getItemCount(): number;
Expand Down Expand Up @@ -653,7 +653,7 @@ export type SharedStringRevertible = MergeTreeDeltaRevertible | IntervalRevertib
// @public (undocumented)
export type SharedStringSegment = TextSegment | Marker;

// @public (undocumented)
// @public @deprecated (undocumented)
export class SubSequence<T> extends BaseSegment {
constructor(items: Serializable<T>[]);
// (undocumented)
Expand Down
1 change: 1 addition & 0 deletions experimental/dds/sequence-deprecated/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ export {
SparseMatrixFactory,
SparseMatrixItem,
} from "./sparsematrix";
export { IJSONRunSegment, SubSequence, SharedSequence } from "./sharedSequence";
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/

import { IFluidDataStoreRuntime, IChannelAttributes } from "@fluidframework/datastore-definitions";
import { SharedSequence } from "@fluidframework/sequence";
import { SharedNumberSequenceFactory } from "./sequenceFactory";
import { SharedSequence } from "./sharedSequence";

/**
* The SharedNumberSequence holds a sequence of numbers. Each number will be stored
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
IChannelAttributes,
Serializable,
} from "@fluidframework/datastore-definitions";
import { SharedSequence } from "@fluidframework/sequence";
import { SharedObjectSequenceFactory } from "./sequenceFactory";
import { SharedSequence } from "./sharedSequence";

/**
* The SharedObjectSequence holds a sequence of serializable objects. Each object will be stored
Expand Down
12 changes: 12 additions & 0 deletions experimental/dds/sequence-deprecated/src/sharedSequence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/

/**
* In a future release we will move these types here and export them directly with:
*
* @deprecated SharedSequence is not recommended for use and will be removed in an upcoming release.
* For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)
*/
export { SubSequence, SharedSequence, IJSONRunSegment } from "@fluidframework/sequence";
3 changes: 2 additions & 1 deletion experimental/dds/sequence-deprecated/src/sparsematrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import {
Serializable,
Jsonable,
} from "@fluidframework/datastore-definitions";
import { SharedSegmentSequence, SubSequence } from "@fluidframework/sequence";
import { ISharedObject } from "@fluidframework/shared-object-base";
import { SharedSegmentSequence } from "@fluidframework/sequence";
import { pkgVersion } from "./packageVersion";
import { SubSequence } from "./sharedSequence";

/**
* An empty segment that occupies 'cachedLength' positions.
Expand Down
9 changes: 9 additions & 0 deletions packages/dds/sequence/src/sharedSequence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ import { SharedSegmentSequence } from "./sequence";

const MaxRun = 128;

/**
* @deprecated - IJSONRunSegment will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package
*/
export interface IJSONRunSegment<T> extends IJSONSegment {
items: Serializable<T>[];
}

/**
* @deprecated - SubSequence will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package
*/
export class SubSequence<T> extends BaseSegment {
public static readonly typeString: string = "SubSequence";
public static is(segment: ISegment): segment is SubSequence<any> {
Expand Down Expand Up @@ -98,6 +104,9 @@ export class SubSequence<T> extends BaseSegment {
}
}

/**
* @deprecated - SharedSequence will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package
*/
export class SharedSequence<T> extends SharedSegmentSequence<SubSequence<T>> {
constructor(
document: IFluidDataStoreRuntime,
Expand Down

0 comments on commit 0cf2b6d

Please sign in to comment.