Skip to content

Declare ContainerRuntime class as implementing interfaces it already implements #24147

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

Merged
merged 2 commits into from
Apr 17, 2025
Merged
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
4 changes: 4 additions & 0 deletions packages/runtime/container-runtime/src/containerRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ import type {
IInboundSignalMessage,
IRuntimeMessagesContent,
ISummarizerNodeWithGC,
IFluidParentContext,
} from "@fluidframework/runtime-definitions/internal";
import {
FlushMode,
Expand Down Expand Up @@ -166,6 +167,7 @@ import {
IGarbageCollector,
gcGenerationOptionName,
type GarbageCollectionMessage,
type IGarbageCollectionRuntime,
} from "./gc/index.js";
import { InboundBatchAggregator } from "./inboundBatchAggregator.js";
import { RuntimeCompatDetails, validateLoaderCompatibility } from "./layerCompatState.js";
Expand Down Expand Up @@ -712,8 +714,10 @@ export class ContainerRuntime
implements
IContainerRuntime,
IRuntime,
IGarbageCollectionRuntime,
ISummarizerRuntime,
ISummarizerInternalsProvider,
IFluidParentContext,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agarwal-navin or @vladsud do you know why this wasn't here before? It's legacy-alpha so it wasn't about over-exposure.

For your reference, the spot where CR is passed as this interface is this line in its constructor:

const parentContext = wrapContext(this);

Copy link
Contributor

@agarwal-navin agarwal-navin Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IFluidParentContext is ideally for contexts. For example, data store context implements it. ContainerRuntime acts as both the runtime and the context for that layer which makes it cumbersome and it has to implement the properties of IFluidParentContext.

The runtime part (IFluidDataStoreChannel) is handled by ChannelCollection. So, it seems fine that the context part is implemented by the ContainerRuntime directly. I don't know why it doesn't do it already, maybe because the legacy-alpha tagging happened after IFluidParentContext was introduced.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vladsud do you know why? Any concerns telling TypeScript about this link?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI this is reformulated in #24319

IProvideFluidHandleContext,
IProvideLayerCompatDetails
{
Expand Down
2 changes: 2 additions & 0 deletions packages/runtime/container-runtime/src/gc/gcDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ export type GarbageCollectionMessage = ISweepMessage | ITombstoneLoadedMessage;

/**
* Defines the APIs for the runtime object to be passed to the garbage collector.
*
* @internal
*/
export interface IGarbageCollectionRuntime {
/**
Expand Down
1 change: 1 addition & 0 deletions packages/runtime/container-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export {
IGCMetadata,
GCFeatureMatrix,
GCVersion,
IGarbageCollectionRuntime,
IGCRuntimeOptions,
IMarkPhaseStats,
ISweepPhaseStats,
Expand Down
Loading