Skip to content

Commit

Permalink
id-compressor: Remove deprecated compressor types from runtime defini…
Browse files Browse the repository at this point in the history
…tions (#19031)

This removes re-exported/deprecated compressor types from the runtime
definitions public API. They were moved to the id-compressor package
earlier.

The removed APIs were technically public but are very unlikely to ever
have been used. They were moved to a publicly available package in
  • Loading branch information
taylorsw04 authored and sonalideshpandemsft committed Apr 15, 2024
1 parent 86e81c7 commit fb6b3df
Show file tree
Hide file tree
Showing 24 changed files with 124 additions and 342 deletions.
7 changes: 7 additions & 0 deletions .changeset/small-cups-shine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@fluidframework/runtime-definitions": minor
---

Deprecated ID compressor related types have been removed.

This change should be a no-op for consumers, as these types were almost certainly unused and are also available in the standalone package id-compressor (https://github.com/microsoft/FluidFramework/pull/18749).
1 change: 1 addition & 0 deletions experimental/dds/tree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@fluidframework/core-interfaces": "workspace:~",
"@fluidframework/core-utils": "workspace:~",
"@fluidframework/datastore-definitions": "workspace:~",
"@fluidframework/id-compressor": "workspace:~",
"@fluidframework/protocol-definitions": "^3.1.0-223007",
"@fluidframework/runtime-definitions": "workspace:~",
"@fluidframework/shared-object-base": "workspace:~",
Expand Down
3 changes: 1 addition & 2 deletions experimental/dds/tree/src/migration-shim/migrationShim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ import {
type IGarbageCollectionData,
type ITelemetryContext,
type ISummaryTreeWithStats,
IIdCompressorCore,
SessionId,
} from '@fluidframework/runtime-definitions';
import { type ITree } from '@fluidframework/tree';
import { assert } from '@fluidframework/core-utils';
import { MessageType, type ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
import { type EventEmitterEventType } from '@fluid-internal/client-utils';
import { DataProcessingError, EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils';
import type { SessionId, IIdCompressorCore } from '@fluidframework/id-compressor';
import { type SharedTreeFactory as LegacySharedTreeFactory, type SharedTree as LegacySharedTree } from '../SharedTree';
import { type IShimChannelServices, NoDeltasChannelServices } from './shimChannelServices.js';
import { MigrationShimDeltaHandler } from './migrationDeltaHandler.js';
Expand Down
4 changes: 2 additions & 2 deletions packages/dds/tree/api-report/tree.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
import { ISharedObject } from '@fluidframework/shared-object-base';
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
import { ITelemetryContext } from '@fluidframework/runtime-definitions';
import { SessionSpaceCompressedId } from '@fluidframework/runtime-definitions';
import { StableId } from '@fluidframework/runtime-definitions';
import { SessionSpaceCompressedId } from '@fluidframework/id-compressor';
import { StableId } from '@fluidframework/id-compressor';
import type { Static } from '@sinclair/typebox';
import type { TSchema } from '@sinclair/typebox';

Expand Down
2 changes: 1 addition & 1 deletion packages/dds/tree/src/core/rebase/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
OpSpaceCompressedId,
SessionId,
SessionSpaceCompressedId,
} from "@fluidframework/runtime-definitions";
} from "@fluidframework/id-compressor";
import {
Brand,
NestedMap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { assert } from "@fluidframework/core-utils";
import { StableId } from "@fluidframework/runtime-definitions";
import { StableId } from "@fluidframework/id-compressor";
import {
FieldKey,
TreeNavigationResult,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {
ITelemetryContext,
ISummaryTreeWithStats,
IGarbageCollectionData,
IIdCompressor,
} from "@fluidframework/runtime-definitions";
import { createSingleBlobSummary } from "@fluidframework/shared-object-base";
import { assert } from "@fluidframework/core-utils";
import { IIdCompressor } from "@fluidframework/id-compressor";
import {
applyDelta,
DeltaFieldChanges,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/

import { SessionSpaceCompressedId, StableId } from "@fluidframework/runtime-definitions";
import { SessionSpaceCompressedId, StableId } from "@fluidframework/id-compressor";
import { Brand, Opaque, brand } from "../../util/index.js";
import { TreeNodeSchemaIdentifier } from "../../core/index.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/dds/tree/src/shared-tree/treeCheckout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/
import { assert } from "@fluidframework/core-utils";
import { IIdCompressor } from "@fluidframework/runtime-definitions";
import { IIdCompressor } from "@fluidframework/id-compressor";
import {
AnchorLocator,
IForestSubscription,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { strict as assert, fail } from "assert";
import { IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
import { IIdCompressor } from "@fluidframework/runtime-definitions";
import { IIdCompressor } from "@fluidframework/id-compressor";
import {
LocalNodeKey,
StableNodeKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/

import { SessionId } from "@fluidframework/runtime-definitions";
import { SessionId } from "@fluidframework/id-compressor";
import { makeCodecFamily, withDefaultBinaryEncoding } from "../../../codec/index.js";
import { typeboxValidator } from "../../../external-utilities/index.js";
import { TestChange } from "../../testChange.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { fail, strict as assert } from "assert";
import { unreachableCase } from "@fluidframework/core-utils";
import { SessionId } from "@fluidframework/runtime-definitions";
import { SessionId } from "@fluidframework/id-compressor";
import { ChangeRebaser, ChangeFamilyEditor, emptyDelta } from "../../../core/index.js";
import { TestChangeFamily, TestChange, asDelta } from "../../testChange.js";
import { Commit, EditManager, SeqNumber } from "../../../shared-tree-core/index.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Licensed under the MIT License.
*/

import { createIdCompressor } from "@fluidframework/id-compressor";
import { SessionId } from "@fluidframework/runtime-definitions";
import { createIdCompressor, SessionId } from "@fluidframework/id-compressor";
import {
ChangeFamily,
ChangeRebaser,
Expand Down
3 changes: 1 addition & 2 deletions packages/runtime/container-runtime/src/dataStoreContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ import {
ISummarizerNodeWithGC,
SummarizeInternalFn,
ITelemetryContext,
IIdCompressor,
IIdCompressorCore,
VisibilityState,
ISummaryTreeWithStats,
} from "@fluidframework/runtime-definitions";
Expand All @@ -67,6 +65,7 @@ import {
tagCodeArtifacts,
ThresholdCounter,
} from "@fluidframework/telemetry-utils";
import { IIdCompressor, IIdCompressorCore } from "@fluidframework/id-compressor";
import {
dataStoreAttributesBlobName,
hasIsolatedChannels,
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/datastore/api-report/datastore.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { IFluidDataStoreRuntimeEvents } from '@fluidframework/datastore-definiti
import { IFluidHandle } from '@fluidframework/core-interfaces';
import { IFluidHandleContext } from '@fluidframework/core-interfaces';
import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
import { IIdCompressor } from '@fluidframework/runtime-definitions';
import { IIdCompressor } from '@fluidframework/id-compressor';
import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
import { ILoaderOptions } from '@fluidframework/container-definitions';
import { IQuorumClients } from '@fluidframework/protocol-definitions';
Expand Down
1 change: 1 addition & 0 deletions packages/runtime/datastore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
"@fluidframework/datastore-definitions": "workspace:~",
"@fluidframework/driver-definitions": "workspace:~",
"@fluidframework/driver-utils": "workspace:~",
"@fluidframework/id-compressor": "workspace:~",
"@fluidframework/protocol-definitions": "^3.1.0-223007",
"@fluidframework/runtime-definitions": "workspace:~",
"@fluidframework/runtime-utils": "workspace:~",
Expand Down
108 changes: 29 additions & 79 deletions packages/runtime/datastore/src/dataStoreRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ import {
ISummaryTreeWithStats,
VisibilityState,
ITelemetryContext,
IIdCompressor,
gcDataBlobKey,
} from "@fluidframework/runtime-definitions";
import {
convertSnapshotTreeToSummaryTree,
Expand All @@ -65,8 +63,6 @@ import {
exceptionToResponse,
GCDataBuilder,
unpackChildNodesUsedRoutes,
addBlobToSummary,
processAttachMessageGCData,
} from "@fluidframework/runtime-utils";
import {
IChannel,
Expand All @@ -75,6 +71,7 @@ import {
IChannelFactory,
} from "@fluidframework/datastore-definitions";
import { v4 as uuid } from "uuid";
import { IIdCompressor } from "@fluidframework/id-compressor";
import { IChannelContext, summarizeChannel } from "./channelContext";
import {
LocalChannelContext,
Expand Down Expand Up @@ -485,7 +482,7 @@ export class FluidDataStoreRuntime
this.notBoundedChannelContextSet.delete(channel.id);
// If our data store is attached, then attach the channel.
if (this.isAttached) {
this.makeChannelLocallyVisible(channel);
this.attachChannel(channel);
return;
}

Expand Down Expand Up @@ -613,13 +610,6 @@ export class FluidDataStoreRuntime
const attachMessage = message.contents as IAttachMessage;
const id = attachMessage.id;

// We need to process the GC Data for both local and remote attach messages
processAttachMessageGCData(attachMessage.snapshot, (nodeId, toPath) => {
// Note: nodeId will be "/" unless and until we support sub-DDS GC Nodes
const fromPath = `/${this.id}/${id}${nodeId === "/" ? "" : nodeId}`;
this.dataStoreContext.addedGCOutboundRoute?.(fromPath, toPath);
});

// If a non-local operation then go and create the object
// Otherwise mark it as officially attached.
if (local) {
Expand Down Expand Up @@ -822,64 +812,6 @@ export class FluidDataStoreRuntime
}

public getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {
const summaryBuilder = new SummaryTreeBuilder();
this.visitLocalBoundContextsDuringAttach(
(contextId: string, context: LocalChannelContextBase) => {
let summaryTree: ISummaryTreeWithStats;
if (context.isLoaded) {
const contextSummary = context.getAttachSummary(telemetryContext);
assert(
contextSummary.summary.type === SummaryType.Tree,
0x180 /* "getAttachSummary should always return a tree" */,
);

summaryTree = { stats: contextSummary.stats, summary: contextSummary.summary };
} else {
// If this channel is not yet loaded, then there should be no changes in the snapshot from which
// it was created as it is detached container. So just use the previous snapshot.
assert(
!!this.dataStoreContext.baseSnapshot,
0x181 /* "BaseSnapshot should be there as detached container loaded from snapshot" */,
);
summaryTree = convertSnapshotTreeToSummaryTree(
this.dataStoreContext.baseSnapshot.trees[contextId],
);
}
summaryBuilder.addWithStats(contextId, summaryTree);
},
);

return summaryBuilder.getSummaryTree();
}

/**
* Get the GC Data for the initial state being attached so remote clients can learn of this DataStore's outbound routes
*/
public getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData {
const gcDataBuilder = new GCDataBuilder();
this.visitLocalBoundContextsDuringAttach(
(contextId: string, context: LocalChannelContextBase) => {
if (context.isLoaded) {
const contextGCData = context.getAttachGCData(telemetryContext);

// Incorporate the GC Data for this context
gcDataBuilder.prefixAndAddNodes(contextId, contextGCData.gcNodes);
}
// else: Rehydrating detached container case. GC doesn't run until the container is attached, so nothing to do here.
},
);
this.updateGCNodes(gcDataBuilder);

return gcDataBuilder.getGCData();
}

/**
* Helper method for preparing to attach this dataStore.
* Runs the callback for each bound context to incorporate its data however the caller specifies
*/
private visitLocalBoundContextsDuringAttach(
visitor: (contextId: string, context: LocalChannelContextBase) => void,
): void {
/**
* back-compat 0.59.1000 - getAttachSummary() is called when making a data store globally visible (previously
* attaching state). Ideally, attachGraph() should have already be called making it locally visible. However,
Expand All @@ -900,15 +832,39 @@ export class FluidDataStoreRuntime
// "The data store should be locally visible when generating attach summary",
// );

const summaryBuilder = new SummaryTreeBuilder();

// Craft the .attributes file for each shared object
for (const [contextId, context] of this.contexts) {
if (!(context instanceof LocalChannelContextBase)) {
throw new LoggingError("Should only be called with local channel handles");
}

if (!this.notBoundedChannelContextSet.has(contextId)) {
visitor(contextId, context);
let summaryTree: ISummaryTreeWithStats;
if (context.isLoaded) {
const contextSummary = context.getAttachSummary(telemetryContext);
assert(
contextSummary.summary.type === SummaryType.Tree,
0x180 /* "getAttachSummary should always return a tree" */,
);
summaryTree = { stats: contextSummary.stats, summary: contextSummary.summary };
} else {
// If this channel is not yet loaded, then there should be no changes in the snapshot from which
// it was created as it is detached container. So just use the previous snapshot.
assert(
!!this.dataStoreContext.baseSnapshot,
0x181 /* "BaseSnapshot should be there as detached container loaded from snapshot" */,
);
summaryTree = convertSnapshotTreeToSummaryTree(
this.dataStoreContext.baseSnapshot.trees[contextId],
);
}
summaryBuilder.addWithStats(contextId, summaryTree);
}
}

return summaryBuilder.getSummaryTree();
}

public submitMessage(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {
Expand All @@ -934,10 +890,9 @@ export class FluidDataStoreRuntime
}

/**
* Assuming this DataStore is already attached, this will make the given channel locally visible
* by submitting its attach op.
* Attach channel should only be called after the data store has been attached
*/
private makeChannelLocallyVisible(channel: IChannel): void {
private attachChannel(channel: IChannel): void {
this.verifyNotClosed();
// If this handle is already attached no need to attach again.
if (channel.handle.isAttached) {
Expand All @@ -957,11 +912,6 @@ export class FluidDataStoreRuntime
true /* fullTree */,
false /* trackState */,
);

// We need to include the channel's GC Data so remote clients can learn of this channel's outbound routes
const gcData = channel.getGCData(/* fullGC: */ true);
addBlobToSummary(summarizeResult, gcDataBlobKey, JSON.stringify(gcData));

// Attach message needs the summary in ITree format. Convert the ISummaryTree into an ITree.
const snapshot = convertSummaryTreeToITree(summarizeResult.summary);

Expand Down
Loading

0 comments on commit fb6b3df

Please sign in to comment.