Skip to content

Commit

Permalink
Remove redundent members of ISharedObject (#10076)
Browse files Browse the repository at this point in the history
Co-authored-by: Craig Macomber <[email protected]>
  • Loading branch information
CraigMacomber and Craig Macomber authored May 3, 2022
1 parent cbb3b03 commit b1da9ee
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 39 deletions.
10 changes: 6 additions & 4 deletions api-report/shared-object-base.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ export interface ISerializedHandle {
// @public
export interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends IChannel, IEventProvider<TEvent> {
bindToContext(): void;
connect(services: IChannelServices): void;
getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;
getGCData(fullGC?: boolean): IGarbageCollectionData;
isAttached(): boolean;
summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;
}

// @public (undocumented)
Expand All @@ -88,11 +84,13 @@ export function serializeHandles(value: any, serializer: IFluidSerializer, bind:
// @public
export abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends SharedObjectCore<TEvent> {
constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
// (undocumented)
getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;
getGCData(fullGC?: boolean): IGarbageCollectionData;
protected processGCDataCore(serializer: SummarySerializer): void;
// (undocumented)
protected get serializer(): IFluidSerializer;
// (undocumented)
summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;
protected abstract summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
}
Expand All @@ -104,10 +102,12 @@ export abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISha
// (undocumented)
readonly attributes: IChannelAttributes;
bindToContext(): void;
// (undocumented)
connect(services: IChannelServices): void;
get connected(): boolean;
protected didAttach(): void;
protected dirty(): void;
// (undocumented)
abstract getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;
abstract getGCData(fullGC?: boolean): IGarbageCollectionData;
readonly handle: IFluidHandle;
Expand All @@ -118,6 +118,7 @@ export abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISha
get IFluidLoadable(): this;
initializeLocal(): void;
protected initializeLocalCore(): void;
// (undocumented)
isAttached(): boolean;
load(services: IChannelServices): Promise<void>;
protected abstract loadCore(services: IChannelStorageService): Promise<void>;
Expand All @@ -130,6 +131,7 @@ export abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISha
// (undocumented)
protected runtime: IFluidDataStoreRuntime;
protected submitLocalMessage(content: any, localOpMetadata?: unknown): void;
// (undocumented)
abstract summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;
}

Expand Down
12 changes: 6 additions & 6 deletions packages/dds/shared-object-base/src/sharedObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,27 +184,27 @@ export abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISha
}

/**
* {@inheritDoc (ISharedObject:interface).connect}
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).connect}
*/
public connect(services: IChannelServices) {
this.services = services;
this.attachDeltaHandler();
}

/**
* {@inheritDoc (ISharedObject:interface).isAttached}
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).isAttached}
*/
public isAttached(): boolean {
return this.services !== undefined && this.runtime.attachState !== AttachState.Detached;
}

/**
* {@inheritDoc (ISharedObject:interface).getAttachSummary}
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}
*/
public abstract getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;

/**
* {@inheritDoc (ISharedObject:interface).summarize}
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
*/
public abstract summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;

Expand Down Expand Up @@ -470,14 +470,14 @@ export abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedO
}

/**
* {@inheritDoc (ISharedObject:interface).getAttachSummary}
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}
*/
public getAttachSummary(fullTree: boolean = false, trackState: boolean = false): ISummaryTreeWithStats {
return this.summarizeCore(this.serializer);
}

/**
* {@inheritDoc (ISharedObject:interface).summarize}
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
*/
public async summarize(fullTree: boolean = false, trackState: boolean = false): Promise<ISummaryTreeWithStats> {
return this.summarizeCore(this.serializer);
Expand Down
29 changes: 2 additions & 27 deletions packages/dds/shared-object-base/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
*/

import { IErrorEvent, IEventProvider, IEventThisPlaceHolder } from "@fluidframework/common-definitions";
import { IChannel, IChannelServices } from "@fluidframework/datastore-definitions";
import { IChannel } from "@fluidframework/datastore-definitions";
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
import { IGarbageCollectionData, ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
import { IGarbageCollectionData } from "@fluidframework/runtime-definitions";

export interface ISharedObjectEvents extends IErrorEvent {
(event: "pre-op" | "op",
Expand All @@ -24,31 +24,6 @@ export interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjec
*/
bindToContext(): void;

/**
* Returns whether the given shared object is attached to storage.
* @returns True if the given shared object is attached
*/
isAttached(): boolean;

/**
* Generates summary of the channel synchronously.
* @returns A tree representing the summary of the shared object.
*/
getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;

/**
* Generates summary of the shared object asynchronously.
* This should not be called where the object can be modified while summarization is in progress.
* @returns A tree representing the summary of the channel.
*/
summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;

/**
* Enables the channel to send and receive ops.
* @param services - Services to connect to
*/
connect(services: IChannelServices): void;

/**
* Returns the GC data for this shared object. It contains a list of GC nodes that contains references to
* other GC nodes.
Expand Down
6 changes: 4 additions & 2 deletions packages/runtime/datastore-definitions/src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ export interface IChannel extends IFluidLoadable {
summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;

/**
* True if the data structure is attached to storage.
* Checks if the channel is attached to storage.
* @returns True iff the channel is attached.
*/
isAttached(): boolean;

/**
* Enables the channel to send and receive ops
* Enables the channel to send and receive ops.
* @param services - Services to connect to
*/
connect(services: IChannelServices): void;

Expand Down

0 comments on commit b1da9ee

Please sign in to comment.