diff --git a/packages/runtime/container-runtime/src/containerRuntime.ts b/packages/runtime/container-runtime/src/containerRuntime.ts index 277f65f011b5..fe94649ee94b 100644 --- a/packages/runtime/container-runtime/src/containerRuntime.ts +++ b/packages/runtime/container-runtime/src/containerRuntime.ts @@ -3,47 +3,48 @@ * Licensed under the MIT License. */ -import { - Trace, - TypedEventEmitter, - type ILayerCompatDetails, - type IProvideLayerCompatDetails, +import type { + ILayerCompatDetails, + IProvideLayerCompatDetails, } from "@fluid-internal/client-utils"; -import { - AttachState, +import { Trace, TypedEventEmitter } from "@fluid-internal/client-utils"; +import type { IAudience, ISelf, ICriticalContainerError, - type IAudienceEvents, + IAudienceEvents, } from "@fluidframework/container-definitions"; -import { +import { AttachState } from "@fluidframework/container-definitions"; +import type { IContainerContext, IGetPendingLocalStateProps, ILoader, IRuntime, - LoaderHeader, IDeltaManager, IDeltaManagerFull, - isIDeltaManagerFull, } from "@fluidframework/container-definitions/internal"; import { + LoaderHeader, + isIDeltaManagerFull, +} from "@fluidframework/container-definitions/internal"; +import type { IContainerRuntime, IContainerRuntimeEvents, } from "@fluidframework/container-runtime-definitions/internal"; -import { +import type { FluidObject, IFluidHandle, IRequest, IResponse, ITelemetryBaseLogger, } from "@fluidframework/core-interfaces"; -import { - type IErrorBase, +import type { + IErrorBase, IFluidHandleContext, - type IFluidHandleInternal, + IFluidHandleInternal, IProvideFluidHandleContext, + ISignalEnvelope, } from "@fluidframework/core-interfaces/internal"; -import { ISignalEnvelope } from "@fluidframework/core-interfaces/internal"; import { assert, Deferred, @@ -51,24 +52,26 @@ import { PromiseCache, delay, } from "@fluidframework/core-utils/internal"; -import { +import type { IClientDetails, IQuorumClients, ISummaryTree, - SummaryType, } from "@fluidframework/driver-definitions"; -import { - DriverHeader, - FetchSource, +import { SummaryType } from "@fluidframework/driver-definitions"; +import type { IDocumentStorageService, - type ISnapshot, IDocumentMessage, + ISequencedDocumentMessage, + ISignalMessage, + ISnapshot, ISnapshotTree, ISummaryContent, + ISummaryContext, +} from "@fluidframework/driver-definitions/internal"; +import { + DriverHeader, + FetchSource, MessageType, - ISequencedDocumentMessage, - ISignalMessage, - type ISummaryContext, } from "@fluidframework/driver-definitions/internal"; import { readAndParse } from "@fluidframework/driver-utils/internal"; import type { IIdCompressor } from "@fluidframework/id-compressor"; @@ -78,13 +81,11 @@ import type { SerializedIdCompressorWithNoSession, SerializedIdCompressorWithOngoingSession, } from "@fluidframework/id-compressor/internal"; -import { +import type { ISummaryTreeWithStats, ITelemetryContext, IGarbageCollectionData, CreateChildSummarizerNodeParam, - FlushMode, - FlushModeExperimental, IDataStore, IEnvelope, IFluidDataStoreContextDetached, @@ -93,11 +94,15 @@ import { InboundAttachMessage, NamedFluidDataStoreRegistryEntries, SummarizeInternalFn, + IInboundSignalMessage, + IRuntimeMessagesContent, + ISummarizerNodeWithGC, +} from "@fluidframework/runtime-definitions/internal"; +import { + FlushMode, + FlushModeExperimental, channelsTreeName, gcTreeKey, - IInboundSignalMessage, - type IRuntimeMessagesContent, - type ISummarizerNodeWithGC, } from "@fluidframework/runtime-definitions/internal"; import { GCDataBuilder, @@ -112,19 +117,19 @@ import { seqFromTree, } from "@fluidframework/runtime-utils/internal"; import type { + IEventSampler, IFluidErrorBase, ITelemetryGenericEventExt, + ITelemetryLoggerExt, + MonitoringContext, TelemetryEventPropertyTypeExt, } from "@fluidframework/telemetry-utils/internal"; import { - ITelemetryLoggerExt, DataCorruptionError, DataProcessingError, extractSafePropertiesFromMessage, GenericError, - IEventSampler, LoggingError, - MonitoringContext, PerformanceEvent, // eslint-disable-next-line import/no-deprecated TaggedLoggerAdapter, @@ -565,7 +570,7 @@ export interface IContainerRuntimeOptions { * * These options are not available to consumers when creating a new container runtime, * but we do need to expose them for internal use, e.g. when configuring the container runtime - * to ensure compability with older versions. + * to ensure compatibility with older versions. * * @internal */ @@ -952,7 +957,7 @@ export class ContainerRuntime context: IContainerContext; registryEntries: NamedFluidDataStoreRegistryEntries; existing: boolean; - runtimeOptions?: IContainerRuntimeOptions; // May also include options from IContainerRuntimeOptionsInternal + runtimeOptions?: IContainerRuntimeOptionsInternal; containerScope?: FluidObject; containerRuntimeCtor?: typeof ContainerRuntime; /** @@ -967,7 +972,7 @@ export class ContainerRuntime existing, requestHandler, provideEntryPoint, - runtimeOptions = {} satisfies IContainerRuntimeOptions, + runtimeOptions = {} satisfies IContainerRuntimeOptionsInternal, containerScope = {}, containerRuntimeCtor = ContainerRuntime, } = params; @@ -1552,7 +1557,7 @@ export class ContainerRuntime electedSummarizerData: ISerializedElection | undefined, chunks: [string, string[]][], dataStoreAliasMap: [string, string][], - baseRuntimeOptions: Readonly>, + runtimeOptions: Readonly>, private readonly containerScope: FluidObject, // Create a custom ITelemetryBaseLogger to output telemetry events. public readonly baseLogger: ITelemetryBaseLogger, @@ -1574,7 +1579,7 @@ export class ContainerRuntime // the defaults ...DefaultSummaryConfiguration, // the runtime configuration overrides - ...baseRuntimeOptions.summaryOptions?.summaryConfigOverrides, + ...runtimeOptions.summaryOptions?.summaryConfigOverrides, }, recentBatchInfo?: [number, string][], ) { @@ -1606,11 +1611,6 @@ export class ContainerRuntime const maybeLoaderCompatDetails = context as FluidObject; validateLoaderCompatibility(maybeLoaderCompatDetails.ILayerCompatDetails, this.disposeFn); - // Backfill in defaults for the internal runtimeOptions, since they may not be present on the provided runtimeOptions object - const runtimeOptions = { - flushMode: defaultFlushMode, - ...baseRuntimeOptions, - }; this.mc = createChildMonitoringContext({ logger: this.baseLogger, namespace: "ContainerRuntime", @@ -1883,6 +1883,8 @@ export class ContainerRuntime // what is the interface of passing signals, we need the // downstream stores to wrap the signal. parentContext.submitSignal = (type: string, content: unknown, targetClientId?: string) => { + // Can the `content` argument type be IEnvelope? + // verifyNotClosed is called in FluidDataStoreContext, which is *the* expected caller. const envelope1 = content as IEnvelope; const envelope2 = this.createNewSignalEnvelope( envelope1.address, @@ -2146,7 +2148,7 @@ export class ContainerRuntime summaryFormatVersion: metadata?.summaryFormatVersion, disableIsolatedChannels: metadata?.disableIsolatedChannels, gcVersion: metadata?.gcFeature, - options: JSON.stringify(baseRuntimeOptions), + options: JSON.stringify(runtimeOptions), idCompressorModeMetadata: metadata?.documentSchema?.runtime?.idCompressorMode, idCompressorMode: this.sessionSchema.idCompressorMode, sessionRuntimeSchema: JSON.stringify(this.sessionSchema), diff --git a/packages/runtime/container-runtime/src/dataStoreContext.ts b/packages/runtime/container-runtime/src/dataStoreContext.ts index d3116ca4a135..4083f5b571a4 100644 --- a/packages/runtime/container-runtime/src/dataStoreContext.ts +++ b/packages/runtime/container-runtime/src/dataStoreContext.ts @@ -849,12 +849,6 @@ export abstract class FluidDataStoreContext } } - /** - * Submits the signal to be sent to other clients. - * @param type - Type of the signal. - * @param content - Content of the signal. Should be a JSON serializable object or primitive. - * @param targetClientId - When specified, the signal is only sent to the provided client id. - */ public submitSignal(type: string, content: unknown, targetClientId?: string): void { this.verifyNotClosed("submitSignal"); diff --git a/packages/runtime/runtime-definitions/src/dataStoreContext.ts b/packages/runtime/runtime-definitions/src/dataStoreContext.ts index 4ebcb1d03ec6..5bc50d7a308b 100644 --- a/packages/runtime/runtime-definitions/src/dataStoreContext.ts +++ b/packages/runtime/runtime-definitions/src/dataStoreContext.ts @@ -501,7 +501,8 @@ export interface IFluidParentContext /** * Submits the signal to be sent to other clients. * @param type - Type of the signal. - * @param content - Content of the signal. Should be a JSON serializable object or primitive. + * @param content - Content of the signal. Should be an {@link IEnvelope} with `contents` that is a JSON + * serializable object or primitive. * @param targetClientId - When specified, the signal is only sent to the provided client id. */ submitSignal: (type: string, content: unknown, targetClientId?: string) => void;