@fluidframework/container-runtime 2.0.0-dev-rc.3.0.0.254513 → 2.0.0-dev-rc.3.0.0.254866

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2685 +0,0 @@
1
- import { AliasResult } from '@fluidframework/runtime-definitions/internal';
2
- import { AttachState } from '@fluidframework/container-definitions';
3
- import { ContainerWarning } from '@fluidframework/container-definitions/internal';
4
- import { CreateChildSummarizerNodeFn } from '@fluidframework/runtime-definitions/internal';
5
- import { CreateChildSummarizerNodeParam } from '@fluidframework/runtime-definitions/internal';
6
- import { FluidDataStoreRegistryEntry } from '@fluidframework/runtime-definitions/internal';
7
- import { FluidObject } from '@fluidframework/core-interfaces';
8
- import { FlushMode } from '@fluidframework/runtime-definitions/internal';
9
- import { IAudience } from '@fluidframework/container-definitions';
10
- import { IClientDetails } from '@fluidframework/protocol-definitions';
11
- import { IContainerContext } from '@fluidframework/container-definitions/internal';
12
- import { IContainerRuntime } from '@fluidframework/container-runtime-definitions/internal';
13
- import { IContainerRuntimeBase } from '@fluidframework/runtime-definitions/internal';
14
- import { IContainerRuntimeEvents } from '@fluidframework/container-runtime-definitions/internal';
15
- import { ICriticalContainerError } from '@fluidframework/container-definitions';
16
- import { IDataStore } from '@fluidframework/runtime-definitions/internal';
17
- import { IDeltaManager } from '@fluidframework/container-definitions';
18
- import { IDisposable } from '@fluidframework/core-interfaces';
19
- import { IDocumentMessage } from '@fluidframework/protocol-definitions';
20
- import { IDocumentStorageService } from '@fluidframework/driver-definitions/internal';
21
- import { IEnvelope } from '@fluidframework/runtime-definitions/internal';
22
- import { IEvent } from '@fluidframework/core-interfaces';
23
- import { IEventProvider } from '@fluidframework/core-interfaces';
24
- import { IFluidDataStoreChannel } from '@fluidframework/runtime-definitions/internal';
25
- import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions/internal';
26
- import { IFluidDataStoreContextDetached } from '@fluidframework/runtime-definitions/internal';
27
- import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions/internal';
28
- import { IFluidDataStoreRegistry } from '@fluidframework/runtime-definitions/internal';
29
- import { IFluidHandle } from '@fluidframework/core-interfaces';
30
- import { IFluidHandleContext } from '@fluidframework/core-interfaces';
31
- import { IFluidParentContext } from '@fluidframework/runtime-definitions/internal';
32
- import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
33
- import { IGarbageCollectionDetailsBase } from '@fluidframework/runtime-definitions/internal';
34
- import { IGetPendingLocalStateProps } from '@fluidframework/container-definitions/internal';
35
- import type { IIdCompressor } from '@fluidframework/id-compressor';
36
- import type { IIdCompressorCore } from '@fluidframework/id-compressor/internal';
37
- import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
38
- import { IProvideFluidHandleContext } from '@fluidframework/core-interfaces';
39
- import { IQuorumClients } from '@fluidframework/protocol-definitions';
40
- import { IRequest } from '@fluidframework/core-interfaces';
41
- import { IResponse } from '@fluidframework/core-interfaces';
42
- import { IRuntime } from '@fluidframework/container-definitions/internal';
43
- import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
44
- import { ISignalMessage } from '@fluidframework/protocol-definitions';
45
- import { ISnapshotTree } from '@fluidframework/protocol-definitions';
46
- import { ISummarizeResult } from '@fluidframework/runtime-definitions/internal';
47
- import { ISummarizerNodeWithGC } from '@fluidframework/runtime-definitions/internal';
48
- import { ISummaryAck } from '@fluidframework/protocol-definitions';
49
- import { ISummaryContent } from '@fluidframework/protocol-definitions';
50
- import { ISummaryNack } from '@fluidframework/protocol-definitions';
51
- import { ISummaryStats } from '@fluidframework/runtime-definitions';
52
- import { ISummaryTree } from '@fluidframework/protocol-definitions';
53
- import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
54
- import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
55
- import { ITelemetryContext } from '@fluidframework/runtime-definitions';
56
- import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
57
- import { MessageType } from '@fluidframework/protocol-definitions';
58
- import { MonitoringContext } from '@fluidframework/telemetry-utils/internal';
59
- import { NamedFluidDataStoreRegistryEntries } from '@fluidframework/runtime-definitions/internal';
60
- import { SummarizeInternalFn } from '@fluidframework/runtime-definitions/internal';
61
- import { TypedEventEmitter } from '@fluid-internal/client-utils';
62
-
63
- /**
64
- * Legacy ID for the built-in AgentScheduler. To minimize disruption while removing it, retaining this as a
65
- * special-case for document dirty state. Ultimately we should have no special-cases from the
66
- * ContainerRuntime's perspective.
67
- * @internal
68
- */
69
- export declare const agentSchedulerId = "_scheduler";
70
-
71
- /**
72
- * [IRRELEVANT IF throwOnInactiveLoad OPTION NOT SET] True if an inactive object should be returned without erroring
73
- * @internal
74
- */
75
- export declare const AllowInactiveRequestHeaderKey = "allowInactive";
76
-
77
- /** True if a tombstoned object should be returned without erroring
78
- * @alpha
79
- */
80
- export declare const AllowTombstoneRequestHeaderKey = "allowTombstone";
81
-
82
- /**
83
- * This class encapsulates data store handling. Currently it is only used by the container runtime,
84
- * but eventually could be hosted on any channel once we formalize the channel api boundary.
85
- * @internal
86
- */
87
- export declare class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
88
- protected readonly baseSnapshot: ISnapshotTree | undefined;
89
- readonly parentContext: IFluidParentContext;
90
- private readonly gcNodeUpdated;
91
- private readonly isDataStoreDeleted;
92
- private readonly aliasMap;
93
- private readonly pendingAttach;
94
- readonly attachOpFiredForDataStore: Set<string>;
95
- protected readonly mc: MonitoringContext;
96
- private readonly disposeOnce;
97
- readonly entryPoint: IFluidHandle<FluidObject>;
98
- readonly containerLoadStats: {
99
- readonly containerLoadDataStoreCount: number;
100
- readonly referencedDataStoreCount: number;
101
- };
102
- private dataStoresSinceLastGC;
103
- private readonly containerRuntimeHandle;
104
- private readonly pendingAliasMap;
105
- protected readonly contexts: DataStoreContexts;
106
- private readonly aliasedDataStores;
107
- constructor(baseSnapshot: ISnapshotTree | undefined, parentContext: IFluidParentContext, baseLogger: ITelemetryBaseLogger, gcNodeUpdated: (nodePath: string, reason: "Loaded" | "Changed", timestampMs?: number, packagePath?: readonly string[], request?: IRequest, headerData?: RuntimeHeaderData) => void, isDataStoreDeleted: (nodePath: string) => boolean, aliasMap: Map<string, string>, provideEntryPoint: (runtime: ChannelCollection) => Promise<FluidObject>);
108
- get aliases(): ReadonlyMap<string, string>;
109
- get pendingAliases(): Map<string, Promise<AliasResult>>;
110
- waitIfPendingAlias(maybeAlias: string): Promise<AliasResult>;
111
- /** For sampling. Only log once per container */
112
- private shouldSendAttachLog;
113
- protected wrapContextForInnerChannel(id: string): IFluidParentContext;
114
- /**
115
- * IFluidDataStoreChannel.makeVisibleAndAttachGraph implementation
116
- * Not clear when it would be called and what it should do.
117
- * Currently this API is called by context only for root data stores.
118
- */
119
- makeVisibleAndAttachGraph(): void;
120
- private processAttachMessage;
121
- private processAliasMessage;
122
- processAliasMessageCore(internalId: string, alias: string): boolean;
123
- private alreadyProcessed;
124
- /** Package up the context's attach summary etc into an IAttachMessage */
125
- private generateAttachMessage;
126
- /**
127
- * Make the data store locally visible in the container graph by moving the data store context from unbound to
128
- * bound list and submitting the attach message. This data store can now be reached from the root.
129
- * @param id - The id of the data store context to make visible.
130
- */
131
- private makeDataStoreLocallyVisible;
132
- protected submitAttachChannelOp(localContext: LocalFluidDataStoreContext): void;
133
- /**
134
- * Generate compact internal DataStore ID.
135
- *
136
- * A note about namespace and name collisions:
137
- * This code assumes that that's the only way to generate internal IDs, and that it's Ok for this namespace to overlap with
138
- * user-provided alias names namespace.
139
- * There are two scenarios where it could cause trouble:
140
- * 1) Old files, where (already removed) CreateRoot*DataStore*() API was used, and thus internal name of data store
141
- * was provided by user. Such files may experience name collision with future data stores that receive a name generated
142
- * by this function.
143
- * 2) Much less likely, but if it happen that internal ID (generated by this function) is exactly the same as alias name
144
- * that user might use in the future, them ContainerRuntime.getAliasedDataStoreEntryPoint() or
145
- * ContainerRuntime.getDataStoreFromRequest() could return a data store with internalID matching user request, even though
146
- * user expected some other data store (that would receive alias later).
147
- * Please note that above mentioned functions have the implementation they have (allowing #2) due to #1.
148
- */
149
- protected createDataStoreId(): string;
150
- createDetachedDataStore(pkg: Readonly<string[]>, loadingGroupId?: string): IFluidDataStoreContextDetached;
151
- createDataStoreContext(pkg: Readonly<string[]>, props?: any, loadingGroupId?: string): IFluidDataStoreContextInternal;
152
- protected createContext<T extends LocalFluidDataStoreContext>(id: string, pkg: Readonly<string[]>, contextCtor: new (props: ILocalDetachedFluidDataStoreContextProps) => T, createProps?: any, loadingGroupId?: string): T;
153
- get disposed(): boolean;
154
- readonly dispose: () => void;
155
- reSubmit(type: string, content: any, localOpMetadata: unknown): void;
156
- protected reSubmitChannelOp(type: string, content: any, localOpMetadata: unknown): void;
157
- rollback(type: string, content: any, localOpMetadata: unknown): void;
158
- applyStashedOp(content: unknown): Promise<unknown>;
159
- protected applyStashedChannelChannelOp(envelope: IEnvelope): Promise<unknown>;
160
- private applyStashedAttachOp;
161
- process(message: ISequencedDocumentMessage, local: boolean, localMessageMetadata: unknown, addedOutboundReference?: (fromNodePath: string, toNodePath: string) => void): void;
162
- protected processChannelOp(address: string, message: ISequencedDocumentMessage, local: boolean, localMessageMetadata: unknown): void;
163
- getDataStore(id: string, requestHeaderData: RuntimeHeaderData): Promise<IFluidDataStoreContextInternal>;
164
- /**
165
- * Returns the data store requested with the given id if available. Otherwise, returns undefined.
166
- */
167
- getDataStoreIfAvailable(id: string, requestHeaderData: RuntimeHeaderData): Promise<IFluidDataStoreContextInternal | undefined>;
168
- /**
169
- * Checks if the data store has been deleted by GC. If so, log an error.
170
- * @param id - The data store's id.
171
- * @param context - The data store context.
172
- * @param callSite - The function name this is called from.
173
- * @param requestHeaderData - The request header information to log if the data store is deleted.
174
- * @returns true if the data store is deleted. Otherwise, returns false.
175
- */
176
- private checkAndLogIfDeleted;
177
- processSignal(messageArg: IInboundSignalMessage, local: boolean): void;
178
- setConnectionState(connected: boolean, clientId?: string): void;
179
- setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;
180
- get size(): number;
181
- summarize(fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
182
- /**
183
- * Create a summary. Used when attaching or serializing a detached container.
184
- */
185
- getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
186
- /**
187
- * Before GC runs, called by the garbage collector to update any pending GC state.
188
- * The garbage collector needs to know all outbound references that are added. Since root data stores are not
189
- * explicitly marked as referenced, notify GC of new root data stores that were added since the last GC run.
190
- */
191
- updateStateBeforeGC(): Promise<void>;
192
- /**
193
- * Generates data used for garbage collection. It does the following:
194
- *
195
- * 1. Calls into each child data store context to get its GC data.
196
- *
197
- * 2. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be
198
- * identified as belonging to the child.
199
- *
200
- * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent
201
- * the GC data of this channel.
202
- *
203
- * @param fullGC - true to bypass optimizations and force full generation of GC data.
204
- */
205
- getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
206
- /**
207
- * After GC has run, called to notify this Container's data stores of routes that are used in it.
208
- * @param usedRoutes - The routes that are used in all data stores in this Container.
209
- */
210
- updateUsedRoutes(usedRoutes: readonly string[]): void;
211
- deleteChild(dataStoreId: string): void;
212
- /**
213
- * Delete data stores and its objects that are sweep ready.
214
- * @param sweepReadyDataStoreRoutes - The routes of data stores and its objects that are sweep ready and should
215
- * be deleted.
216
- * @returns The routes of data stores and its objects that were deleted.
217
- */
218
- deleteSweepReadyNodes(sweepReadyDataStoreRoutes: readonly string[]): readonly string[];
219
- /**
220
- * This is called to update objects whose routes are tombstones.
221
- *
222
- * A Tombstoned object has been unreferenced long enough that GC knows it won't be referenced again.
223
- * Tombstoned objects are eventually deleted by GC.
224
- *
225
- * @param tombstonedRoutes - The routes that are tombstones in all data stores in this Container.
226
- */
227
- updateTombstonedRoutes(tombstonedRoutes: readonly string[]): void;
228
- /**
229
- * Returns the outbound routes of this channel. Only root data stores are considered referenced and their paths are
230
- * part of outbound routes.
231
- */
232
- private getOutboundRoutes;
233
- /**
234
- * Called by GC to retrieve the package path of a data store node with the given path.
235
- */
236
- getDataStorePackagePath(nodePath: string): Promise<readonly string[] | undefined>;
237
- /**
238
- * Called by GC to determine if a node is for a data store or for an object within a data store (for e.g. DDS).
239
- * @returns the GC node type if the node belongs to a data store or object within data store, undefined otherwise.
240
- */
241
- getGCNodeType(nodePath: string): GCNodeType | undefined;
242
- internalId(maybeAlias: string): string;
243
- request(request: IRequest): Promise<IResponse>;
244
- }
245
-
246
- /** @internal */
247
- export declare class ChannelCollectionFactory<T extends ChannelCollection = ChannelCollection> implements IFluidDataStoreFactory {
248
- private readonly provideEntryPoint;
249
- private readonly ctor;
250
- readonly type = "ChannelCollectionChannel";
251
- IFluidDataStoreRegistry: IFluidDataStoreRegistry;
252
- constructor(registryEntries: NamedFluidDataStoreRegistryEntries, provideEntryPoint: (runtime: IFluidDataStoreChannel) => Promise<FluidObject>, ctor: (...args: ConstructorParameters<typeof ChannelCollection>) => T);
253
- get IFluidDataStoreFactory(): this;
254
- instantiateDataStore(context: IFluidDataStoreContext, _existing: boolean): Promise<IFluidDataStoreChannel>;
255
- }
256
-
257
- /**
258
- * How should an older client handle an unrecognized remote op type?
259
- *
260
- * @internal
261
- */
262
- export declare type CompatModeBehavior =
263
- /** Ignore the op. It won't be persisted if this client summarizes */
264
- "Ignore"
265
- /** Fail processing immediately. (The container will close) */
266
- | "FailToProcess";
267
-
268
- /**
269
- * Available compression algorithms for op compression.
270
- * @alpha
271
- */
272
- export declare enum CompressionAlgorithms {
273
- lz4 = "lz4"
274
- }
275
-
276
- /**
277
- * @alpha
278
- */
279
- export declare enum ContainerMessageType {
280
- FluidDataStoreOp = "component",
281
- Attach = "attach",
282
- ChunkedOp = "chunkedOp",
283
- BlobAttach = "blobAttach",
284
- Rejoin = "rejoin",
285
- Alias = "alias",
286
- /**
287
- * An op containing an IdRange of Ids allocated using the runtime's IdCompressor since
288
- * the last allocation op was sent.
289
- * See the [IdCompressor README](./id-compressor/README.md) for more details.
290
- */
291
- IdAllocation = "idAllocation",
292
- /**
293
- * An op that changes document schema
294
- */
295
- DocumentSchemaChange = "schema",
296
- /**
297
- * Garbage collection specific op. This is sent by the summarizer client when GC runs. It's used to synchronize GC
298
- * state across all clients.
299
- */
300
- GC = "GC"
301
- }
302
-
303
- /**
304
- * Represents the runtime of the container. Contains helper functions/state of the container.
305
- * It will define the store level mappings.
306
- * @alpha
307
- */
308
- export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntimeEvents & ISummarizerEvents> implements IContainerRuntime, IRuntime, ISummarizerRuntime, ISummarizerInternalsProvider, IProvideFluidHandleContext {
309
- private readonly registry;
310
- private readonly metadata;
311
- private readonly runtimeOptions;
312
- private readonly containerScope;
313
- readonly logger: ITelemetryLoggerExt;
314
- private readonly _storage;
315
- private readonly createIdCompressor;
316
- private readonly documentsSchemaController;
317
- private readonly requestHandler?;
318
- private readonly summaryConfiguration;
319
- /**
320
- * Load the stores from a snapshot and returns the runtime.
321
- * @param params - An object housing the runtime properties:
322
- * - context - Context of the container.
323
- * - registryEntries - Mapping from data store types to their corresponding factories.
324
- * - existing - Pass 'true' if loading from an existing snapshot.
325
- * - requestHandler - (optional) Request handler for the request() method of the container runtime.
326
- * Only relevant for back-compat while we remove the request() method and move fully to entryPoint as the main pattern.
327
- * - runtimeOptions - Additional options to be passed to the runtime
328
- * - containerScope - runtime services provided with context
329
- * - containerRuntimeCtor - Constructor to use to create the ContainerRuntime instance.
330
- * This allows mixin classes to leverage this method to define their own async initializer.
331
- * - provideEntryPoint - Promise that resolves to an object which will act as entryPoint for the Container.
332
- * This object should provide all the functionality that the Container is expected to provide to the loader layer.
333
- */
334
- static loadRuntime(params: {
335
- context: IContainerContext;
336
- registryEntries: NamedFluidDataStoreRegistryEntries;
337
- existing: boolean;
338
- runtimeOptions?: IContainerRuntimeOptions;
339
- containerScope?: FluidObject;
340
- containerRuntimeCtor?: typeof ContainerRuntime;
341
- /** @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md */
342
- requestHandler?: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
343
- provideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>;
344
- }): Promise<ContainerRuntime>;
345
- readonly options: Record<string | number, any>;
346
- private imminentClosure;
347
- private readonly _getClientId;
348
- get clientId(): string | undefined;
349
- readonly clientDetails: IClientDetails;
350
- get storage(): IDocumentStorageService;
351
- get containerRuntime(): this;
352
- private readonly submitFn;
353
- /**
354
- * Although current IContainerContext guarantees submitBatchFn, it is not available on older loaders.
355
- */
356
- private readonly submitBatchFn;
357
- private readonly submitSummaryFn;
358
- private readonly submitSignalFn;
359
- readonly disposeFn: (error?: ICriticalContainerError) => void;
360
- readonly closeFn: (error?: ICriticalContainerError) => void;
361
- get flushMode(): FlushMode;
362
- get scope(): FluidObject;
363
- get IFluidDataStoreRegistry(): IFluidDataStoreRegistry;
364
- private readonly _getAttachState;
365
- get attachState(): AttachState;
366
- get documentSchema(): {
367
- explicitSchemaControl?: true | undefined;
368
- compressionLz4?: true | undefined;
369
- idCompressorMode?: IdCompressorMode;
370
- opGroupingEnabled?: true | undefined;
371
- disallowedVersions?: string[] | undefined;
372
- };
373
- private _idCompressor;
374
- private pendingIdCompressorOps;
375
- private readonly skipSavedCompressorOps;
376
- get idCompressorMode(): IdCompressorMode;
377
- /**
378
- * See IContainerRuntimeBase.idCompressor() for details.
379
- */
380
- get idCompressor(): (IIdCompressor & IIdCompressorCore) | undefined;
381
- /**
382
- * True if we have ID compressor loading in-flight (async operation). Useful only for
383
- * this.idCompressorMode === "delayed" mode
384
- */
385
- protected _loadIdCompressor: Promise<void> | undefined;
386
- /**
387
- * See IContainerRuntimeBase.generateDocumentUniqueId() for details.
388
- */
389
- generateDocumentUniqueId(): string | (number & {
390
- readonly SessionUnique: "cea55054-6b82-4cbf-ad19-1fa645ea3b3e";
391
- } & {
392
- readonly OpNormalized: "9209432d-a959-4df7-b2ad-767ead4dbcae";
393
- });
394
- get IFluidHandleContext(): IFluidHandleContext;
395
- private readonly handleContext;
396
- /**
397
- * This is a proxy to the delta manager provided by the container context (innerDeltaManager). It restricts certain
398
- * accesses such as sets "read-only" mode for the summarizer client. This is the default delta manager that should
399
- * be used unless the innerDeltaManager is required.
400
- */
401
- readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
402
- /**
403
- * The delta manager provided by the container context. By default, using the default delta manager (proxy)
404
- * should be sufficient. This should be used only if necessary. For example, for validating and propagating connected
405
- * events which requires access to the actual real only info, this is needed.
406
- */
407
- private readonly innerDeltaManager;
408
- private readonly mc;
409
- private readonly summarizerClientElection?;
410
- /**
411
- * summaryManager will only be created if this client is permitted to spawn a summarizing client
412
- * It is created only by interactive client, i.e. summarizer client, as well as non-interactive bots
413
- * do not create it (see SummarizerClientElection.clientDetailsPermitElection() for details)
414
- */
415
- private readonly summaryManager?;
416
- private readonly summaryCollection;
417
- private readonly summarizerNode;
418
- private readonly maxConsecutiveReconnects;
419
- private readonly defaultMaxConsecutiveReconnects;
420
- private _orderSequentiallyCalls;
421
- private readonly _flushMode;
422
- private flushTaskExists;
423
- private _connected;
424
- private consecutiveReconnects;
425
- /**
426
- * Used to delay transition to "connected" state while we upload
427
- * attachment blobs that were added while disconnected
428
- */
429
- private delayConnectClientId?;
430
- private ensureNoDataModelChangesCalls;
431
- /**
432
- * Tracks the number of detected reentrant ops to report,
433
- * in order to self-throttle the telemetry events.
434
- *
435
- * This should be removed as part of ADO:2322
436
- */
437
- private opReentryCallsToReport;
438
- /**
439
- * Invokes the given callback and expects that no ops are submitted
440
- * until execution finishes. If an op is submitted, an error will be raised.
441
- *
442
- * Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`
443
- *
444
- * @param callback - the callback to be invoked
445
- */
446
- ensureNoDataModelChanges<T>(callback: () => T): T;
447
- get connected(): boolean;
448
- /** clientId of parent (non-summarizing) container that owns summarizer container */
449
- get summarizerClientId(): string | undefined;
450
- private _disposed;
451
- get disposed(): boolean;
452
- private dirtyContainer;
453
- private emitDirtyDocumentEvent;
454
- private readonly enableOpReentryCheck;
455
- private readonly disableAttachReorder;
456
- private readonly closeSummarizerDelayMs;
457
- /**
458
- * If true, summary generated is validate before uploading it to the server. With single commit summaries,
459
- * summaries will be accepted once uploaded, so they should be validated before upload. However, this can
460
- * currently be controlled via a feature flag as its a new functionality.
461
- */
462
- private readonly validateSummaryBeforeUpload;
463
- private readonly defaultTelemetrySignalSampleCount;
464
- private readonly _perfSignalData;
465
- /**
466
- * Summarizer is responsible for coordinating when to send generate and send summaries.
467
- * It is the main entry point for summary work.
468
- * It is created only by summarizing container (i.e. one with clientType === "summarizer")
469
- */
470
- private readonly _summarizer?;
471
- private readonly scheduleManager;
472
- private readonly blobManager;
473
- private readonly pendingStateManager;
474
- private readonly outbox;
475
- private readonly garbageCollector;
476
- private readonly channelCollection;
477
- private readonly remoteMessageProcessor;
478
- /** The last message processed at the time of the last summary. */
479
- private messageAtLastSummary;
480
- private get summarizer();
481
- private readonly summariesDisabled;
482
- private isSummariesDisabled;
483
- private readonly maxOpsSinceLastSummary;
484
- private getMaxOpsSinceLastSummary;
485
- private readonly initialSummarizerDelayMs;
486
- private getInitialSummarizerDelayMs;
487
- private readonly createContainerMetadata;
488
- /**
489
- * The summary number of the next summary that will be generated for this container. This is incremented every time
490
- * a summary is generated.
491
- */
492
- private nextSummaryNumber;
493
- /** If false, loading or using a Tombstoned object should merely log, not fail */
494
- get gcTombstoneEnforcementAllowed(): boolean;
495
- /** If true, throw an error when a tombstone data store is used. */
496
- get gcThrowOnTombstoneUsage(): boolean;
497
- /**
498
- * GUID to identify a document in telemetry
499
- * ! Note: should not be used for anything other than telemetry and is not considered a stable GUID
500
- */
501
- private readonly telemetryDocumentId;
502
- /**
503
- * Whether this client is the summarizer client itself (type is summarizerClientType)
504
- */
505
- private readonly isSummarizerClient;
506
- /**
507
- * The id of the version used to initially load this runtime, or undefined if it's newly created.
508
- */
509
- private readonly loadedFromVersionId;
510
- /**
511
- * It a cache for holding mapping for loading groupIds with its snapshot from the service. Add expiry policy of 1 minute.
512
- * Starting with 1 min and based on recorded usage we can tweak it later on.
513
- */
514
- private readonly snapshotCacheForLoadingGroupIds;
515
- /***/
516
- protected constructor(context: IContainerContext, registry: IFluidDataStoreRegistry, metadata: IContainerRuntimeMetadata | undefined, electedSummarizerData: ISerializedElection | undefined, chunks: [string, string[]][], dataStoreAliasMap: [string, string][], runtimeOptions: Readonly<Required<IContainerRuntimeOptions>>, containerScope: FluidObject, logger: ITelemetryLoggerExt, existing: boolean, blobManagerSnapshot: IBlobManagerLoadInfo, _storage: IDocumentStorageService, createIdCompressor: () => Promise<IIdCompressor & IIdCompressorCore>, documentsSchemaController: DocumentsSchemaController, featureGatesForTelemetry: Record<string, boolean | number | undefined>, provideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>, requestHandler?: ((request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>) | undefined, summaryConfiguration?: ISummaryConfiguration);
517
- onSchemaChange(schema: IDocumentSchemaCurrent): void;
518
- getCreateChildSummarizerNodeFn(id: string, createParam: CreateChildSummarizerNodeParam): (summarizeInternal: SummarizeInternalFn, getGCDataFn: (fullGC?: boolean) => Promise<IGarbageCollectionData>) => ISummarizerNodeWithGC;
519
- deleteChildSummarizerNode(id: string): void;
520
- makeLocallyVisible(): void;
521
- setChannelDirty(address: string): void;
522
- /**
523
- * Initializes the state from the base snapshot this container runtime loaded from.
524
- */
525
- private initializeBaseState;
526
- dispose(error?: Error): void;
527
- /**
528
- * Api to fetch the snapshot from the service for a loadingGroupIds.
529
- * @param loadingGroupIds - LoadingGroupId for which the snapshot is asked for.
530
- * @param pathParts - Parts of the path, which we want to extract from the snapshot tree.
531
- * @returns - snapshotTree and the sequence number of the snapshot.
532
- */
533
- getSnapshotForLoadingGroupId(loadingGroupIds: string[], pathParts: string[]): Promise<{
534
- snapshotTree: ISnapshotTree;
535
- sequenceNumber: number;
536
- }>;
537
- /**
538
- * Api to find a snapshot tree inside a bigger snapshot tree based on the path in the pathParts array.
539
- * @param snapshotTree - snapshot tree to look into.
540
- * @param pathParts - Part of the path, which we want to extract from the snapshot tree.
541
- * @param hasIsolatedChannels - whether the channels are present inside ".channels" subtree. Older
542
- * snapshots will not have trees inside ".channels", so check that.
543
- * @returns - requested snapshot tree based on the path parts.
544
- */
545
- private getSnapshotTreeForPath;
546
- /**
547
- * Notifies this object about the request made to the container.
548
- * @param request - Request made to the handler.
549
- * @deprecated Will be removed in future major release. This method needs to stay private until LTS version of Loader moves to "2.0.0-internal.7.0.0".
550
- */
551
- private request;
552
- /**
553
- * Resolves URI representing handle
554
- * @param request - Request made to the handler.
555
- */
556
- resolveHandle(request: IRequest): Promise<IResponse>;
557
- /**
558
- * {@inheritDoc @fluidframework/container-definitions#IRuntime.getEntryPoint}
559
- */
560
- getEntryPoint(): Promise<FluidObject>;
561
- private readonly entryPoint;
562
- private internalId;
563
- /** Adds the container's metadata to the given summary tree. */
564
- private addMetadataToSummary;
565
- protected addContainerStateToSummary(summaryTree: ISummaryTreeWithStats, fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext): void;
566
- private shouldContinueReconnecting;
567
- private resetReconnectCount;
568
- private replayPendingStates;
569
- /**
570
- * Parse an op's type and actual content from given serialized content
571
- * ! Note: this format needs to be in-line with what is set in the "ContainerRuntime.submit(...)" method
572
- */
573
- private parseLocalOpContent;
574
- private applyStashedOp;
575
- private loadIdCompressor;
576
- setConnectionState(connected: boolean, clientId?: string): void;
577
- private setConnectionStateCore;
578
- notifyOpReplay(message: ISequencedDocumentMessage): Promise<void>;
579
- process(messageArg: ISequencedDocumentMessage, local: boolean): void;
580
- private _processedClientSequenceNumber;
581
- /**
582
- * Direct the message to the correct subsystem for processing, and implement other side effects
583
- */
584
- private processCore;
585
- /**
586
- * Assuming the given message is also a TypedContainerRuntimeMessage,
587
- * checks its type and dispatches the message to the appropriate handler in the runtime.
588
- * Throws a DataProcessingError if the message looks like but doesn't conform to a known TypedContainerRuntimeMessage type.
589
- */
590
- private validateAndProcessRuntimeMessage;
591
- /**
592
- * Emits the Signal event and update the perf signal data.
593
- * @param clientSignalSequenceNumber - is the client signal sequence number to be uploaded.
594
- */
595
- private sendSignalTelemetryEvent;
596
- processSignal(message: ISignalMessage, local: boolean): void;
597
- /**
598
- * Flush the pending ops manually.
599
- * This method is expected to be called at the end of a batch.
600
- */
601
- private flush;
602
- /**
603
- * {@inheritDoc @fluidframework/runtime-definitions#IContainerRuntimeBase.orderSequentially}
604
- */
605
- orderSequentially<T>(callback: () => T): T;
606
- /**
607
- * Returns the aliased data store's entryPoint, given the alias.
608
- * @param alias - The alias for the data store.
609
- * @returns The data store's entry point ({@link @fluidframework/core-interfaces#IFluidHandle}) if it exists and is aliased.
610
- * Returns undefined if no data store has been assigned the given alias.
611
- */
612
- getAliasedDataStoreEntryPoint(alias: string): Promise<IFluidHandle<FluidObject> | undefined>;
613
- createDetachedDataStore(pkg: Readonly<string[]>, loadingGroupId?: string): IFluidDataStoreContextDetached;
614
- createDataStore(pkg: Readonly<string | string[]>, loadingGroupId?: string): Promise<IDataStore>;
615
- /**
616
- * @deprecated 0.16 Issue #1537, #3631
617
- */
618
- _createDataStoreWithProps(pkg: Readonly<string | string[]>, props?: any): Promise<IDataStore>;
619
- private canSendOps;
620
- /**
621
- * Are we in the middle of batching ops together?
622
- */
623
- private currentlyBatching;
624
- private readonly _quorum;
625
- getQuorum(): IQuorumClients;
626
- private readonly _audience;
627
- getAudience(): IAudience;
628
- /**
629
- * Returns true of container is dirty, i.e. there are some pending local changes that
630
- * either were not sent out to delta stream or were not yet acknowledged.
631
- */
632
- get isDirty(): boolean;
633
- private isContainerMessageDirtyable;
634
- private createNewSignalEnvelope;
635
- /**
636
- * Submits the signal to be sent to other clients.
637
- * @param type - Type of the signal.
638
- * @param content - Content of the signal. Should be a JSON serializable object or primitive.
639
- * @param targetClientId - When specified, the signal is only sent to the provided client id.
640
- */
641
- submitSignal(type: string, content: unknown, targetClientId?: string): void;
642
- setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;
643
- /**
644
- * Create a summary. Used when attaching or serializing a detached container.
645
- *
646
- * @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported
647
- * using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the
648
- * new storage IDs so requests can be redirected.
649
- * @param telemetryContext - summary data passed through the layers for telemetry purposes
650
- */
651
- createSummary(blobRedirectTable?: Map<string, string>, telemetryContext?: ITelemetryContext): ISummaryTree;
652
- readonly getAbsoluteUrl: (relativeUrl: string) => Promise<string | undefined>;
653
- private summarizeInternal;
654
- /**
655
- * Returns a summary of the runtime at the current sequence number.
656
- */
657
- summarize(options: {
658
- /** True to generate the full tree with no handle reuse optimizations; defaults to false */
659
- fullTree?: boolean;
660
- /** True to track the state for this summary in the SummarizerNodes; defaults to true */
661
- trackState?: boolean;
662
- /** Logger to use for correlated summary events */
663
- summaryLogger?: ITelemetryLoggerExt;
664
- /** True to run garbage collection before summarizing; defaults to true */
665
- runGC?: boolean;
666
- /** True to generate full GC data */
667
- fullGC?: boolean;
668
- /** True to run GC sweep phase after the mark phase */
669
- runSweep?: boolean;
670
- }): Promise<ISummaryTreeWithStats>;
671
- /**
672
- * Before GC runs, called by the garbage collector to update any pending GC state. This is mainly used to notify
673
- * the garbage collector of references detected since the last GC run. Most references are notified immediately
674
- * but there can be some for which async operation is required (such as detecting new root data stores).
675
- * @see IGarbageCollectionRuntime.updateStateBeforeGC
676
- */
677
- updateStateBeforeGC(): Promise<void>;
678
- private getGCDataInternal;
679
- /**
680
- * Generates and returns the GC data for this container.
681
- * @param fullGC - true to bypass optimizations and force full generation of GC data.
682
- * @see IGarbageCollectionRuntime.getGCData
683
- */
684
- getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
685
- /**
686
- * After GC has run, called to notify this container's nodes of routes that are used in it.
687
- * @param usedRoutes - The routes that are used in all nodes in this Container.
688
- * @see IGarbageCollectionRuntime.updateUsedRoutes
689
- */
690
- updateUsedRoutes(usedRoutes: readonly string[]): void;
691
- /**
692
- * After GC has run and identified nodes that are sweep ready, this is called to delete the sweep ready nodes.
693
- * @param sweepReadyRoutes - The routes of nodes that are sweep ready and should be deleted.
694
- * @returns The routes of nodes that were deleted.
695
- */
696
- deleteSweepReadyNodes(sweepReadyRoutes: readonly string[]): readonly string[];
697
- /**
698
- * This is called to update objects that are tombstones.
699
- *
700
- * A Tombstoned object has been unreferenced long enough that GC knows it won't be referenced again.
701
- * Tombstoned objects are eventually deleted by GC.
702
- *
703
- * @param tombstonedRoutes - Data store and attachment blob routes that are tombstones in this Container.
704
- */
705
- updateTombstonedRoutes(tombstonedRoutes: readonly string[]): void;
706
- /**
707
- * Returns a server generated referenced timestamp to be used to track unreferenced nodes by GC.
708
- */
709
- getCurrentReferenceTimestampMs(): number | undefined;
710
- /**
711
- * Returns the type of the GC node. Currently, there are nodes that belong to the root ("/"), data stores or
712
- * blob manager.
713
- */
714
- getNodeType(nodePath: string): GCNodeType;
715
- /**
716
- * Called by GC to retrieve the package path of the node with the given path. The node should belong to a
717
- * data store or an attachment blob.
718
- */
719
- getGCNodePackagePath(nodePath: string): Promise<readonly string[] | undefined>;
720
- /**
721
- * Returns whether a given path is for attachment blobs that are in the format - "/BlobManager.basePath/...".
722
- */
723
- private isBlobPath;
724
- /**
725
- * From a given list of routes, separate and return routes that belong to blob manager and data stores.
726
- * @param routes - A list of routes that can belong to data stores or blob manager.
727
- * @returns Two route lists - One that contains routes for blob manager and another one that contains routes
728
- * for data stores.
729
- */
730
- private getDataStoreAndBlobManagerRoutes;
731
- /**
732
- * Runs garbage collection and updates the reference / used state of the nodes in the container.
733
- * @returns the statistics of the garbage collection run; undefined if GC did not run.
734
- */
735
- collectGarbage(options: {
736
- /** Logger to use for logging GC events */
737
- logger?: ITelemetryLoggerExt;
738
- /** True to run GC sweep phase after the mark phase */
739
- runSweep?: boolean;
740
- /** True to generate full GC data */
741
- fullGC?: boolean;
742
- }, telemetryContext?: ITelemetryContext): Promise<IGCStats | undefined>;
743
- /**
744
- * Called when a new outbound reference is added to another node. This is used by garbage collection to identify
745
- * all references added in the system.
746
- * @param srcHandle - The handle of the node that added the reference.
747
- * @param outboundHandle - The handle of the outbound node that is referenced.
748
- */
749
- addedGCOutboundReference(srcHandle: {
750
- absolutePath: string;
751
- }, outboundHandle: {
752
- absolutePath: string;
753
- }): void;
754
- /**
755
- * Generates the summary tree, uploads it to storage, and then submits the summarize op.
756
- * This is intended to be called by the summarizer, since it is the implementation of
757
- * ISummarizerInternalsProvider.submitSummary.
758
- * It takes care of state management at the container level, including pausing inbound
759
- * op processing, updating SummarizerNode state tracking, and garbage collection.
760
- * @param options - options controlling how the summary is generated or submitted
761
- */
762
- submitSummary(options: ISubmitSummaryOptions): Promise<SubmitSummaryResult>;
763
- /**
764
- * This helper is called during summarization. If the container is dirty, it will return a failed summarize result
765
- * (IBaseSummarizeResult) unless this is the final summarize attempt and SkipFailingIncorrectSummary option is set.
766
- * @param logger - The logger to be used for sending telemetry.
767
- * @param referenceSequenceNumber - The reference sequence number of the summary attempt.
768
- * @param minimumSequenceNumber - The minimum sequence number of the summary attempt.
769
- * @param finalAttempt - Whether this is the final summary attempt.
770
- * @param beforeSummaryGeneration - Whether this is called before summary generation or after.
771
- * @returns failed summarize result (IBaseSummarizeResult) if summary should be failed, undefined otherwise.
772
- */
773
- private shouldFailSummaryOnPendingOps;
774
- private get pendingMessagesCount();
775
- private hasPendingMessages;
776
- private updateDocumentDirtyState;
777
- submitMessage(type: ContainerMessageType.FluidDataStoreOp | ContainerMessageType.Alias | ContainerMessageType.Attach, contents: any, localOpMetadata?: unknown): void;
778
- uploadBlob(blob: ArrayBufferLike, signal?: AbortSignal): Promise<IFluidHandle<ArrayBufferLike>>;
779
- private submitIdAllocationOpIfNeeded;
780
- private submit;
781
- private scheduleFlush;
782
- private submitSummaryMessage;
783
- /**
784
- * Throw an error if the runtime is closed. Methods that are expected to potentially
785
- * be called after dispose due to asynchrony should not call this.
786
- */
787
- private verifyNotClosed;
788
- private verifyCanSubmitOps;
789
- private reSubmitBatch;
790
- private reSubmit;
791
- /**
792
- * Finds the right store and asks it to resubmit the message. This typically happens when we
793
- * reconnect and there are pending messages.
794
- * ! Note: successfully resubmitting an op that has been successfully sequenced is not possible due to checks in the ConnectionStateHandler (Loader layer)
795
- * @param message - The original LocalContainerRuntimeMessage.
796
- * @param localOpMetadata - The local metadata associated with the original message.
797
- */
798
- private reSubmitCore;
799
- private rollback;
800
- /** Implementation of ISummarizerInternalsProvider.refreshLatestSummaryAck */
801
- refreshLatestSummaryAck(options: IRefreshSummaryAckOptions): Promise<void>;
802
- /**
803
- * Fetches the latest snapshot from storage to refresh the cache as a performance optimization and closes the
804
- * summarizer to reload from new state.
805
- * @param summaryLogger - logger to use when fetching snapshot from storage
806
- * @returns a generic summarization error
807
- */
808
- private prefetchLatestSummaryThenClose;
809
- private closeStaleSummarizer;
810
- /**
811
- * Downloads the latest snapshot from storage.
812
- * By default, it also closes the container after downloading the snapshot. However, this may be
813
- * overridden via options.
814
- */
815
- private fetchLatestSnapshotFromStorage;
816
- getPendingLocalState(props?: IGetPendingLocalStateProps): unknown;
817
- summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults;
818
- enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult;
819
- /**
820
- * Forms a function that will create and retrieve a Summarizer.
821
- */
822
- private formCreateSummarizerFn;
823
- private validateSummaryHeuristicConfiguration;
824
- private get groupedBatchingEnabled();
825
- }
826
-
827
- /**
828
- * The unpacked runtime message / details to be handled or dispatched by the ContainerRuntime
829
- *
830
- * IMPORTANT: when creating one to be serialized, set the properties in the order they appear here.
831
- * This way stringified values can be compared.
832
- *
833
- * @deprecated this is an internal type which should not be used outside of the package.
834
- * Internally, it is superseded by `TypedContainerRuntimeMessage`.
835
- *
836
- * @internal
837
- */
838
- export declare interface ContainerRuntimeMessage {
839
- /** Type of the op, within the ContainerRuntime's domain */
840
- type: ContainerMessageType;
841
- /** Domain-specific contents, interpreted according to the type */
842
- contents: any;
843
- /** Info describing how to handle this op in case the type is unrecognized (default: fail to process) */
844
- compatDetails?: IContainerRuntimeMessageCompatDetails;
845
- }
846
-
847
- /**
848
- * Current version known properties that define document schema
849
- * This must be bumped whenever the format of document schema or protocol for changing the current document schema changes.
850
- * Ex: adding a new configuration property (under IDocumentSchema.runtime) does not require changing this version.
851
- * Ex: Changing the 'document schema acceptance' mechanism from convert-and-swap to one requiring consensus does require changing this version.
852
- * @alpha
853
- */
854
- export declare const currentDocumentVersionSchema = 1;
855
-
856
- /** @internal */
857
- export declare class DataStoreContexts implements Iterable<[string, FluidDataStoreContext]>, IDisposable {
858
- private readonly notBoundContexts;
859
- /** Attached and loaded context proxies */
860
- private readonly _contexts;
861
- /**
862
- * List of pending context waiting either to be bound or to arrive from another client.
863
- * This covers the case where a local context has been created but not yet bound,
864
- * or the case where a client knows a store will exist and is waiting on its creation,
865
- * so that a caller may await the deferred's promise until such a time as the context is fully ready.
866
- * This is a superset of _contexts, since contexts remain here once the Deferred resolves.
867
- */
868
- private readonly deferredContexts;
869
- private readonly disposeOnce;
870
- private readonly _logger;
871
- constructor(baseLogger: ITelemetryBaseLogger);
872
- [Symbol.iterator](): Iterator<[string, FluidDataStoreContext]>;
873
- get size(): number;
874
- get disposed(): boolean;
875
- readonly dispose: () => void;
876
- notBoundLength(): number;
877
- isNotBound(id: string): boolean;
878
- has(id: string): boolean;
879
- get(id: string): FluidDataStoreContext | undefined;
880
- delete(id: string): boolean;
881
- /**
882
- * Return the unbound local context with the given id,
883
- * or undefined if it's not found or not unbound.
884
- */
885
- getUnbound(id: string): LocalFluidDataStoreContext | undefined;
886
- /**
887
- * Add the given context, marking it as to-be-bound
888
- */
889
- addUnbound(context: LocalFluidDataStoreContext): void;
890
- /**
891
- * Get the context with the given id, once it exists locally and is attached.
892
- * e.g. If created locally, it must be bound, or if created remotely then it's fine as soon as it's sync'd in.
893
- * @param id - The id of the context to get
894
- * @param wait - If false, return undefined if the context isn't present and ready now. Otherwise, wait for it.
895
- */
896
- getBoundOrRemoted(id: string, wait: boolean): Promise<FluidDataStoreContext | undefined>;
897
- private ensureDeferred;
898
- /**
899
- * Update this context as bound
900
- */
901
- bind(id: string): void;
902
- /**
903
- * Triggers the deferred to resolve, indicating the context is not local-only
904
- * @param id - The id of the context to resolve to
905
- */
906
- private resolveDeferred;
907
- /**
908
- * Add the given context, marking it as not local-only.
909
- * This could be because it's a local context that's been bound, or because it's a remote context.
910
- * @param context - The context to add
911
- */
912
- addBoundOrRemoted(context: FluidDataStoreContext): void;
913
- }
914
-
915
- /**
916
- * @alpha
917
- */
918
- export declare const DefaultSummaryConfiguration: ISummaryConfiguration;
919
-
920
- /**
921
- * Traverse this op's contents and detect any outbound routes that were added by this op.
922
- *
923
- * @internal
924
- */
925
- export declare function detectOutboundReferences(address: string, contents: unknown, addedOutboundReference: (fromNodePath: string, toNodePath: string) => void): void;
926
-
927
- /** @alpha */
928
- export declare const disabledCompressionConfig: ICompressionRuntimeOptions;
929
-
930
- /**
931
- * Descripe allowed type for properties in document schema.
932
- * Please note that for all property types we should use undefined to indicate that particular capability is off.
933
- * Using false, or some string value (like "off") will result in clients who do not understand that property failing, whereas
934
- * we want them to continue to collaborate alongside clients who support that capability, but such capability is shipping dark for now.
935
- * @alpha
936
- */
937
- export declare type DocumentSchemaValueType = string | string[] | true | number | undefined;
938
-
939
- /**
940
- * Controller of document schema.
941
- *
942
- * Recommended pre-reading: https://github.com/microsoft/FluidFramework/blob/main/packages/dds/SchemaVersioning.md
943
- *
944
- * This class manages current document schema and transitions between document schemas.
945
- * At the moment, it only focuses on subset of document schema, specifically - how FluidFramework runtime serializes data
946
- * (summary and op format), features & capabilities that a version of runtime has to support and understand in
947
- * order to collaborate on a document.
948
- * New features that modify document format have to be included in document schema definition.
949
- * Usage of such features could only happen after document schema has been updated to reflect such feature.
950
- *
951
- * This formality allows clients that do not understand such features to fail right away when they observe
952
- * document schema listing capabilities that such client does not understand.
953
- * Old clients will fail in predictable way. This allows us to
954
- * 1) Immediately see such issues and adjust if features are enabled too early, before changes have been saturated.
955
- * 2) There is no way to get to 100% saturation with new code. Even if we have 99.99% saturation, there are
956
- * still 0.01% of clients who will fail. Failing early and predictably ensures they have no chance to limp along
957
- * and potentially corrupt the document. This is especially true for summarizer client, who could simply "undo"
958
- * changes it does not understands.
959
- *
960
- * It's important to note how it overlaps with feature gates and safe velocity.
961
- * If new feature was in use, that resulted in a number of documents referencing such feature in document schema.
962
- * But, developers (through code deployment or feature gates) could disable usage of such features.
963
- * That will stop a process of further document schema changes (for documents that were not using such feature).
964
- * And documents that already list such capability in their schema will continue to do so. Later ensures that old
965
- * clients who do not understand such feature will continue to fail to open such documents, as such documents very
966
- * likely contain data in a new format.
967
- *
968
- * Controller operates with 4 schemas:
969
- * - document schema: whatever we loaded from summary metadata + ops. It follows eventuall consistency rules (i.e. like DDS).
970
- * - desired schema - what client is asking for to have (i.e. all the desired settings, based on runtime options / feature gates).
971
- * - session schema - current session schema. It's "and" of the above two schemas.
972
- * - future schema - "or" of document and desires schemas.
973
- *
974
- * "or" & "and" operators are defined individually for each property. For Boolean properties it's literally &&, || operators.
975
- * But for other properties it's more nuanced.
976
- *
977
- * Whenver document schema does not match future schema, controller will send an op that attempts to changs documents schema to
978
- * future schema.
979
- *
980
- * Users of this class need to use DocumentsSchemaController.sessionSchema to determine what features can be used.
981
- *
982
- * There are two modes this class can operate:
983
- * 1) Legacy mode. In such mode it does not issue any ops to change document schema. Any changes happen implicitly,
984
- * right away, and new features are available right away
985
- * 2) Non-legacy mode. In such mode any changes to schema require an op roundtrip. This class will manage such transitions.
986
- * However code should assume that any new features that were not enabled in a given document will not be available
987
- * for a given session. That's because this session may never send any ops (including read-only documents). Or it may
988
- * fail to convert schema.
989
- * This class promises eventual movement forward. I.e. if new feature is allowed (let's say - through feature gates),
990
- * then eventually all documents that are modified will have that feature reflected in their schema. It could require
991
- * multiple reloads / new sessions to get there (depends on if code reacts to schema changes right away, or only consults
992
- * schema on document load).
993
- *
994
- * How schemas are changed (in non-legacy mode):
995
- * If a client needs to change a schema, it will attempt to do so as part of normal ops sending process.
996
- * Changes happen in CAS (Compare-and-swap) fashion, i.e. client tells current schema and schema it wants to change to.
997
- * When a number of clients race to change a schema, then only one of them will win, all others will fail because they will
998
- * reference old schema that is no longer in effect.
999
- * Clients can retry, but current implementation is simply - they will not (and will rely on next session / reload to do
1000
- * recalc and decide if schema needs to be changed or not).
1001
- *
1002
- * @alpha
1003
- */
1004
- export declare class DocumentsSchemaController {
1005
- private readonly onSchemaChange;
1006
- private explicitSchemaControl;
1007
- private sendOp;
1008
- private documentSchema;
1009
- private readonly desiredSchema;
1010
- private futureSchema;
1011
- sessionSchema: IDocumentSchemaCurrent;
1012
- /**
1013
- * Constructs DocumentsSchemaController that controls current schema and processes around it, including changes in schema.
1014
- * @param existing - Is the document existing document, or a new doc.
1015
- * @param documentMetadataSchema - current document's schema, if present.
1016
- * @param features - features of the document schema that current session wants to see enabled.
1017
- * @param onSchemaChange - callback that is called whenever schema is changed (not called on creation / load, only when processing document schema change ops)
1018
- */
1019
- constructor(existing: boolean, documentMetadataSchema: IDocumentSchema | undefined, features: IDocumentSchemaFeatures, onSchemaChange: (schema: IDocumentSchemaCurrent) => void);
1020
- summarizeDocumentSchema(refSeq: number): IDocumentSchemaCurrent | undefined;
1021
- /**
1022
- * Called by Container runtime whenever it is about to send some op.
1023
- * It gives opportunity for controller to issue its own ops - we do not want to send ops if there are no local changes in document.
1024
- * @returns Optional message to send.
1025
- */
1026
- maybeSendSchemaMessage(): IDocumentSchemaChangeMessage | undefined;
1027
- /**
1028
- * Process document schema change message
1029
- * Called by ContainerRuntime whenever it sees document schema messages.
1030
- * @param content - content of the message
1031
- * @param local - whether op is local
1032
- * @param sequenceNumber - sequence number of the op
1033
- * @returns - true if schema was accepted, otherwise false (rejected due to failed CAS)
1034
- */
1035
- processDocumentSchemaOp(content: IDocumentSchemaChangeMessage, local: boolean, sequenceNumber: number): boolean;
1036
- onDisconnect(): void;
1037
- }
1038
-
1039
- /**
1040
- * @alpha
1041
- */
1042
- export declare type EnqueueSummarizeResult = (ISummarizeResults & {
1043
- /**
1044
- * Indicates that another summarize attempt is not already enqueued,
1045
- * and this attempt has been enqueued.
1046
- */
1047
- readonly alreadyEnqueued?: undefined;
1048
- }) | (ISummarizeResults & {
1049
- /** Indicates that another summarize attempt was already enqueued. */
1050
- readonly alreadyEnqueued: true;
1051
- /**
1052
- * Indicates that the other enqueued summarize attempt was abandoned,
1053
- * and this attempt has been enqueued enqueued.
1054
- */
1055
- readonly overridden: true;
1056
- }) | {
1057
- /** Indicates that another summarize attempt was already enqueued. */
1058
- readonly alreadyEnqueued: true;
1059
- /**
1060
- * Indicates that the other enqueued summarize attempt remains enqueued,
1061
- * and this attempt has not been enqueued.
1062
- */
1063
- readonly overridden?: undefined;
1064
- };
1065
-
1066
- /**
1067
- * Represents the context for the store. This context is passed to the store runtime.
1068
- * @internal
1069
- */
1070
- export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IFluidDataStoreContextEvents> implements IFluidDataStoreContextInternal, IFluidParentContext, IDisposable {
1071
- private readonly existing;
1072
- readonly isLocalDataStore: boolean;
1073
- private readonly makeLocallyVisibleFn;
1074
- get packagePath(): readonly string[];
1075
- get options(): Record<string | number, any>;
1076
- get clientId(): string | undefined;
1077
- get clientDetails(): IClientDetails;
1078
- get logger(): ITelemetryBaseLogger;
1079
- get deltaManager(): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
1080
- get connected(): boolean;
1081
- get IFluidHandleContext(): IFluidHandleContext;
1082
- get containerRuntime(): IContainerRuntimeBase;
1083
- ensureNoDataModelChanges<T>(callback: () => T): T;
1084
- get isLoaded(): boolean;
1085
- get baseSnapshot(): ISnapshotTree | undefined;
1086
- get idCompressor(): IIdCompressor | undefined;
1087
- private _disposed;
1088
- get disposed(): boolean;
1089
- /**
1090
- * A Tombstoned object has been unreferenced long enough that GC knows it won't be referenced again.
1091
- * Tombstoned objects are eventually deleted by GC.
1092
- */
1093
- private _tombstoned;
1094
- get tombstoned(): boolean;
1095
- /** If true, throw an error when a tombstone data store is used. */
1096
- readonly gcThrowOnTombstoneUsage: boolean;
1097
- readonly gcTombstoneEnforcementAllowed: boolean;
1098
- /** If true, this means that this data store context and its children have been removed from the runtime */
1099
- protected deleted: boolean;
1100
- get attachState(): AttachState;
1101
- get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined;
1102
- private baseSnapshotSequenceNumber;
1103
- /**
1104
- * A datastore is considered as root if it
1105
- * 1. is root in memory - see isInMemoryRoot
1106
- * 2. is root as part of the base snapshot that the datastore loaded from
1107
- * @returns whether a datastore is root
1108
- */
1109
- isRoot(aliasedDataStores?: Set<string>): Promise<boolean>;
1110
- /**
1111
- * There are 3 states where isInMemoryRoot needs to be true
1112
- * 1. when a datastore becomes aliased. This can happen for both remote and local datastores
1113
- * 2. when a datastore is created locally as root
1114
- * 3. when a datastore is created locally as root and is rehydrated
1115
- * @returns whether a datastore is root in memory
1116
- */
1117
- protected isInMemoryRoot(): boolean;
1118
- protected registry: IFluidDataStoreRegistry | undefined;
1119
- protected detachedRuntimeCreation: boolean;
1120
- protected channel: IFluidDataStoreChannel | undefined;
1121
- private loaded;
1122
- protected pending: ISequencedDocumentMessage[] | undefined;
1123
- protected channelP: Promise<IFluidDataStoreChannel> | undefined;
1124
- protected _baseSnapshot: ISnapshotTree | undefined;
1125
- protected _attachState: AttachState;
1126
- private _isInMemoryRoot;
1127
- protected readonly summarizerNode: ISummarizerNodeWithGC;
1128
- protected readonly mc: MonitoringContext;
1129
- private readonly thresholdOpsCounter;
1130
- private static readonly pendingOpsCountThreshold;
1131
- /**
1132
- * If the summarizer makes local changes, a telemetry event is logged. This has the potential to be very noisy.
1133
- * So, adding a count of how many telemetry events are logged per data store context. This can be
1134
- * controlled via feature flags.
1135
- */
1136
- private localChangesTelemetryCount;
1137
- private lastUsedRoutes;
1138
- readonly id: string;
1139
- private readonly _containerRuntime;
1140
- private readonly parentContext;
1141
- readonly storage: IDocumentStorageService;
1142
- readonly scope: FluidObject;
1143
- readonly loadingGroupId: string | undefined;
1144
- protected pkg?: readonly string[];
1145
- constructor(props: IFluidDataStoreContextProps, existing: boolean, isLocalDataStore: boolean, makeLocallyVisibleFn: () => void);
1146
- dispose(): void;
1147
- /**
1148
- * When delete is called, that means that the data store is permanently removed from the runtime, and will not show up in future summaries
1149
- * This function is called to prevent ops from being generated from this data store once it has been deleted. Furthermore, this data store
1150
- * should not receive any ops/signals.
1151
- */
1152
- delete(): void;
1153
- setTombstone(tombstone: boolean): void;
1154
- abstract setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;
1155
- private rejectDeferredRealize;
1156
- realize(): Promise<IFluidDataStoreChannel>;
1157
- protected factoryFromPackagePath(): Promise<IFluidDataStoreFactory>;
1158
- private realizeCore;
1159
- /**
1160
- * Notifies this object about changes in the connection state.
1161
- * @param value - New connection state.
1162
- * @param clientId - ID of the client. Its old ID when in disconnected state and
1163
- * its new client ID when we are connecting or connected.
1164
- */
1165
- setConnectionState(connected: boolean, clientId?: string): void;
1166
- process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
1167
- processSignal(message: IInboundSignalMessage, local: boolean): void;
1168
- getQuorum(): IQuorumClients;
1169
- getAudience(): IAudience;
1170
- /**
1171
- * Returns a summary at the current sequence number.
1172
- * @param fullTree - true to bypass optimizations and force a full summary tree
1173
- * @param trackState - This tells whether we should track state from this summary.
1174
- * @param telemetryContext - summary data passed through the layers for telemetry purposes
1175
- */
1176
- summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummarizeResult>;
1177
- private summarizeInternal;
1178
- /**
1179
- * Returns the data used for garbage collection. This includes a list of GC nodes that represent this data store
1180
- * including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the
1181
- * document.
1182
- * If there is no new data in this data store since the last summary, previous GC data is used.
1183
- * If there is new data, the GC data is generated again (by calling getGCDataInternal).
1184
- * @param fullGC - true to bypass optimizations and force full generation of GC data.
1185
- */
1186
- getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
1187
- /**
1188
- * Generates data used for garbage collection. This is called when there is new data since last summary. It
1189
- * realizes the data store and calls into each channel context to get its GC data.
1190
- * @param fullGC - true to bypass optimizations and force full generation of GC data.
1191
- */
1192
- private getGCDataInternal;
1193
- /**
1194
- * After GC has run, called to notify the data store of routes used in it. These are used for the following:
1195
- *
1196
- * 1. To identify if this data store is being referenced in the document or not.
1197
- *
1198
- * 2. To determine if it needs to re-summarize in case used routes changed since last summary.
1199
- *
1200
- * 3. These are added to the summary generated by the data store.
1201
- *
1202
- * 4. To notify child contexts of their used routes. This is done immediately if the data store is loaded.
1203
- * Else, it is done when realizing the data store.
1204
- *
1205
- * 5. To update the timestamp when this data store or any children are marked as unreferenced.
1206
- *
1207
- * @param usedRoutes - The routes that are used in this data store.
1208
- */
1209
- updateUsedRoutes(usedRoutes: string[]): void;
1210
- /**
1211
- * @deprecated There is no replacement for this, its functionality is no longer needed at this layer.
1212
- * It will be removed in a future release, sometime after 2.0.0-internal.8.0.0
1213
- *
1214
- * Similar capability is exposed with from/to string paths instead of handles via @see addedGCOutboundRoute
1215
- *
1216
- * Called when a new outbound reference is added to another node. This is used by garbage collection to identify
1217
- * all references added in the system.
1218
- * @param srcHandle - The handle of the node that added the reference.
1219
- * @param outboundHandle - The handle of the outbound node that is referenced.
1220
- */
1221
- addedGCOutboundReference(srcHandle: IFluidHandle, outboundHandle: IFluidHandle): void;
1222
- /**
1223
- * (Same as @see addedGCOutboundReference, but with string paths instead of handles)
1224
- *
1225
- * Called when a new outbound reference is added to another node. This is used by garbage collection to identify
1226
- * all references added in the system.
1227
- *
1228
- * @param fromPath - The absolute path of the node that added the reference.
1229
- * @param toPath - The absolute path of the outbound node that is referenced.
1230
- */
1231
- addedGCOutboundRoute(fromPath: string, toPath: string): void;
1232
- /**
1233
- * Updates the used routes of the channel and its child contexts. The channel must be loaded before calling this.
1234
- * It is called in these two scenarios:
1235
- * 1. When the used routes of the data store is updated and the data store is loaded.
1236
- * 2. When the data store is realized. This updates the channel's used routes as per last GC run.
1237
- */
1238
- private updateChannelUsedRoutes;
1239
- /**
1240
- * @deprecated 0.18.Should call request on the runtime directly
1241
- */
1242
- request(request: IRequest): Promise<IResponse>;
1243
- submitMessage(type: string, content: any, localOpMetadata: unknown): void;
1244
- /**
1245
- * This is called from a SharedSummaryBlock that does not generate ops but only wants to be part of the summary.
1246
- * It indicates that there is data in the object that needs to be summarized.
1247
- * We will update the latestSequenceNumber of the summary tracker of this
1248
- * store and of the object's channel.
1249
- *
1250
- * @param address - The address of the channel that is dirty.
1251
- *
1252
- */
1253
- setChannelDirty(address: string): void;
1254
- /**
1255
- * Submits the signal to be sent to other clients.
1256
- * @param type - Type of the signal.
1257
- * @param content - Content of the signal. Should be a JSON serializable object or primitive.
1258
- * @param targetClientId - When specified, the signal is only sent to the provided client id.
1259
- */
1260
- submitSignal(type: string, content: unknown, targetClientId?: string): void;
1261
- /**
1262
- * This is called by the data store channel when it becomes locally visible indicating that it is ready to become
1263
- * globally visible now.
1264
- */
1265
- makeLocallyVisible(): void;
1266
- protected processPendingOps(channel: IFluidDataStoreChannel): void;
1267
- protected completeBindingRuntime(channel: IFluidDataStoreChannel): void;
1268
- protected bindRuntime(channel: IFluidDataStoreChannel, existing: boolean): Promise<void>;
1269
- getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
1270
- /**
1271
- * Get the data required when attaching this context's DataStore.
1272
- * Used for both Container Attach and DataStore Attach.
1273
- *
1274
- * @returns the summary, type, and GC Data for this context's DataStore.
1275
- */
1276
- abstract getAttachData(includeGCData: boolean, telemetryContext?: ITelemetryContext): {
1277
- attachSummary: ISummaryTreeWithStats;
1278
- type: string;
1279
- };
1280
- abstract getInitialSnapshotDetails(): Promise<ISnapshotDetails>;
1281
- /**
1282
- * @deprecated Sets the datastore as root, for aliasing purposes: #7948
1283
- * This method should not be used outside of the aliasing context.
1284
- * It will be removed, as the source of truth for this flag will be the aliasing blob.
1285
- */
1286
- setInMemoryRoot(): void;
1287
- /**
1288
- * @deprecated The functionality to get base GC details has been moved to summarizer node.
1289
- */
1290
- getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;
1291
- reSubmit(type: string, contents: any, localOpMetadata: unknown): void;
1292
- rollback(type: string, contents: any, localOpMetadata: unknown): void;
1293
- applyStashedOp(contents: any): Promise<unknown>;
1294
- private verifyNotClosed;
1295
- /**
1296
- * Summarizer client should not have local changes. These changes can become part of the summary and can break
1297
- * eventual consistency. For example, the next summary (say at ref seq# 100) may contain these changes whereas
1298
- * other clients that are up-to-date till seq# 100 may not have them yet.
1299
- */
1300
- protected identifyLocalChangeInSummarizer(eventName: string, type?: string): void;
1301
- getCreateChildSummarizerNodeFn(id: string, createParam: CreateChildSummarizerNodeParam): (summarizeInternal: SummarizeInternalFn, getGCDataFn: (fullGC?: boolean) => Promise<IGarbageCollectionData>) => ISummarizerNodeWithGC;
1302
- deleteChildSummarizerNode(id: string): void;
1303
- uploadBlob(blob: ArrayBufferLike, signal?: AbortSignal): Promise<IFluidHandle<ArrayBufferLike>>;
1304
- }
1305
-
1306
- /**
1307
- * @internal
1308
- */
1309
- export declare class FluidDataStoreRegistry implements IFluidDataStoreRegistry {
1310
- private readonly map;
1311
- get IFluidDataStoreRegistry(): this;
1312
- constructor(namedEntries: NamedFluidDataStoreRegistryEntries);
1313
- get(name: string): Promise<FluidDataStoreRegistryEntry | undefined>;
1314
- }
1315
-
1316
- /**
1317
- * @see IGCMetadata.gcFeatureMatrix and @see gcGenerationOptionName
1318
- * @alpha
1319
- */
1320
- export declare type GCFeatureMatrix = {
1321
- /**
1322
- * The GC Generation value in effect when this file was created.
1323
- * Gives a way for an app to disqualify old files from GC Sweep.
1324
- * Provided via Container Runtime Options.
1325
- */
1326
- gcGeneration?: number;
1327
- /** Deprecated property from legacy type. Will not be set concurrently with gcGeneration */
1328
- tombstoneGeneration?: undefined;
1329
- } | {
1330
- /**
1331
- * The Tombstone Generation value in effect when this file was created.
1332
- * Legacy - new containers would get gcGeneration instead (if anything)
1333
- */
1334
- tombstoneGeneration: number;
1335
- };
1336
-
1337
- /**
1338
- * The types of GC nodes in the GC reference graph.
1339
- * @alpha
1340
- */
1341
- export declare const GCNodeType: {
1342
- DataStore: string;
1343
- SubDataStore: string;
1344
- Blob: string;
1345
- Other: string;
1346
- };
1347
-
1348
- /**
1349
- * @alpha
1350
- */
1351
- export declare type GCNodeType = (typeof GCNodeType)[keyof typeof GCNodeType];
1352
-
1353
- /**
1354
- * @alpha
1355
- */
1356
- export declare type GCVersion = number;
1357
-
1358
- /**
1359
- * A single summary which has already been acked by the server.
1360
- * @alpha
1361
- */
1362
- export declare interface IAckedSummary {
1363
- readonly summaryOp: ISummaryOpMessage;
1364
- readonly summaryAck: ISummaryAckMessage;
1365
- }
1366
-
1367
- /**
1368
- * @alpha
1369
- */
1370
- export declare interface IAckSummaryResult {
1371
- readonly summaryAckOp: ISummaryAckMessage;
1372
- readonly ackNackDuration: number;
1373
- }
1374
-
1375
- /**
1376
- * Base results for all submitSummary attempts.
1377
- * @alpha
1378
- */
1379
- export declare interface IBaseSummarizeResult {
1380
- readonly stage: "base";
1381
- /** Error object related to failed summarize attempt. */
1382
- readonly error: any;
1383
- /** Reference sequence number as of the generate summary attempt. */
1384
- readonly referenceSequenceNumber: number;
1385
- readonly minimumSequenceNumber: number;
1386
- }
1387
-
1388
- /**
1389
- * Information from a snapshot needed to load BlobManager
1390
- * @alpha
1391
- */
1392
- export declare interface IBlobManagerLoadInfo {
1393
- ids?: string[];
1394
- redirectTable?: [string, string][];
1395
- }
1396
-
1397
- /**
1398
- * @alpha
1399
- */
1400
- export declare interface IBroadcastSummaryResult {
1401
- readonly summarizeOp: ISummaryOpMessage;
1402
- readonly broadcastDuration: number;
1403
- }
1404
-
1405
- /**
1406
- * Similar to AbortController, but using promise instead of events
1407
- * @alpha
1408
- */
1409
- export declare interface ICancellableSummarizerController extends ISummaryCancellationToken {
1410
- stop(reason: SummarizerStopReason): void;
1411
- }
1412
-
1413
- /**
1414
- * Similar to AbortSignal, but using promise instead of events
1415
- * @param T - cancellation reason type
1416
- * @alpha
1417
- */
1418
- export declare interface ICancellationToken<T> {
1419
- /** Tells if this cancellable token is cancelled */
1420
- readonly cancelled: boolean;
1421
- /**
1422
- * Promise that gets fulfilled when this cancellable token is cancelled
1423
- * @returns reason of cancellation
1424
- */
1425
- readonly waitCancelled: Promise<T>;
1426
- }
1427
-
1428
- /**
1429
- * @internal
1430
- */
1431
- export declare interface IChunkedOp {
1432
- chunkId: number;
1433
- totalChunks: number;
1434
- contents: string;
1435
- originalMetadata?: Record<string, unknown>;
1436
- originalCompression?: string;
1437
- }
1438
-
1439
- /**
1440
- * Watches summaries created by a specific client.
1441
- * @alpha
1442
- */
1443
- export declare interface IClientSummaryWatcher extends IDisposable {
1444
- watchSummary(clientSequenceNumber: number): ISummary;
1445
- waitFlushed(): Promise<IAckedSummary | undefined>;
1446
- }
1447
-
1448
- /**
1449
- * Options for op compression.
1450
- * @alpha
1451
- */
1452
- export declare interface ICompressionRuntimeOptions {
1453
- /**
1454
- * The value the batch's content size must exceed for the batch to be compressed.
1455
- * By default the value is 600 * 1024 = 614400 bytes. If the value is set to `Infinity`, compression will be disabled.
1456
- */
1457
- readonly minimumBatchSizeInBytes: number;
1458
- /**
1459
- * The compression algorithm that will be used to compress the op.
1460
- * By default the value is `lz4` which is the only compression algorithm currently supported.
1461
- */
1462
- readonly compressionAlgorithm: CompressionAlgorithms;
1463
- }
1464
-
1465
- /**
1466
- * @alpha
1467
- */
1468
- export declare interface IConnectableRuntime {
1469
- readonly disposed: boolean;
1470
- readonly connected: boolean;
1471
- readonly clientId: string | undefined;
1472
- once(event: "connected" | "disconnected" | "dispose", listener: () => void): this;
1473
- }
1474
-
1475
- /**
1476
- * All the info an older client would need to know how to handle an unrecognized remote op type
1477
- *
1478
- * @internal
1479
- */
1480
- export declare interface IContainerRuntimeMessageCompatDetails {
1481
- /** How should an older client handle an unrecognized remote op type? */
1482
- behavior: CompatModeBehavior;
1483
- }
1484
-
1485
- /**
1486
- * @alpha
1487
- */
1488
- export declare interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGCMetadata {
1489
- readonly summaryFormatVersion: 1;
1490
- /** @deprecated - used by old (prior to 2.0 RC3) runtimes */
1491
- readonly message?: ISummaryMetadataMessage;
1492
- /** The last message processed at the time of summary. Only primitive property types are added to the summary. */
1493
- readonly lastMessage?: ISummaryMetadataMessage;
1494
- /** True if channels are not isolated in .channels subtrees, otherwise isolated. */
1495
- readonly disableIsolatedChannels?: true;
1496
- /** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */
1497
- readonly summaryNumber?: number;
1498
- /** GUID to identify a document in telemetry */
1499
- readonly telemetryDocumentId?: string;
1500
- readonly documentSchema?: IDocumentSchema;
1501
- }
1502
-
1503
- /**
1504
- * Options for container runtime.
1505
- * @alpha
1506
- */
1507
- export declare interface IContainerRuntimeOptions {
1508
- readonly summaryOptions?: ISummaryRuntimeOptions;
1509
- readonly gcOptions?: IGCRuntimeOptions;
1510
- /**
1511
- * Affects the behavior while loading the runtime when the data verification check which
1512
- * compares the DeltaManager sequence number (obtained from protocol in summary) to the
1513
- * runtime sequence number (obtained from runtime metadata in summary) finds a mismatch.
1514
- * 1. "close" (default) will close the container with an assertion.
1515
- * 2. "log" will log an error event to telemetry, but still continue to load.
1516
- * 3. "bypass" will skip the check entirely. This is not recommended.
1517
- */
1518
- readonly loadSequenceNumberVerification?: "close" | "log" | "bypass";
1519
- /**
1520
- * Sets the flush mode for the runtime. In Immediate flush mode the runtime will immediately
1521
- * send all operations to the driver layer, while in TurnBased the operations will be buffered
1522
- * and then sent them as a single batch at the end of the turn.
1523
- * By default, flush mode is TurnBased.
1524
- */
1525
- readonly flushMode?: FlushMode;
1526
- /**
1527
- * Enables the runtime to compress ops. See {@link ICompressionRuntimeOptions}.
1528
- */
1529
- readonly compressionOptions?: ICompressionRuntimeOptions;
1530
- /**
1531
- * If specified, when in FlushMode.TurnBased, if the size of the ops between JS turns exceeds this value,
1532
- * an error will be thrown and the container will close.
1533
- *
1534
- * If unspecified, the limit is 700Kb.
1535
- *
1536
- * 'Infinity' will disable any limit.
1537
- *
1538
- * @experimental This config should be driven by the connection with the service and will be moved in the future.
1539
- */
1540
- readonly maxBatchSizeInBytes?: number;
1541
- /**
1542
- * If the op payload needs to be chunked in order to work around the maximum size of the batch, this value represents
1543
- * how large the individual chunks will be. This is only supported when compression is enabled. If after compression, the
1544
- * batch content size exceeds this value, it will be chunked into smaller ops of this exact size.
1545
- *
1546
- * This value is a trade-off between having many small chunks vs fewer larger chunks and by default, the runtime is configured to use
1547
- * 200 * 1024 = 204800 bytes. This default value ensures that no compressed payload's content is able to exceed {@link IContainerRuntimeOptions.maxBatchSizeInBytes}
1548
- * regardless of the overhead of an individual op.
1549
- *
1550
- * Any value of `chunkSizeInBytes` exceeding {@link IContainerRuntimeOptions.maxBatchSizeInBytes} will disable this feature, therefore if a compressed batch's content
1551
- * size exceeds {@link IContainerRuntimeOptions.maxBatchSizeInBytes} after compression, the container will close with an instance of `GenericError` with
1552
- * the `BatchTooLarge` message.
1553
- */
1554
- readonly chunkSizeInBytes?: number;
1555
- /**
1556
- * Enable the IdCompressor in the runtime.
1557
- * @experimental Not ready for use.
1558
- */
1559
- readonly enableRuntimeIdCompressor?: IdCompressorMode;
1560
- /**
1561
- * If enabled, the runtime will block all attempts to send an op inside the
1562
- * {@link ContainerRuntime#ensureNoDataModelChanges} callback. The callback is used by
1563
- * {@link @fluidframework/shared-object-base#SharedObjectCore} for event handlers so enabling this
1564
- * will disallow modifying DDSes while handling DDS events.
1565
- *
1566
- * By default, the feature is disabled. If enabled from options, the `Fluid.ContainerRuntime.DisableOpReentryCheck`
1567
- * can be used to disable it at runtime.
1568
- */
1569
- readonly enableOpReentryCheck?: boolean;
1570
- /**
1571
- * If enabled, the runtime will group messages within a batch into a single
1572
- * message to be sent to the service.
1573
- * The grouping an ungrouping of such messages is handled by the "OpGroupingManager".
1574
- *
1575
- * By default, the feature is disabled. If enabled from options, the `Fluid.ContainerRuntime.DisableGroupedBatching`
1576
- * flag can be used to disable it at runtime.
1577
- *
1578
- * @experimental Not ready for use.
1579
- */
1580
- readonly enableGroupedBatching?: boolean;
1581
- /**
1582
- * When this property is set to true, it requires runtime to control is document schema properly through ops
1583
- * The benefit of this mode is that clients who do not understand schema will fail in predictable way, with predictable message,
1584
- * and will not attempt to limp along, which could cause data corruptions and crashes in random places.
1585
- * When this property is not set (or set to false), runtime operates in legacy mode, where new features (modifying document schema)
1586
- * are engaged as they become available, without giving legacy clients any chance to fail predictably.
1587
- */
1588
- readonly explicitSchemaControl?: boolean;
1589
- }
1590
-
1591
- /**
1592
- * @alpha
1593
- */
1594
- export declare interface ICreateContainerMetadata {
1595
- /** Runtime version of the container when it was first created */
1596
- createContainerRuntimeVersion?: string;
1597
- /** Timestamp of the container when it was first created */
1598
- createContainerTimestamp?: number;
1599
- }
1600
-
1601
- /**
1602
- * ID Compressor mode.
1603
- * "on" - compressor is On. It's loaded as part of container load. This mode is sticky - once on, compressor is On for all
1604
- * sessions for a given document. This results in IContainerRuntime.idCompressor to be always available.
1605
- * "delayed" - ID compressor bundle is loaded only on establishing of first delta connection, i.e. it does not impact boot of cotnainer.
1606
- * In such mode IContainerRuntime.idCompressor is not made available (unless previous sessions of same document had it "On").
1607
- * The only thing that is available is IContainerRuntime.generateDocumentUniqueId() that provides opportunistically short IDs.
1608
- * undefined - ID compressor is not loaded.
1609
- * While IContainerRuntime.generateDocumentUniqueId() is available, it will produce long IDs that are do not compress well.
1610
- *
1611
- * @alpha
1612
- */
1613
- export declare type IdCompressorMode = "on" | "delayed" | undefined;
1614
-
1615
- /**
1616
- * Document schema information.
1617
- * Describes overall shape of document schema, including unknown (to this version) properties.
1618
- *
1619
- * Used by runtime to make a call if it can understand document schema.
1620
- * If it can't, it should not continue with document and immediately fail, preventing random (cryptic) failures
1621
- * down the road and potentially corrupting documents.
1622
- * For now this structure and appropriate interpretation / behavior is focused only on runtime features.
1623
- * In the future that could be interpolated to more areas, including DDSs used, and even possibly - application
1624
- * schema.
1625
- *
1626
- * Runtime will ignore any properties at the root that it does not understand (i.e. IDocumentSchema.app), but will
1627
- * stop (and fail session) on any unknown properties within "runtime" sub-tree.
1628
- *
1629
- * In most cases values preserved in the document will not dictate if such features should be enabled in a given session.
1630
- * I.e. if compression is mentioned in document schema, this means that runtime version that opens such document must know
1631
- * how to interpret such ops, but does not need to actually use compression itself. That said, some options could be
1632
- * sticky, i.e. influence feature selection for all runtimes opening a document. ID compression is one such example.
1633
- * Currently there is no mechanism to remove feature from this property bag, i.e. once compression was used, even if it's
1634
- * disabled (through feature gate or code deployment), all existing documents that used compression will continue to fail
1635
- * if opened by clients who do not support compression.
1636
- *
1637
- * For now we are limiting it to just plain properties, and only really simple types, but that can be changed in the future.
1638
- *
1639
- * @alpha
1640
- */
1641
- export declare interface IDocumentSchema {
1642
- version: number;
1643
- refSeq: number;
1644
- runtime: Record<string, DocumentSchemaValueType>;
1645
- }
1646
-
1647
- /**
1648
- * Content of the type=ContainerMessageType.DocumentSchemaChange ops.
1649
- * The meaning of refSeq field is different in such messages (compared to other usages of IDocumentSchemaCurrent)
1650
- * ContainerMessageType.DocumentSchemaChange messages use CAS (Compare-and-swap) semantics, and convey
1651
- * regSeq of last known schema change (known to a client proposing schema change).
1652
- * @see ContainerRuntimeDocumentSchemaMessage
1653
- * @alpha
1654
- */
1655
- export declare type IDocumentSchemaChangeMessage = IDocumentSchema;
1656
-
1657
- /**
1658
- * Current document schema.
1659
- * @alpha
1660
- */
1661
- export declare type IDocumentSchemaCurrent = {
1662
- version: 1;
1663
- refSeq: number;
1664
- runtime: {
1665
- [P in keyof IDocumentSchemaFeatures]?: IDocumentSchemaFeatures[P] extends boolean ? true : IDocumentSchemaFeatures[P];
1666
- };
1667
- };
1668
-
1669
- /**
1670
- * Settings that this session would like to have, based on options and feature gates.
1671
- *
1672
- * WARNING: This type is used to infer IDocumentSchemaCurrent type!
1673
- * Any changes here (including renaming of properties) are potentially changing document format and should be considered carefully!
1674
- *
1675
- * @alpha
1676
- */
1677
- export declare interface IDocumentSchemaFeatures {
1678
- explicitSchemaControl: boolean;
1679
- compressionLz4: boolean;
1680
- idCompressorMode: IdCompressorMode;
1681
- opGroupingEnabled: boolean;
1682
- /**
1683
- * List of disallowed versions of the runtime.
1684
- * This option is sticky. Once a version of runtime is added to this list (when supplied to DocumentsSchemaController's constructor)
1685
- * it will be added to the list of disallowed versions and stored in document metadata.
1686
- * Each runtime checks if its version is in this list on container open. If it is, it immediately exits with error message
1687
- * indicating to the user that this version is no longer supported.
1688
- * Currently there is no mechanism to remove version from this list. I.e. If it was once added to the list,
1689
- * it gets added to any document metadata (documents that gets open by this runtime) and there is no way to clear it from document's
1690
- * metadata.
1691
- */
1692
- disallowedVersions: string[];
1693
- }
1694
-
1695
- /**
1696
- * Options to use when enqueueing a summarize attempt.
1697
- * @alpha
1698
- */
1699
- export declare interface IEnqueueSummarizeOptions extends IOnDemandSummarizeOptions {
1700
- /** If specified, The summarize attempt will not occur until after this sequence number. */
1701
- readonly afterSequenceNumber?: number;
1702
- /**
1703
- * True to override the existing enqueued summarize attempt if there is one.
1704
- * This will guarantee that this attempt gets enqueued. If override is false,
1705
- * than an existing enqueued summarize attempt will block a new one from being
1706
- * enqueued. There can only be one enqueued at a time. Defaults to false.
1707
- */
1708
- readonly override?: boolean;
1709
- }
1710
-
1711
- /** @internal */
1712
- export declare interface IFluidDataStoreContextEvents extends IEvent {
1713
- (event: "attaching" | "attached", listener: () => void): any;
1714
- }
1715
-
1716
- /**
1717
- * This is interface that every context should implement.
1718
- * This interface is used for context's parent - ChannelCollection.
1719
- * It should not be exposed to any other users of context.
1720
- * @internal
1721
- */
1722
- export declare interface IFluidDataStoreContextInternal extends IFluidDataStoreContext {
1723
- getAttachData(includeGCData: boolean, telemetryContext?: ITelemetryContext): {
1724
- attachSummary: ISummaryTreeWithStats;
1725
- type: string;
1726
- };
1727
- getInitialSnapshotDetails(): Promise<ISnapshotDetails>;
1728
- realize(): Promise<IFluidDataStoreChannel>;
1729
- isRoot(): Promise<boolean>;
1730
- }
1731
-
1732
- /**
1733
- * Properties necessary for creating a FluidDataStoreContext
1734
- * @internal
1735
- */
1736
- export declare interface IFluidDataStoreContextProps {
1737
- readonly id: string;
1738
- readonly parentContext: IFluidParentContext;
1739
- readonly storage: IDocumentStorageService;
1740
- readonly scope: FluidObject;
1741
- readonly createSummarizerNodeFn: CreateChildSummarizerNodeFn;
1742
- readonly pkg?: Readonly<string[]>;
1743
- readonly loadingGroupId?: string;
1744
- }
1745
-
1746
- /**
1747
- * GC-specific metadata to be written into the summary.
1748
- *
1749
- * @alpha
1750
- */
1751
- export declare interface IGCMetadata {
1752
- /**
1753
- * The version of the GC code that was run to generate the GC data that is written in the summary.
1754
- * If the persisted value doesn't match the current value in the code, saved GC data will be discarded and regenerated from scratch.
1755
- * Also, used to determine whether GC is enabled for this container or not:
1756
- * - A value of 0 or undefined means GC is disabled.
1757
- * - A value greater than 0 means GC is enabled.
1758
- */
1759
- readonly gcFeature?: GCVersion;
1760
- /**
1761
- * A collection of different numerical "Generations" for different features,
1762
- * used to determine feature availability over time.
1763
- * This info may come from multiple sources (FF code, config service, app via Container Runtime Options),
1764
- * and pertains to aspects of the document that may be fixed for its lifetime.
1765
- *
1766
- * For each dimension, if the persisted value doesn't match the currently provided value,
1767
- * then this file does not support the corresponding feature as currently implemented.
1768
- *
1769
- * Guidance is that if no value is provided at runtime, it should result in the current default behavior.
1770
- */
1771
- readonly gcFeatureMatrix?: GCFeatureMatrix;
1772
- /**
1773
- * Tells whether the GC sweep phase is enabled for this container.
1774
- * - True means sweep phase is enabled.
1775
- * - False means sweep phase is disabled. If GC is disabled as per gcFeature, sweep is also disabled.
1776
- *
1777
- * @deprecated use GCFeatureMatrix.gcGeneration instead. @see GCFeatureMatrix.gcGeneration
1778
- */
1779
- readonly sweepEnabled?: boolean;
1780
- /** If this is present, the session for this container will expire after this time and the container will close */
1781
- readonly sessionExpiryTimeoutMs?: number;
1782
- /**
1783
- * How long to wait after an object is unreferenced before it becomes a Tombstone.
1784
- *
1785
- * After this point, there's a grace period before the object is deleted.
1786
- * @see IGCRuntimeOptions.sweepGracePeriodMs
1787
- *
1788
- * So the full sweep timeout in a session is tombstoneTimeoutMs + sweepGracePeriodMs.
1789
- */
1790
- readonly tombstoneTimeoutMs?: number;
1791
- }
1792
-
1793
- /**
1794
- * @alpha
1795
- */
1796
- export declare interface IGCRuntimeOptions {
1797
- /**
1798
- * Flag that if true, will enable running garbage collection (GC) for a new container.
1799
- *
1800
- * GC has mark phase and sweep phase. In mark phase, unreferenced objects are identified
1801
- * and marked as such in the summary. This option enables the mark phase.
1802
- * In sweep phase, unreferenced objects are eventually deleted from the container if they meet certain conditions.
1803
- * Sweep phase can be enabled using the "enableGCSweep" option.
1804
- *
1805
- * Note: This setting is persisted in the container's summary and cannot be changed.
1806
- */
1807
- gcAllowed?: boolean;
1808
- /**
1809
- * Flag that if true, will disable garbage collection for the session.
1810
- * Can be used to disable running GC on containers where it is allowed via the gcAllowed option.
1811
- */
1812
- disableGC?: boolean;
1813
- /**
1814
- * Flag that if true, will enable the full Sweep Phase of garbage collection for this session,
1815
- * where Tombstoned objects are permanently deleted from the container.
1816
- *
1817
- * IMPORTANT: This only applies if this document is allowed to run Sweep Phase.
1818
- *
1819
- * Current default behavior is for Sweep Phase not to delete Tombstoned objects,
1820
- * but merely to prevent them from being loaded.
1821
- */
1822
- enableGCSweep?: true;
1823
- /**
1824
- * Flag that will bypass optimizations and generate GC data for all nodes irrespective of whether a node
1825
- * changed or not.
1826
- */
1827
- runFullGC?: boolean;
1828
- /**
1829
- * Maximum session duration for a new container. If not present, a default value will be used.
1830
- *
1831
- * Note: This setting is persisted in the container's summary and cannot be changed.
1832
- */
1833
- sessionExpiryTimeoutMs?: number;
1834
- /**
1835
- * Delay between when Tombstone should run and when the object should be deleted.
1836
- * This grace period gives a chance to intervene to recover if needed, before Sweep deletes the object.
1837
- * If not present, a default (non-zero) value will be used.
1838
- */
1839
- sweepGracePeriodMs?: number;
1840
- /**
1841
- * Allows additional GC options to be passed.
1842
- */
1843
- [key: string]: any;
1844
- }
1845
-
1846
- /**
1847
- * The statistics of the system state after a garbage collection run.
1848
- * @alpha
1849
- */
1850
- export declare interface IGCStats extends IMarkPhaseStats, ISweepPhaseStats {
1851
- }
1852
-
1853
- /**
1854
- * In addition to the normal summary tree + stats, this contains additional stats
1855
- * only relevant at the root of the tree.
1856
- * @alpha
1857
- */
1858
- export declare interface IGeneratedSummaryStats extends ISummaryStats {
1859
- /** The total number of data stores in the container. */
1860
- readonly dataStoreCount: number;
1861
- /** The number of data stores that were summarized in this summary. */
1862
- readonly summarizedDataStoreCount: number;
1863
- /** The number of data stores whose GC reference state was updated in this summary. */
1864
- readonly gcStateUpdatedDataStoreCount?: number;
1865
- /** The size of the gc blobs in this summary. */
1866
- readonly gcTotalBlobsSize?: number;
1867
- /** The number of gc blobs in this summary. */
1868
- readonly gcBlobNodeCount?: number;
1869
- /** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */
1870
- readonly summaryNumber: number;
1871
- }
1872
-
1873
- /**
1874
- * Results of submitSummary after generating the summary tree.
1875
- * @alpha
1876
- */
1877
- export declare interface IGenerateSummaryTreeResult extends Omit<IBaseSummarizeResult, "stage"> {
1878
- readonly stage: "generate";
1879
- /** Generated summary tree. */
1880
- readonly summaryTree: ISummaryTree;
1881
- /** Stats for generated summary tree. */
1882
- readonly summaryStats: IGeneratedSummaryStats;
1883
- /** Time it took to generate the summary tree and stats. */
1884
- readonly generateDuration: number;
1885
- /** True if the full tree regeneration with no handle reuse optimizations was forced. */
1886
- readonly forcedFullTree: boolean;
1887
- }
1888
-
1889
- /**
1890
- * Properties necessary for creating a local FluidDataStoreContext
1891
- * @internal
1892
- */
1893
- export declare interface ILocalDetachedFluidDataStoreContextProps extends ILocalFluidDataStoreContextProps {
1894
- readonly channelToDataStoreFn: (channel: IFluidDataStoreChannel) => IDataStore;
1895
- }
1896
-
1897
- /**
1898
- * Properties necessary for creating a local FluidDataStoreContext
1899
- * @internal
1900
- */
1901
- export declare interface ILocalFluidDataStoreContextProps extends IFluidDataStoreContextProps {
1902
- readonly pkg: Readonly<string[]> | undefined;
1903
- readonly snapshotTree: ISnapshotTree | undefined;
1904
- readonly makeLocallyVisibleFn: () => void;
1905
- /**
1906
- * @deprecated 0.16 Issue #1635, #3631
1907
- */
1908
- readonly createProps?: any;
1909
- }
1910
-
1911
- /**
1912
- * The statistics of the system state after a garbage collection mark phase run.
1913
- * @alpha
1914
- */
1915
- export declare interface IMarkPhaseStats {
1916
- /** The number of nodes in the container. */
1917
- nodeCount: number;
1918
- /** The number of data stores in the container. */
1919
- dataStoreCount: number;
1920
- /** The number of attachment blobs in the container. */
1921
- attachmentBlobCount: number;
1922
- /** The number of unreferenced nodes in the container. */
1923
- unrefNodeCount: number;
1924
- /** The number of unreferenced data stores in the container. */
1925
- unrefDataStoreCount: number;
1926
- /** The number of unreferenced attachment blobs in the container. */
1927
- unrefAttachmentBlobCount: number;
1928
- /** The number of nodes whose reference state updated since last GC run. */
1929
- updatedNodeCount: number;
1930
- /** The number of data stores whose reference state updated since last GC run. */
1931
- updatedDataStoreCount: number;
1932
- /** The number of attachment blobs whose reference state updated since last GC run. */
1933
- updatedAttachmentBlobCount: number;
1934
- }
1935
-
1936
- /**
1937
- * @alpha
1938
- */
1939
- export declare interface INackSummaryResult extends IRetriableFailureResult {
1940
- readonly summaryNackOp: ISummaryNackMessage;
1941
- readonly ackNackDuration: number;
1942
- }
1943
-
1944
- /**
1945
- * Inactive error responses will have this header set to true
1946
- * @alpha
1947
- */
1948
- export declare const InactiveResponseHeaderKey = "isInactive";
1949
-
1950
- /**
1951
- * @alpha
1952
- */
1953
- export declare interface IOnDemandSummarizeOptions extends ISummarizeOptions {
1954
- /** Reason for generating summary. */
1955
- readonly reason: string;
1956
- /** In case of a failure, will attempt to retry based on if the failure is retriable. */
1957
- readonly retryOnFailure?: boolean;
1958
- }
1959
-
1960
- /**
1961
- * Data required to update internal tracking state after receiving a Summary Ack.
1962
- * @alpha
1963
- */
1964
- export declare interface IRefreshSummaryAckOptions {
1965
- /** Handle from the ack's summary op. */
1966
- readonly proposalHandle: string | undefined;
1967
- /** Handle from the summary ack just received */
1968
- readonly ackHandle: string;
1969
- /** Reference sequence number from the ack's summary op */
1970
- readonly summaryRefSeq: number;
1971
- /** Telemetry logger to which telemetry events will be forwarded. */
1972
- readonly summaryLogger: ITelemetryLoggerExt;
1973
- }
1974
-
1975
- /**
1976
- * Type for summarization failures that are retriable.
1977
- * @alpha
1978
- */
1979
- export declare interface IRetriableFailureResult {
1980
- readonly retryAfterSeconds?: number;
1981
- }
1982
-
1983
- /**
1984
- * Serialized state of IOrderedClientElection.
1985
- * @alpha
1986
- */
1987
- export declare interface ISerializedElection {
1988
- /** Sequence number at the time of the latest election. */
1989
- readonly electionSequenceNumber: number;
1990
- /**
1991
- * Most recently elected client id. This is either:
1992
- *
1993
- * 1. the interactive elected parent client, in which case electedClientId === electedParentId,
1994
- * and the SummaryManager on the elected client will spawn a summarizer client, or
1995
- *
1996
- * 2. the non-interactive summarizer client itself.
1997
- */
1998
- readonly electedClientId: string | undefined;
1999
- /** Most recently elected parent client id. This is always an interactive client. */
2000
- readonly electedParentId: string | undefined;
2001
- }
2002
-
2003
- /** @internal */
2004
- export declare interface ISnapshotDetails {
2005
- pkg: readonly string[];
2006
- isRootDataStore: boolean;
2007
- snapshot?: ISnapshotTree;
2008
- sequenceNumber?: number;
2009
- }
2010
-
2011
- /**
2012
- * @deprecated please use version in driver-utils
2013
- * @internal
2014
- */
2015
- export declare function isRuntimeMessage(message: ISequencedDocumentMessage): boolean;
2016
-
2017
- /**
2018
- * Results of submitSummary after submitting the summarize op.
2019
- * @alpha
2020
- */
2021
- export declare interface ISubmitSummaryOpResult extends Omit<IUploadSummaryResult, "stage" | "error"> {
2022
- readonly stage: "submit";
2023
- /** The client sequence number of the summarize op submitted for the summary. */
2024
- readonly clientSequenceNumber: number;
2025
- /** Time it took to submit the summarize op to the broadcasting service. */
2026
- readonly submitOpDuration: number;
2027
- }
2028
-
2029
- /**
2030
- * @alpha
2031
- */
2032
- export declare interface ISubmitSummaryOptions extends ISummarizeOptions {
2033
- /** Logger to use for correlated summary events */
2034
- readonly summaryLogger: ITelemetryLoggerExt;
2035
- /** Tells when summary process should be cancelled */
2036
- readonly cancellationToken: ISummaryCancellationToken;
2037
- /** Summarization may be attempted multiple times. This tells whether this is the final summarization attempt. */
2038
- readonly finalAttempt?: boolean;
2039
- /** The sequence number of the latest summary used to validate if summary state is correct before summarizing */
2040
- readonly latestSummaryRefSeqNum: number;
2041
- }
2042
-
2043
- /**
2044
- * @alpha
2045
- */
2046
- export declare interface ISummarizeEventProps {
2047
- result: "success" | "failure" | "canceled";
2048
- currentAttempt: number;
2049
- maxAttempts: number;
2050
- error?: any;
2051
- }
2052
-
2053
- /**
2054
- * Options affecting summarize behavior.
2055
- * @alpha
2056
- */
2057
- export declare interface ISummarizeOptions {
2058
- /** True to generate the full tree with no handle reuse optimizations; defaults to false */
2059
- readonly fullTree?: boolean;
2060
- /**
2061
- * True to ask the server what the latest summary is first; defaults to false
2062
- *
2063
- * @deprecated Summarize will not refresh latest snapshot state anymore. Instead it updates the cache and closes.
2064
- * It's expected a new summarizer client will be created, likely by the same parent.
2065
- */
2066
- readonly refreshLatestAck?: boolean;
2067
- }
2068
-
2069
- /**
2070
- * @alpha
2071
- */
2072
- export declare interface ISummarizer extends IEventProvider<ISummarizerEvents> {
2073
- /**
2074
- * Allows {@link ISummarizer} to be used with our {@link @fluidframework/core-interfaces#FluidObject} pattern.
2075
- */
2076
- readonly ISummarizer?: ISummarizer;
2077
- stop(reason: SummarizerStopReason): void;
2078
- close(): void;
2079
- run(onBehalfOf: string): Promise<SummarizerStopReason>;
2080
- /**
2081
- * Attempts to generate a summary on demand. If already running, takes no action.
2082
- * @param options - options controlling the summarize attempt
2083
- * @returns an alreadyRunning promise if a summarize attempt is already in progress,
2084
- * which will resolve when the current attempt completes. At that point caller can
2085
- * decide to try again or not. Otherwise, it will return an object containing promises
2086
- * that resolve as the summarize attempt progresses. They will resolve with success
2087
- * false if a failure is encountered.
2088
- */
2089
- summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults;
2090
- /**
2091
- * Enqueue an attempt to summarize after the specified sequence number.
2092
- * If afterSequenceNumber is provided, the summarize attempt is "enqueued"
2093
- * to run once an eligible op comes in with sequenceNumber \>= afterSequenceNumber.
2094
- * @param options - options controlling the summarize attempt
2095
- * @returns an object containing an alreadyEnqueued flag to indicate if another
2096
- * summarize attempt has already been enqueued. It also may contain an overridden flag
2097
- * when alreadyEnqueued is true, that indicates whether this attempt forced the
2098
- * previous attempt to abort. If this attempt becomes enqueued, it returns an object
2099
- * containing promises that resolve as the summarize attempt progresses. They will
2100
- * resolve with success false if a failure is encountered.
2101
- */
2102
- enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult;
2103
- }
2104
-
2105
- /**
2106
- * @alpha
2107
- */
2108
- export declare interface ISummarizeResults {
2109
- /** Resolves when we generate, upload, and submit the summary. */
2110
- readonly summarySubmitted: Promise<SummarizeResultPart<SubmitSummaryResult, SubmitSummaryFailureData>>;
2111
- /** Resolves when we observe our summarize op broadcast. */
2112
- readonly summaryOpBroadcasted: Promise<SummarizeResultPart<IBroadcastSummaryResult>>;
2113
- /** Resolves when we receive a summaryAck or summaryNack. */
2114
- readonly receivedSummaryAckOrNack: Promise<SummarizeResultPart<IAckSummaryResult, INackSummaryResult>>;
2115
- }
2116
-
2117
- /**
2118
- * @alpha
2119
- */
2120
- export declare interface ISummarizerEvents extends IEvent {
2121
- (event: "summarize", listener: (props: ISummarizeEventProps) => void): any;
2122
- }
2123
-
2124
- /**
2125
- * @alpha
2126
- */
2127
- export declare interface ISummarizerInternalsProvider {
2128
- /** Encapsulates the work to walk the internals of the running container to generate a summary */
2129
- submitSummary(options: ISubmitSummaryOptions): Promise<SubmitSummaryResult>;
2130
- /** Callback whenever a new SummaryAck is received, to update internal tracking state */
2131
- refreshLatestSummaryAck(options: IRefreshSummaryAckOptions): Promise<void>;
2132
- }
2133
-
2134
- /**
2135
- * @alpha
2136
- */
2137
- export declare interface ISummarizerRuntime extends IConnectableRuntime {
2138
- readonly logger: ITelemetryLoggerExt;
2139
- /** clientId of parent (non-summarizing) container that owns summarizer container */
2140
- readonly summarizerClientId: string | undefined;
2141
- readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
2142
- disposeFn(): void;
2143
- closeFn(): void;
2144
- on(event: "op", listener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void): this;
2145
- off(event: "op", listener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void): this;
2146
- }
2147
-
2148
- /**
2149
- * @internal
2150
- */
2151
- export declare interface ISummarizingWarning extends ContainerWarning {
2152
- readonly errorType: "summarizingError";
2153
- readonly logged: boolean;
2154
- }
2155
-
2156
- /**
2157
- * A single summary which can be tracked as it goes through its life cycle.
2158
- * The life cycle is: Local to Broadcast to Acked/Nacked.
2159
- * @alpha
2160
- */
2161
- export declare interface ISummary {
2162
- readonly clientId: string;
2163
- readonly clientSequenceNumber: number;
2164
- waitBroadcast(): Promise<ISummaryOpMessage>;
2165
- waitAckNack(): Promise<ISummaryAckMessage | ISummaryNackMessage>;
2166
- }
2167
-
2168
- /**
2169
- * Interface for summary ack messages with typed contents.
2170
- * @alpha
2171
- */
2172
- export declare interface ISummaryAckMessage extends ISequencedDocumentMessage {
2173
- type: MessageType.SummaryAck;
2174
- contents: ISummaryAck;
2175
- }
2176
-
2177
- /**
2178
- * @alpha
2179
- */
2180
- export declare interface ISummaryBaseConfiguration {
2181
- /**
2182
- * Delay before first attempt to spawn summarizing container.
2183
- */
2184
- initialSummarizerDelayMs: number;
2185
- /**
2186
- * Defines the maximum allowed time to wait for a pending summary ack.
2187
- * The maximum amount of time client will wait for a summarize is the minimum of
2188
- * maxSummarizeAckWaitTime (currently 3 * 60 * 1000) and maxAckWaitTime.
2189
- */
2190
- maxAckWaitTime: number;
2191
- /**
2192
- * Defines the maximum number of Ops in between Summaries that can be
2193
- * allowed before forcibly electing a new summarizer client.
2194
- */
2195
- maxOpsSinceLastSummary: number;
2196
- }
2197
-
2198
- /**
2199
- * Similar to AbortSignal, but using promise instead of events
2200
- * @alpha
2201
- */
2202
- export declare type ISummaryCancellationToken = ICancellationToken<SummarizerStopReason>;
2203
-
2204
- /**
2205
- * @alpha
2206
- */
2207
- export declare interface ISummaryCollectionOpEvents extends IEvent {
2208
- (event: OpActionEventName, listener: OpActionEventListener): any;
2209
- }
2210
-
2211
- /**
2212
- * @alpha
2213
- */
2214
- export declare type ISummaryConfiguration = ISummaryConfigurationDisableSummarizer | ISummaryConfigurationDisableHeuristics | ISummaryConfigurationHeuristics;
2215
-
2216
- /**
2217
- * @alpha
2218
- */
2219
- export declare interface ISummaryConfigurationDisableHeuristics extends ISummaryBaseConfiguration {
2220
- state: "disableHeuristics";
2221
- }
2222
-
2223
- /**
2224
- * @alpha
2225
- */
2226
- export declare interface ISummaryConfigurationDisableSummarizer {
2227
- state: "disabled";
2228
- }
2229
-
2230
- /**
2231
- * @alpha
2232
- */
2233
- export declare interface ISummaryConfigurationHeuristics extends ISummaryBaseConfiguration {
2234
- state: "enabled";
2235
- /**
2236
- * Defines the maximum allowed time, since the last received Ack, before running the summary
2237
- * with reason maxTime.
2238
- * For example, say we receive ops one by one just before the idle time is triggered.
2239
- * In this case, we still want to run a summary since it's been a while since the last summary.
2240
- */
2241
- maxTime: number;
2242
- /**
2243
- * Defines the maximum number of Ops, since the last received Ack, that can be allowed
2244
- * before running the summary with reason maxOps.
2245
- */
2246
- maxOps: number;
2247
- /**
2248
- * Defines the minimum number of Ops, since the last received Ack, that can be allowed
2249
- * before running the last summary.
2250
- */
2251
- minOpsForLastSummaryAttempt: number;
2252
- /**
2253
- * Defines the lower boundary for the allowed time in between summarizations.
2254
- * Pairs with maxIdleTime to form a range.
2255
- * For example, if we only receive 1 op, we don't want to have the same idle time as say 100 ops.
2256
- * Based on the boundaries we set in minIdleTime and maxIdleTime, the idle time will change
2257
- * linearly depending on the number of ops we receive.
2258
- */
2259
- minIdleTime: number;
2260
- /**
2261
- * Defines the upper boundary for the allowed time in between summarizations.
2262
- * Pairs with minIdleTime to form a range.
2263
- * For example, if we only receive 1 op, we don't want to have the same idle time as say 100 ops.
2264
- * Based on the boundaries we set in minIdleTime and maxIdleTime, the idle time will change
2265
- * linearly depending on the number of ops we receive.
2266
- */
2267
- maxIdleTime: number;
2268
- /**
2269
- * Runtime op weight to use in heuristic summarizing.
2270
- * This number is a multiplier on the number of runtime ops we process when running summarize heuristics.
2271
- * For example: (multiplier) * (number of runtime ops) = weighted number of runtime ops
2272
- */
2273
- runtimeOpWeight: number;
2274
- /**
2275
- * Non-runtime op weight to use in heuristic summarizing
2276
- * This number is a multiplier on the number of non-runtime ops we process when running summarize heuristics.
2277
- * For example: (multiplier) * (number of non-runtime ops) = weighted number of non-runtime ops
2278
- */
2279
- nonRuntimeOpWeight: number;
2280
- /**
2281
- * Number of ops since last summary needed before a non-runtime op can trigger running summary heuristics.
2282
- *
2283
- * Note: Any runtime ops sent before the threshold is reached will trigger heuristics normally.
2284
- * This threshold ONLY applies to non-runtime ops triggering summaries.
2285
- *
2286
- * For example: Say the threshold is 20. Sending 19 non-runtime ops will not trigger any heuristic checks.
2287
- * Sending the 20th non-runtime op will trigger the heuristic checks for summarizing.
2288
- */
2289
- nonRuntimeHeuristicThreshold?: number;
2290
- }
2291
-
2292
- /**
2293
- * The properties of an ISequencedDocumentMessage to be stored in the metadata blob in summary.
2294
- * @alpha
2295
- */
2296
- export declare type ISummaryMetadataMessage = Pick<ISequencedDocumentMessage, "clientId" | "clientSequenceNumber" | "minimumSequenceNumber" | "referenceSequenceNumber" | "sequenceNumber" | "timestamp" | "type">;
2297
-
2298
- /**
2299
- * Interface for summary nack messages with typed contents.
2300
- * @alpha
2301
- */
2302
- export declare interface ISummaryNackMessage extends ISequencedDocumentMessage {
2303
- type: MessageType.SummaryNack;
2304
- contents: ISummaryNack;
2305
- }
2306
-
2307
- /**
2308
- * Interface for summary op messages with typed contents.
2309
- * @alpha
2310
- */
2311
- export declare interface ISummaryOpMessage extends ISequencedDocumentMessage {
2312
- type: MessageType.Summarize;
2313
- contents: ISummaryContent;
2314
- }
2315
-
2316
- /**
2317
- * @alpha
2318
- */
2319
- export declare interface ISummaryRuntimeOptions {
2320
- /** Override summary configurations set by the server. */
2321
- summaryConfigOverrides?: ISummaryConfiguration;
2322
- /**
2323
- * Delay before first attempt to spawn summarizing container.
2324
- *
2325
- * @deprecated Use {@link ISummaryRuntimeOptions.summaryConfigOverrides}'s
2326
- * {@link ISummaryBaseConfiguration.initialSummarizerDelayMs} instead.
2327
- */
2328
- initialSummarizerDelayMs?: number;
2329
- }
2330
-
2331
- /**
2332
- * The statistics of the system state after a garbage collection sweep phase run.
2333
- * @alpha
2334
- */
2335
- export declare interface ISweepPhaseStats {
2336
- /** The number of nodes in the lifetime of the container. */
2337
- lifetimeNodeCount: number;
2338
- /** The number of data stores in the lifetime of the container. */
2339
- lifetimeDataStoreCount: number;
2340
- /** The number of attachment blobs in the lifetime of the container. */
2341
- lifetimeAttachmentBlobCount: number;
2342
- /** The number of deleted nodes in the container. */
2343
- deletedNodeCount: number;
2344
- /** The number of deleted data stores in the container. */
2345
- deletedDataStoreCount: number;
2346
- /** The number of deleted attachment blobs in the container. */
2347
- deletedAttachmentBlobCount: number;
2348
- }
2349
-
2350
- /**
2351
- * Results of submitSummary after uploading the tree to storage.
2352
- * @alpha
2353
- */
2354
- export declare interface IUploadSummaryResult extends Omit<IGenerateSummaryTreeResult, "stage"> {
2355
- readonly stage: "upload";
2356
- /** The handle returned by storage pointing to the uploaded summary tree. */
2357
- readonly handle: string;
2358
- /** Time it took to upload the summary tree to storage. */
2359
- readonly uploadDuration: number;
2360
- }
2361
-
2362
- /**
2363
- * context implementation for "attached" data store runtime.
2364
- * Various workflows (snapshot creation, requests) result in .realize() being called
2365
- * on context, resulting in instantiation and attachment of runtime.
2366
- * Runtime is created using data store factory that is associated with this context.
2367
- * @internal
2368
- */
2369
- export declare class LocalFluidDataStoreContext extends LocalFluidDataStoreContextBase {
2370
- constructor(props: ILocalFluidDataStoreContextProps);
2371
- }
2372
-
2373
- /**
2374
- * Base class for detached & attached context classes
2375
- * @internal
2376
- */
2377
- export declare class LocalFluidDataStoreContextBase extends FluidDataStoreContext {
2378
- private readonly snapshotTree;
2379
- /**
2380
- * @deprecated 0.16 Issue #1635, #3631
2381
- */
2382
- readonly createProps?: any;
2383
- constructor(props: ILocalFluidDataStoreContextProps);
2384
- setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;
2385
- /**
2386
- * @see FluidDataStoreContext.getAttachData
2387
- */
2388
- getAttachData(includeGCData: boolean, telemetryContext?: ITelemetryContext): {
2389
- attachSummary: ISummaryTreeWithStats;
2390
- type: string;
2391
- };
2392
- private readonly initialSnapshotDetailsP;
2393
- getInitialSnapshotDetails(): Promise<ISnapshotDetails>;
2394
- /**
2395
- * A context should only be marked as deleted when its a remote context.
2396
- * Session Expiry at the runtime level should have closed the container creating the local data store context
2397
- * before delete is even possible. Session Expiry is at 30 days, and sweep is done 36+ days later from the time
2398
- * it was unreferenced. Thus the sweeping container should have loaded from a snapshot and thus creating a remote
2399
- * context.
2400
- */
2401
- delete(): void;
2402
- }
2403
-
2404
- /**
2405
- * Can be useful in testing as well as in places where caller does not use cancellation.
2406
- * This object implements ISummaryCancellationToken interface but cancellation is never leveraged.
2407
- * @internal
2408
- */
2409
- export declare const neverCancelledSummaryToken: ISummaryCancellationToken;
2410
-
2411
- /**
2412
- * @alpha
2413
- */
2414
- export declare type OpActionEventListener = (op: ISequencedDocumentMessage) => void;
2415
-
2416
- /**
2417
- * @alpha
2418
- */
2419
- export declare type OpActionEventName = MessageType.Summarize | MessageType.SummaryAck | MessageType.SummaryNack | "default";
2420
-
2421
- /**
2422
- * Additional details expected for any recently added message.
2423
- * @internal
2424
- */
2425
- export declare interface RecentlyAddedContainerRuntimeMessageDetails {
2426
- /** Info describing how to handle this op in case the type is unrecognized (default: fail to process) */
2427
- compatDetails: IContainerRuntimeMessageCompatDetails;
2428
- }
2429
-
2430
- /**
2431
- * The full set of parsed header data that may be found on Runtime requests
2432
- * @internal
2433
- */
2434
- export declare interface RuntimeHeaderData {
2435
- wait?: boolean;
2436
- viaHandle?: boolean;
2437
- allowTombstone?: boolean;
2438
- allowInactive?: boolean;
2439
- }
2440
-
2441
- /**
2442
- * Accepted header keys for requests coming to the runtime.
2443
- * @internal
2444
- */
2445
- export declare enum RuntimeHeaders {
2446
- /** True to wait for a data store to be created and loaded before returning it. */
2447
- wait = "wait",
2448
- /** True if the request is coming from an IFluidHandle. */
2449
- viaHandle = "viaHandle"
2450
- }
2451
-
2452
- /**
2453
- * The data in summarizer result when submit summary stage fails.
2454
- * @alpha
2455
- */
2456
- export declare interface SubmitSummaryFailureData extends IRetriableFailureResult {
2457
- stage: SummaryStage;
2458
- }
2459
-
2460
- /**
2461
- * Strict type representing result of a submitSummary attempt.
2462
- * The result consists of 4 possible stages, each with its own data.
2463
- * The data is cumulative, so each stage will contain the data from the previous stages.
2464
- * If the final "submitted" stage is not reached, the result may contain the error object.
2465
- *
2466
- * Stages:
2467
- *
2468
- * 1. "base" - stopped before the summary tree was even generated, and the result only contains the base data
2469
- *
2470
- * 2. "generate" - the summary tree was generated, and the result will contain that tree + stats
2471
- *
2472
- * 3. "upload" - the summary was uploaded to storage, and the result contains the server-provided handle
2473
- *
2474
- * 4. "submit" - the summarize op was submitted, and the result contains the op client sequence number.
2475
- * @alpha
2476
- */
2477
- export declare type SubmitSummaryResult = IBaseSummarizeResult | IGenerateSummaryTreeResult | IUploadSummaryResult | ISubmitSummaryOpResult;
2478
-
2479
- /**
2480
- * Summarizer is responsible for coordinating when to generate and send summaries.
2481
- * It is the main entry point for summary work.
2482
- * It is created only by summarizing container (i.e. one with clientType === "summarizer")
2483
- * @alpha
2484
- */
2485
- export declare class Summarizer extends TypedEventEmitter<ISummarizerEvents> implements ISummarizer {
2486
- /** Reference to runtime that created this object.
2487
- * i.e. runtime with clientType === "summarizer"
2488
- */
2489
- private readonly runtime;
2490
- private readonly configurationGetter;
2491
- /** Represents an object that can generate summary.
2492
- * In practical terms, it's same runtime (this.runtime) with clientType === "summarizer".
2493
- */
2494
- private readonly internalsProvider;
2495
- readonly summaryCollection: SummaryCollection;
2496
- private readonly runCoordinatorCreateFn;
2497
- get ISummarizer(): this;
2498
- private readonly logger;
2499
- private runningSummarizer?;
2500
- private _disposed;
2501
- private starting;
2502
- private readonly stopDeferred;
2503
- constructor(
2504
- /** Reference to runtime that created this object.
2505
- * i.e. runtime with clientType === "summarizer"
2506
- */
2507
- runtime: ISummarizerRuntime, configurationGetter: () => ISummaryConfiguration,
2508
- /** Represents an object that can generate summary.
2509
- * In practical terms, it's same runtime (this.runtime) with clientType === "summarizer".
2510
- */
2511
- internalsProvider: ISummarizerInternalsProvider, handleContext: IFluidHandleContext, summaryCollection: SummaryCollection, runCoordinatorCreateFn: (runtime: IConnectableRuntime) => Promise<ICancellableSummarizerController>);
2512
- run(onBehalfOf: string): Promise<SummarizerStopReason>;
2513
- /**
2514
- * Stops the summarizer from running. This will complete
2515
- * the run promise, and also close the container.
2516
- * @param reason - reason code for stopping
2517
- */
2518
- stop(reason: SummarizerStopReason): void;
2519
- close(): void;
2520
- private runCore;
2521
- /**
2522
- * Should we try to run a last summary for the given stop reason?
2523
- * Currently only allows "parentNotConnected"
2524
- * @param stopReason - SummarizerStopReason
2525
- * @returns `true` if the stop reason can run a last summary, otherwise `false`.
2526
- */
2527
- static stopReasonCanRunLastSummary(stopReason: SummarizerStopReason): boolean;
2528
- private _heuristicData;
2529
- /**
2530
- * Put the summarizer in a started state, including creating and initializing the RunningSummarizer.
2531
- * The start request can come either from the SummaryManager (in the auto-summarize case) or from the user
2532
- * (in the on-demand case).
2533
- * @param onBehalfOf - ID of the client that requested that the summarizer start
2534
- * @param runCoordinator - cancellation token
2535
- * @param newConfig - Summary configuration to override the existing config when invoking the RunningSummarizer.
2536
- * @returns A promise that is fulfilled when the RunningSummarizer is ready.
2537
- */
2538
- private start;
2539
- private readonly handleSummarizeEvent;
2540
- /**
2541
- * Disposes of resources after running. This cleanup will
2542
- * clear any outstanding timers and reset some of the state
2543
- * properties.
2544
- * Called by ContainerRuntime when it is disposed, as well as at the end the run().
2545
- */
2546
- dispose(): void;
2547
- summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults;
2548
- enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult;
2549
- recordSummaryAttempt?(summaryRefSeqNum?: number): void;
2550
- }
2551
-
2552
- /**
2553
- * @alpha
2554
- */
2555
- export declare type SummarizeResultPart<TSuccess, TFailure = undefined> = {
2556
- success: true;
2557
- data: TSuccess;
2558
- } | {
2559
- success: false;
2560
- data: TFailure | undefined;
2561
- message: string;
2562
- error: any;
2563
- };
2564
-
2565
- /**
2566
- * @alpha
2567
- */
2568
- export declare type SummarizerStopReason =
2569
- /** Summarizer client failed to summarize in all attempts. */
2570
- "failToSummarize"
2571
- /** Parent client reported that it is no longer connected. */
2572
- | "parentNotConnected"
2573
- /**
2574
- * Parent client reported that it is no longer elected the summarizer.
2575
- * This is the normal flow; a disconnect will always trigger the parent
2576
- * client to no longer be elected as responsible for summaries. Then it
2577
- * tries to stop its spawned summarizer client.
2578
- */
2579
- | "notElectedParent"
2580
- /**
2581
- * We are not already running the summarizer and we are not the current elected client id.
2582
- */
2583
- | "notElectedClient"
2584
- /** Summarizer client was disconnected */
2585
- | "summarizerClientDisconnected"
2586
- /** running summarizer threw an exception */
2587
- | "summarizerException"
2588
- /**
2589
- * The previous summary state on the summarizer is not the most recently acked summary. this also happens when the
2590
- * first submitSummary attempt fails for any reason and there's a 2nd summary attempt without an ack
2591
- */
2592
- | "latestSummaryStateStale";
2593
-
2594
- /**
2595
- * Data structure that looks at the op stream to track summaries as they
2596
- * are broadcast, acked and nacked.
2597
- * It provides functionality for watching specific summaries.
2598
- * @alpha
2599
- */
2600
- export declare class SummaryCollection extends TypedEventEmitter<ISummaryCollectionOpEvents> {
2601
- private readonly deltaManager;
2602
- private readonly logger;
2603
- private readonly summaryWatchers;
2604
- private readonly pendingSummaries;
2605
- private refreshWaitNextAck;
2606
- private lastSummaryTimestamp;
2607
- private maxAckWaitTime;
2608
- private pendingAckTimerTimeoutCallback;
2609
- private lastAck;
2610
- get latestAck(): IAckedSummary | undefined;
2611
- emit(event: OpActionEventName, ...args: Parameters<OpActionEventListener>): boolean;
2612
- get opsSinceLastAck(): number;
2613
- addOpListener(listener: () => void): void;
2614
- removeOpListener(listener: () => void): void;
2615
- constructor(deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, logger: ITelemetryLoggerExt);
2616
- /**
2617
- * Creates and returns a summary watcher for a specific client.
2618
- * This will allow for local sent summaries to be better tracked.
2619
- * @param clientId - client id for watcher
2620
- */
2621
- createWatcher(clientId: string): IClientSummaryWatcher;
2622
- removeWatcher(clientId: string): void;
2623
- setPendingAckTimerTimeoutCallback(maxAckWaitTime: number, timeoutCallback: () => void): void;
2624
- unsetPendingAckTimerTimeoutCallback(): void;
2625
- /**
2626
- * Returns a promise that resolves once all pending summary ops
2627
- * have been acked or nacked.
2628
- */
2629
- waitFlushed(): Promise<IAckedSummary | undefined>;
2630
- /**
2631
- * Returns a promise that resolves once a summary is acked that has a reference
2632
- * sequence number greater than or equal to the passed in sequence number.
2633
- * @param referenceSequenceNumber - reference sequence number to wait for
2634
- * @returns The latest acked summary
2635
- */
2636
- waitSummaryAck(referenceSequenceNumber: number): Promise<IAckedSummary>;
2637
- private parseContent;
2638
- /**
2639
- * Handler for ops; only handles ops relating to summaries.
2640
- * @param op - op message to handle
2641
- */
2642
- private handleOp;
2643
- private handleSummaryOp;
2644
- private handleSummaryAck;
2645
- private handleSummaryNack;
2646
- }
2647
-
2648
- /**
2649
- * The stages of Summarize, used to describe how far progress succeeded in case of a failure at a later stage.
2650
- * @alpha
2651
- */
2652
- export declare type SummaryStage = SubmitSummaryResult["stage"] | "unknown";
2653
-
2654
- /**
2655
- * Tombstone error responses will have this header set to true
2656
- * @alpha
2657
- */
2658
- export declare const TombstoneResponseHeaderKey = "isTombstoned";
2659
-
2660
- /**
2661
- * Represents an unrecognized TypedContainerRuntimeMessage, e.g. a message from a future version of the container runtime.
2662
- * @internal
2663
- */
2664
- export declare interface UnknownContainerRuntimeMessage extends Partial<RecentlyAddedContainerRuntimeMessageDetails> {
2665
- /** Invalid type of the op, within the ContainerRuntime's domain. This value should never exist at runtime.
2666
- * This is useful for type narrowing but should never be used as an actual message type at runtime.
2667
- * Actual value will not be "__unknown...", but the type `Exclude<string, ContainerMessageType>` is not supported.
2668
- */
2669
- type: "__unknown_container_message_type__never_use_as_value__";
2670
- /** Domain-specific contents, but not decipherable by an unknown op. */
2671
- contents: unknown;
2672
- }
2673
-
2674
- /**
2675
- * Unpacks runtime messages.
2676
- *
2677
- * @remarks This API makes no promises regarding backward-compatibility. This is internal API.
2678
- * @param message - message (as it observed in storage / service)
2679
- * @returns whether the given message was unpacked
2680
- *
2681
- * @internal
2682
- */
2683
- export declare function unpackRuntimeMessage(message: ISequencedDocumentMessage): boolean;
2684
-
2685
- export { }