Skip to main content
Version: v1

Summarizer Class

Summarizer is responsible for coordinating when to generate and send summaries. It is the main entry point for summary work. It is created only by summarizing container (i.e. one with clientType === "summarizer")

Signature​

export declare class Summarizer extends EventEmitter implements ISummarizer

Extends: EventEmitter

Implements: ISummarizer

Constructors​

ConstructorDescription
(constructor)(url, runtime, configurationGetter, internalsProvider, handleContext, summaryCollection, runCoordinatorCreateFn)Constructs a new instance of the Summarizer class

Static Methods​

MethodReturn TypeDescription
create(loader, url)Promise<ISummarizer>Creates a Summarizer and its underlying client. Note that different implementations of ILoader will handle the URL differently. ILoader provided by a ContainerRuntime is a RelativeLoader, which will treat URL's starting with "/" as relative to the Container. The general ILoader interface will expect an absolute URL and will not handle "/".
stopReasonCanRunLastSummary(stopReason)booleanShould we try to run a last summary for the given stop reason? Currently only allows "parentNotConnected"

Properties​

PropertyTypeDescription
enqueueSummarizeISummarizer["enqueueSummarize"]
handleIFluidHandle<this>
IFluidLoadablethis
ISummarizerthis
summarizeOnDemandISummarizer["summarizeOnDemand"]
summaryCollectionSummaryCollection

Methods​

MethodReturn TypeDescription
close()void
dispose()voidDisposes of resources after running. This cleanup will clear any outstanding timers and reset some of the state properties. Called by ContainerRuntime when it is disposed, as well as at the end the run().
run(onBehalfOf)Promise<SummarizerStopReason>
stop(reason)voidStops the summarizer from running. This will complete the run promise, and also close the container.

Constructor Details​

(constructor)​

Constructs a new instance of the Summarizer class

Signature​

constructor(url: string,
runtime: ISummarizerRuntime, configurationGetter: () => ISummaryConfiguration,
internalsProvider: ISummarizerInternalsProvider, handleContext: IFluidHandleContext, summaryCollection: SummaryCollection, runCoordinatorCreateFn: (runtime: IConnectableRuntime) => Promise<ICancellableSummarizerController>);

Parameters​

ParameterTypeDescription
urlstring
runtimeISummarizerRuntime
configurationGetter() => ISummaryConfiguration
internalsProviderISummarizerInternalsProvider
handleContextIFluidHandleContext
summaryCollectionSummaryCollection
runCoordinatorCreateFn(runtime: IConnectableRuntime) => Promise<ICancellableSummarizerController>

Property Details​

enqueueSummarize​

Signature​

readonly enqueueSummarize: ISummarizer["enqueueSummarize"];

Type: ISummarizer["enqueueSummarize"]

handle​

Signature​

get handle(): IFluidHandle<this>;

Type: IFluidHandle<this>

IFluidLoadable​

Signature​

get IFluidLoadable(): this;

Type: this

ISummarizer​

Signature​

get ISummarizer(): this;

Type: this

summarizeOnDemand​

Signature​

readonly summarizeOnDemand: ISummarizer["summarizeOnDemand"];

Type: ISummarizer["summarizeOnDemand"]

summaryCollection​

Signature​

readonly summaryCollection: SummaryCollection;

Type: SummaryCollection

Method Details​

close​

Signature​

close(): void;

create​

Creates a Summarizer and its underlying client. Note that different implementations of ILoader will handle the URL differently. ILoader provided by a ContainerRuntime is a RelativeLoader, which will treat URL's starting with "/" as relative to the Container. The general ILoader interface will expect an absolute URL and will not handle "/".

Signature​

static create(loader: ILoader, url: string): Promise<ISummarizer>;

Parameters​

ParameterTypeDescription
loaderILoaderthe loader that resolves the request
urlstringthe URL used to resolve the container

Returns​

Return type: Promise<ISummarizer>

dispose​

Disposes of resources after running. This cleanup will clear any outstanding timers and reset some of the state properties. Called by ContainerRuntime when it is disposed, as well as at the end the run().

Signature​

dispose(): void;

run​

Signature​

run(onBehalfOf: string): Promise<SummarizerStopReason>;

Parameters​

ParameterTypeDescription
onBehalfOfstring

Returns​

Return type: Promise<SummarizerStopReason>

stop​

Stops the summarizer from running. This will complete the run promise, and also close the container.

Signature​

stop(reason: SummarizerStopReason): void;

Parameters​

ParameterTypeDescription
reasonSummarizerStopReasonreason code for stopping

stopReasonCanRunLastSummary​

Should we try to run a last summary for the given stop reason? Currently only allows "parentNotConnected"

Signature​

static stopReasonCanRunLastSummary(stopReason: SummarizerStopReason): boolean;

Parameters​

ParameterTypeDescription
stopReasonSummarizerStopReasonSummarizerStopReason

Returns​

  • true if the stop reason can run a last summary

Return type: boolean