Skip to content

Commit

Permalink
Remove SharedObjectCore.is and .registerCore (#8841)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarlettjlee authored Feb 1, 2022
1 parent c5d3578 commit b71abdd
Show file tree
Hide file tree
Showing 32 changed files with 67 additions and 203 deletions.
7 changes: 5 additions & 2 deletions BREAKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ required parameter `retryInfo`.
- [`MessageType.Save` and code that handled it was removed](#messageType-save-and-code-that-handled-it-was-removed)
- [Removed `IOdspResolvedUrl.sharingLinkToRedeem`](#Removed-IOdspResolvedUrl.sharingLinkToRedeem)
- [Removed url from ICreateBlobResponse](#removed-url-from-ICreateBlobResponse)
- [`readonly` removed from `IDeltaManager`, `DeltaManager`, and `DeltaManagerProxy`](#readonly-removed-from-IDeltaManager-and-DeltaManager-DeltaManagerProxy)
- [Synthesize Decoupled from IFluidObject and Deprecations Removed](Synthesize-Decoupled-from-IFluidObject-and-Deprecations-Removed)
- [`readonly` removed from `IDeltaManager`, `DeltaManager`, and `DeltaManagerProxy`](#readonly-removed-from-IDeltaManager-and-DeltaManager-DeltaManagerProxy)(Synthesize-Decoupled-from-IFluidObject-and-Deprecations-Removed)
- [codeDetails removed from Container](#codeDetails-removed-from-Container)
- [wait() methods removed from map and directory](#wait-methods-removed-from-map-and-directory)
- [Removed containerPath from DriverPreCheckInfo](#removed-containerPath-from-DriverPreCheckInfo)
- [Removed SharedObject.is](#Removed-SharedObject.is)

### `MessageType.Save` and code that handled it was removed
The `Save` operation type was deprecated and has now been removed. This removes `MessageType.Save` from `protocol-definitions`, `save;${string}: ${string}` from `SummarizeReason` in the `container-runtime` package, and `MessageFactory.createSave()` from and `server-test-utils`.
Expand Down Expand Up @@ -97,6 +97,9 @@ The `wait()` methods on `ISharedMap` and `IDirectory` were deprecated in 0.55 an
### Removed containerPath from DriverPreCheckInfo
The `containerPath` property of `DriverPreCheckInfo` was deprecated and has now been removed. To replace its functionality, use `Loader.request()`.

### Removed `SharedObject.is`
The `is` method is removed from SharedObject. This was being used to detect SharedObjects stored inside other SharedObjects (and then binding them), which should not be happening anymore. Instead, use handles to SharedObjects.

## 0.55 Breaking changes
- [`SharedObject` summary and GC API changes](#SharedObject-summary-and-GC-API-changes)
- [`IChannel.summarize` split into sync and async](#IChannel.summarize-split-into-sync-and-async)
Expand Down
1 change: 0 additions & 1 deletion api-report/cell.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export class SharedCell<T = any> extends SharedObject<ISharedCellEvents<T>> impl
protected loadCore(storage: IChannelStorageService): Promise<void>;
protected onDisconnect(): void;
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
protected registerCore(): void;
set(value: Serializable<T>): void;
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
}
Expand Down
2 changes: 0 additions & 2 deletions api-report/counter.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export class SharedCounter extends SharedObject<ISharedCounterEvents> implements
protected onDisconnect(): void;
// @internal
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
// @internal (undocumented)
protected registerCore(): void;
// @internal
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
get value(): number;
Expand Down
2 changes: 0 additions & 2 deletions api-report/ink.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ export class Ink extends SharedObject<IInkEvents> implements IInk {
// (undocumented)
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
// (undocumented)
protected registerCore(): void;
// (undocumented)
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
}

Expand Down
4 changes: 0 additions & 4 deletions api-report/map.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@ export class SharedDirectory extends SharedObject<ISharedDirectoryEvents> implem
// @internal (undocumented)
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
// @internal (undocumented)
protected registerCore(): void;
// @internal (undocumented)
protected reSubmitCore(content: any, localOpMetadata: unknown): void;
set<T = any>(key: string, value: T): this;
get size(): number;
Expand Down Expand Up @@ -227,8 +225,6 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
// @internal (undocumented)
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
// @internal (undocumented)
protected registerCore(): void;
// @internal (undocumented)
protected reSubmitCore(content: any, localOpMetadata: unknown): void;
set(key: string, value: any): this;
get size(): number;
Expand Down
2 changes: 0 additions & 2 deletions api-report/matrix.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ export class SharedMatrix<T = any> extends SharedObject implements IMatrixProduc
protected processCore(rawMessage: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
protected processGCDataCore(serializer: SummarySerializer): void;
// (undocumented)
protected registerCore(): void;
// (undocumented)
removeCols(colStart: number, count: number): void;
// (undocumented)
removeRows(rowStart: number, count: number): void;
Expand Down
2 changes: 0 additions & 2 deletions api-report/ordered-collection.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ export class ConsensusOrderedCollection<T = any> extends SharedObject<IConsensus
// (undocumented)
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
// (undocumented)
protected registerCore(): void;
// (undocumented)
protected release(acquireId: string): void;
// (undocumented)
protected releaseCore(acquireId: string): void;
Expand Down
2 changes: 0 additions & 2 deletions api-report/register-collection.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export class ConsensusRegisterCollection<T> extends SharedObject<IConsensusRegis
// (undocumented)
readVersions(key: string): T[] | undefined;
// (undocumented)
protected registerCore(): void;
// (undocumented)
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
write(key: string, value: T): Promise<boolean>;
}
Expand Down
4 changes: 0 additions & 4 deletions api-report/sequence.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,6 @@ export class SharedIntervalCollection<TInterval extends ISerializableInterval =
// (undocumented)
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
// (undocumented)
protected registerCore(): void;
// (undocumented)
protected reSubmitCore(content: any, localOpMetadata: unknown): void;
// (undocumented)
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
Expand Down Expand Up @@ -567,8 +565,6 @@ export abstract class SharedSegmentSequence<T extends ISegment> extends SharedOb
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
protected processGCDataCore(serializer: SummarySerializer): void;
// (undocumented)
protected registerCore(): void;
// (undocumented)
removeLocalReference(lref: LocalReference): void;
// (undocumented)
removeRange(start: number, end: number): IMergeTreeRemoveMsg;
Expand Down
7 changes: 0 additions & 7 deletions api-report/shared-object-base.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,26 +114,19 @@ export abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISha
readonly handle: IFluidHandle;
protected handleDecoded(decodedHandle: IFluidHandle): void;
// (undocumented)
get IChannel(): this;
// (undocumented)
id: string;
// (undocumented)
get IFluidLoadable(): this;
initializeLocal(): void;
protected initializeLocalCore(): void;
// (undocumented)
static is(obj: any): obj is SharedObjectCore;
isAttached(): boolean;
// (undocumented)
get ISharedObject(): this;
load(services: IChannelServices): Promise<void>;
protected abstract loadCore(services: IChannelStorageService): Promise<void>;
protected readonly logger: ITelemetryLogger;
protected newAckBasedPromise<T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
protected onConnect(): void;
protected abstract onDisconnect(): any;
protected abstract processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): any;
protected abstract registerCore(): any;
protected reSubmitCore(content: any, localOpMetadata: unknown): void;
// (undocumented)
protected runtime: IFluidDataStoreRuntime;
Expand Down
2 changes: 0 additions & 2 deletions api-report/shared-summary-block.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ export class SharedSummaryBlock extends SharedObject implements ISharedSummaryBl
protected onDisconnect(): void;
// (undocumented)
protected processCore(message: ISequencedDocumentMessage, local: boolean): void;
// (undocumented)
protected registerCore(): void;
set<T>(key: string, value: Jsonable<T>): void;
// (undocumented)
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
Expand Down
2 changes: 0 additions & 2 deletions api-report/task-manager.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ export class TaskManager extends SharedObject<ITaskManagerEvents> implements ITa
protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
// (undocumented)
queued(taskId: string): boolean;
// @internal (undocumented)
protected registerCore(): void;
// @internal
protected reSubmitCore(): void;
// @internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ export class SharedPropertyTree extends SharedObject {
}
}

protected registerCore() { }
protected onDisconnect() { }

private _applyLocalChangeSet(change: IPropertyTreeMessage) {
Expand Down
2 changes: 0 additions & 2 deletions experimental/dds/ot/ot/src/ot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ export abstract class SharedOT<TState, TOp> extends SharedObject {
this.global = this.local = this.serializer.parse(rawContent);
}

protected registerCore() {}

protected onDisconnect() { }

protected processCore(message: ISequencedDocumentMessage, local: boolean) {
Expand Down
7 changes: 0 additions & 7 deletions experimental/dds/tree/src/generic/GenericSharedTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,6 @@ export abstract class GenericSharedTree<TChange> extends SharedObject<ISharedTre
}
}

/**
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.registerCore}
*/
protected registerCore(): void {
// Do nothing
}

/**
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}
*/
Expand Down
2 changes: 0 additions & 2 deletions experimental/dds/xtree/src/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,5 @@ export class SharedXTree extends SharedObject
throw new Error("not implemented");
}

protected registerCore() { throw new Error("not implemented"); }

protected applyStashedOp() { throw new Error("not implemented"); }
}
13 changes: 0 additions & 13 deletions packages/dds/cell/src/cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@ export class SharedCell<T = any> extends SharedObject<ISharedCellEvents<T>>
* {@inheritDoc ISharedCell.set}
*/
public set(value: Serializable<T>) {
if (SharedObject.is(value)) {
throw new Error("SharedObject sets are no longer supported. Instead set the SharedObject handle.");
}

// Serialize the value if required.
const operationValue: ICellValue = {
value: this.serializer.encode(value, this.handle),
Expand Down Expand Up @@ -221,15 +217,6 @@ export class SharedCell<T = any> extends SharedObject<ISharedCellEvents<T>>
this.data = undefined;
}

/**
* Process the cell value on register
*/
protected registerCore() {
if (SharedObject.is(this.data)) {
this.data.bindToContext();
}
}

/**
* Call back on disconnect
*/
Expand Down
7 changes: 0 additions & 7 deletions packages/dds/counter/src/counter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,6 @@ export class SharedCounter extends SharedObject<ISharedCounterEvents> implements
this._value = content.value;
}

/**
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.registerCore}
* @internal
*/
protected registerCore() {
}

/**
* Called when the object has disconnected from the delta stream.
* @internal
Expand Down
7 changes: 0 additions & 7 deletions packages/dds/ink/src/ink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,6 @@ export class Ink extends SharedObject<IInkEvents> implements IInk {
}
}

/**
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.registerCore}
*/
protected registerCore(): void {
return;
}

/**
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}
*/
Expand Down
21 changes: 0 additions & 21 deletions packages/dds/map/src/directory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,27 +647,6 @@ export class SharedDirectory extends SharedObject<ISharedDirectoryEvents> implem
}
}

/**
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.registerCore}
* @internal
*/
protected registerCore(): void {
const subdirsToRegisterFrom = new Array<SubDirectory>();
subdirsToRegisterFrom.push(this.root);

for (const currentSubDir of subdirsToRegisterFrom) {
for (const value of currentSubDir.values()) {
if (SharedObject.is(value)) {
value.bindToContext();
}
}

for (const [, subdir] of currentSubDir.subdirectories()) {
subdirsToRegisterFrom.push(subdir as SubDirectory);
}
}
}

/**
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
* @internal
Expand Down
5 changes: 0 additions & 5 deletions packages/dds/map/src/localValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
ISerializedHandle,
parseHandles,
serializeHandles,
SharedObject,
ValueType,
} from "@fluidframework/shared-object-base";
import {
Expand Down Expand Up @@ -128,10 +127,6 @@ export class LocalValueMaker {
* @returns An ILocalValue containing the value
*/
public fromInMemory(value: any): ILocalValue {
if (SharedObject.is(value)) {
throw new Error("SharedObject sets are no longer supported. Instead set the SharedObject handle.");
}

return new PlainLocalValue(value);
}
}
12 changes: 0 additions & 12 deletions packages/dds/map/src/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,4 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
this.kernel.tryProcessMessage(message.contents, local, localOpMetadata);
}
}

/**
* {@inheritDoc @fluidframework/shared-object-base#SharedObject.registerCore}
* @internal
*/
protected registerCore() {
for (const value of this.values()) {
if (SharedObject.is(value)) {
value.bindToContext();
}
}
}
}
5 changes: 0 additions & 5 deletions packages/dds/matrix/src/matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,11 +621,6 @@ export class SharedMatrix<T = any>
}
}

protected registerCore() {
this.rows.startOrUpdateCollaboration(this.runtime.clientId, 0);
this.cols.startOrUpdateCollaboration(this.runtime.clientId, 0);
}

// Invoked by PermutationVector to notify IMatrixConsumers of row insertion/deletions.
private readonly onRowDelta = (position: number, removedCount: number, insertedCount: number) => {
for (const consumer of this.consumers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,6 @@ export class ConsensusOrderedCollection<T = any>
this.data.loadFrom(content2);
}

protected registerCore() {
return;
}

protected onDisconnect() {
for (const [, { value, clientId }] of this.jobTracking) {
if (clientId === this.runtime.clientId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ export class ConsensusRegisterCollection<T>
}
}

protected registerCore() { }

protected onDisconnect() {}

protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {
Expand Down
5 changes: 0 additions & 5 deletions packages/dds/sequence/src/localValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
ISerializedHandle,
parseHandles,
serializeHandles,
SharedObject,
ValueType,
} from "@fluidframework/shared-object-base";
import {
Expand Down Expand Up @@ -219,10 +218,6 @@ export class LocalValueMaker {
* @returns An ILocalValue containing the value
*/
public fromInMemory(value: any): ILocalValue {
if (SharedObject.is(value)) {
throw new Error("SharedObject sets are no longer supported. Instead set the SharedObject handle.");
}

return new PlainLocalValue(value);
}

Expand Down
10 changes: 0 additions & 10 deletions packages/dds/sequence/src/sequence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,16 +565,6 @@ export abstract class SharedSegmentSequence<T extends ISegment>
}
}

protected registerCore() {
for (const value of this.intervalMapKernel.values()) {
if (SharedObject.is(value)) {
value.bindToContext();
}
}

this.client.startOrUpdateCollaboration(this.runtime.clientId);
}

protected didAttach() {
// If we are not local, and we've attached we need to start generating and sending ops
// so start collaboration and provide a default client id incase we are not connected
Expand Down
8 changes: 0 additions & 8 deletions packages/dds/sequence/src/sharedIntervalCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,6 @@ export class SharedIntervalCollection<TInterval extends ISerializableInterval =
}
}

protected registerCore() {
for (const value of this.intervalMapKernel.values()) {
if (SharedObject.is(value)) {
value.bindToContext();
}
}
}

/**
* Creates the full path of the intervalCollection label
* @param label - the incoming lable
Expand Down
Loading

0 comments on commit b71abdd

Please sign in to comment.