Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement(client): misc cleanup #23959

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 47 additions & 45 deletions packages/runtime/container-runtime/src/containerRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,75 @@
* 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,
LazyPromise,
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";
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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;
/**
Expand All @@ -967,7 +972,7 @@ export class ContainerRuntime
existing,
requestHandler,
provideEntryPoint,
runtimeOptions = {} satisfies IContainerRuntimeOptions,
runtimeOptions = {} satisfies IContainerRuntimeOptionsInternal,
containerScope = {},
containerRuntimeCtor = ContainerRuntime,
} = params;
Expand Down Expand Up @@ -1552,7 +1557,7 @@ export class ContainerRuntime
electedSummarizerData: ISerializedElection | undefined,
chunks: [string, string[]][],
dataStoreAliasMap: [string, string][],
baseRuntimeOptions: Readonly<Required<IContainerRuntimeOptions>>,
runtimeOptions: Readonly<Required<IContainerRuntimeOptionsInternal>>,
private readonly containerScope: FluidObject,
// Create a custom ITelemetryBaseLogger to output telemetry events.
public readonly baseLogger: ITelemetryBaseLogger,
Expand All @@ -1574,7 +1579,7 @@ export class ContainerRuntime
// the defaults
...DefaultSummaryConfiguration,
// the runtime configuration overrides
...baseRuntimeOptions.summaryOptions?.summaryConfigOverrides,
...runtimeOptions.summaryOptions?.summaryConfigOverrides,
},
recentBatchInfo?: [number, string][],
) {
Expand Down Expand Up @@ -1606,11 +1611,6 @@ export class ContainerRuntime
const maybeLoaderCompatDetails = context as FluidObject<ILayerCompatDetails>;
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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down
6 changes: 0 additions & 6 deletions packages/runtime/container-runtime/src/dataStoreContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
3 changes: 2 additions & 1 deletion packages/runtime/runtime-definitions/src/dataStoreContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading