@fluidframework/runtime-definitions 2.0.0-internal.3.0.0 → 2.0.0-internal.3.1.0

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.
@@ -3,58 +3,60 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ITelemetryBaseLogger, IDisposable, IEvent, IEventProvider } from "@fluidframework/common-definitions";
7
6
  import {
8
- IFluidRouter,
9
- IProvideFluidHandleContext,
10
- IFluidHandle,
11
- IRequest,
12
- IResponse,
13
- FluidObject,
7
+ ITelemetryBaseLogger,
8
+ IDisposable,
9
+ IEvent,
10
+ IEventProvider,
11
+ } from "@fluidframework/common-definitions";
12
+ import {
13
+ IFluidRouter,
14
+ IProvideFluidHandleContext,
15
+ IFluidHandle,
16
+ IRequest,
17
+ IResponse,
18
+ FluidObject,
14
19
  } from "@fluidframework/core-interfaces";
15
20
  import {
16
- IAudience,
17
- IDeltaManager,
18
- AttachState,
19
- ILoaderOptions,
21
+ IAudience,
22
+ IDeltaManager,
23
+ AttachState,
24
+ ILoaderOptions,
20
25
  } from "@fluidframework/container-definitions";
21
26
  import { IDocumentStorageService } from "@fluidframework/driver-definitions";
22
27
  import {
23
- IClientDetails,
24
- IDocumentMessage,
25
- IQuorumClients,
26
- ISequencedDocumentMessage,
27
- ISnapshotTree,
28
+ IClientDetails,
29
+ IDocumentMessage,
30
+ IQuorumClients,
31
+ ISequencedDocumentMessage,
32
+ ISnapshotTree,
28
33
  } from "@fluidframework/protocol-definitions";
29
34
  import { IProvideFluidDataStoreFactory } from "./dataStoreFactory";
30
35
  import { IProvideFluidDataStoreRegistry } from "./dataStoreRegistry";
31
- import {
32
- IGarbageCollectionData,
33
- IGarbageCollectionDetailsBase,
34
- } from "./garbageCollection";
36
+ import { IGarbageCollectionData, IGarbageCollectionDetailsBase } from "./garbageCollection";
35
37
  import { IInboundSignalMessage } from "./protocol";
36
38
  import {
37
- CreateChildSummarizerNodeParam,
38
- ISummarizerNodeWithGC,
39
- ISummaryTreeWithStats,
40
- ITelemetryContext,
41
- SummarizeInternalFn,
39
+ CreateChildSummarizerNodeParam,
40
+ ISummarizerNodeWithGC,
41
+ ISummaryTreeWithStats,
42
+ ITelemetryContext,
43
+ SummarizeInternalFn,
42
44
  } from "./summary";
43
45
 
44
46
  /**
45
47
  * Runtime flush mode handling
46
48
  */
47
49
  export enum FlushMode {
48
- /**
49
- * In Immediate flush mode the runtime will immediately send all operations to the driver layer.
50
- */
51
- Immediate,
52
-
53
- /**
54
- * When in TurnBased flush mode the runtime will buffer operations in the current turn and send them as a single
55
- * batch at the end of the turn. The flush call on the runtime can be used to force send the current batch.
56
- */
57
- TurnBased,
50
+ /**
51
+ * In Immediate flush mode the runtime will immediately send all operations to the driver layer.
52
+ */
53
+ Immediate,
54
+
55
+ /**
56
+ * When in TurnBased flush mode the runtime will buffer operations in the current turn and send them as a single
57
+ * batch at the end of the turn. The flush call on the runtime can be used to force send the current batch.
58
+ */
59
+ TurnBased,
58
60
  }
59
61
 
60
62
  /**
@@ -62,40 +64,40 @@ export enum FlushMode {
62
64
  * locally within the container only or visible globally to all clients.
63
65
  */
64
66
  export const VisibilityState = {
65
- /**
66
- * Indicates that the object is not visible. This is the state when an object is first created.
67
- */
68
- NotVisible: "NotVisible",
69
-
70
- /**
71
- * Indicates that the object is visible locally within the container. This is the state when an object is attached
72
- * to the container's graph but the container itself isn't globally visible. The object's state goes from not
73
- * visible to locally visible.
74
- */
75
- LocallyVisible: "LocallyVisible",
76
-
77
- /**
78
- * Indicates that the object is visible globally to all clients. This is the state of an object in 2 scenarios:
79
- *
80
- * 1. It is attached to the container's graph when the container is globally visible. The object's state goes from
81
- * not visible to globally visible.
82
- *
83
- * 2. When a container becomes globally visible, all locally visible objects go from locally visible to globally
84
- * visible.
85
- */
86
- GloballyVisible: "GloballyVisible",
67
+ /**
68
+ * Indicates that the object is not visible. This is the state when an object is first created.
69
+ */
70
+ NotVisible: "NotVisible",
71
+
72
+ /**
73
+ * Indicates that the object is visible locally within the container. This is the state when an object is attached
74
+ * to the container's graph but the container itself isn't globally visible. The object's state goes from not
75
+ * visible to locally visible.
76
+ */
77
+ LocallyVisible: "LocallyVisible",
78
+
79
+ /**
80
+ * Indicates that the object is visible globally to all clients. This is the state of an object in 2 scenarios:
81
+ *
82
+ * 1. It is attached to the container's graph when the container is globally visible. The object's state goes from
83
+ * not visible to globally visible.
84
+ *
85
+ * 2. When a container becomes globally visible, all locally visible objects go from locally visible to globally
86
+ * visible.
87
+ */
88
+ GloballyVisible: "GloballyVisible",
87
89
  };
88
90
  export type VisibilityState = typeof VisibilityState[keyof typeof VisibilityState];
89
91
 
90
92
  export interface IContainerRuntimeBaseEvents extends IEvent {
91
- (event: "batchBegin", listener: (op: ISequencedDocumentMessage) => void);
92
- /**
93
- * @param runtimeMessage - tells if op is runtime op. If it is, it was unpacked, i.e. it's type and content
94
- * represent internal container runtime type / content.
95
- */
96
- (event: "op", listener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void);
97
- (event: "batchEnd", listener: (error: any, op: ISequencedDocumentMessage) => void);
98
- (event: "signal", listener: (message: IInboundSignalMessage, local: boolean) => void);
93
+ (event: "batchBegin", listener: (op: ISequencedDocumentMessage) => void);
94
+ /**
95
+ * @param runtimeMessage - tells if op is runtime op. If it is, it was unpacked, i.e. it's type and content
96
+ * represent internal container runtime type / content.
97
+ */
98
+ (event: "op", listener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void);
99
+ (event: "batchEnd", listener: (error: any, op: ISequencedDocumentMessage) => void);
100
+ (event: "signal", listener: (message: IInboundSignalMessage, local: boolean) => void);
99
101
  }
100
102
 
101
103
  /**
@@ -116,109 +118,108 @@ export type AliasResult = "Success" | "Conflict" | "AlreadyAliased";
116
118
  * - Can be assigned an alias
117
119
  */
118
120
  export interface IDataStore extends IFluidRouter {
119
- /**
120
- * Attempt to assign an alias to the datastore.
121
- * If the operation succeeds, the datastore can be referenced
122
- * by the supplied alias and will not be garbage collected.
123
- *
124
- * @param alias - Given alias for this datastore.
125
- */
126
- trySetAlias(alias: string): Promise<AliasResult>;
127
-
128
- /**
129
- * Exposes a handle to the root object / entryPoint of the data store. Use this as the primary way of interacting
130
- * with it. If this property is undefined (meaning that exposing the entryPoint hasn't been implemented in a
131
- * particular scenario) fall back to the current approach of requesting the root object through the request pattern.
132
- *
133
- * @remarks The plan is that eventually the data store will stop providing IFluidRouter functionality, this property
134
- * will become non-optional and return an IFluidHandle (no undefined) and will become the only way to access
135
- * the data store's entryPoint.
136
- */
137
- readonly entryPoint?: IFluidHandle<FluidObject>;
121
+ /**
122
+ * Attempt to assign an alias to the datastore.
123
+ * If the operation succeeds, the datastore can be referenced
124
+ * by the supplied alias and will not be garbage collected.
125
+ *
126
+ * @param alias - Given alias for this datastore.
127
+ */
128
+ trySetAlias(alias: string): Promise<AliasResult>;
129
+
130
+ /**
131
+ * Exposes a handle to the root object / entryPoint of the data store. Use this as the primary way of interacting
132
+ * with it. If this property is undefined (meaning that exposing the entryPoint hasn't been implemented in a
133
+ * particular scenario) fall back to the current approach of requesting the root object through the request pattern.
134
+ *
135
+ * @remarks The plan is that eventually the data store will stop providing IFluidRouter functionality, this property
136
+ * will become non-optional and return an IFluidHandle (no undefined) and will become the only way to access
137
+ * the data store's entryPoint.
138
+ */
139
+ readonly entryPoint?: IFluidHandle<FluidObject>;
138
140
  }
139
141
 
140
142
  /**
141
143
  * A reduced set of functionality of IContainerRuntime that a data store context/data store runtime will need
142
144
  * TODO: this should be merged into IFluidDataStoreContext
143
145
  */
144
- export interface IContainerRuntimeBase extends
145
- IEventProvider<IContainerRuntimeBaseEvents>,
146
- IProvideFluidHandleContext {
147
-
148
- readonly logger: ITelemetryBaseLogger;
149
- readonly clientDetails: IClientDetails;
150
-
151
- /**
152
- * Invokes the given callback and guarantees that all operations generated within the callback will be ordered
153
- * sequentially. Total size of all messages must be less than maxOpSize.
154
- */
155
- orderSequentially(callback: () => void): void;
156
-
157
- /**
158
- * Executes a request against the container runtime
159
- */
160
- request(request: IRequest): Promise<IResponse>;
161
-
162
- /**
163
- * Submits a container runtime level signal to be sent to other clients.
164
- * @param type - Type of the signal.
165
- * @param content - Content of the signal.
166
- */
167
- submitSignal(type: string, content: any): void;
168
-
169
- /**
170
- * @deprecated 0.16 Issue #1537, #3631
171
- * @internal
172
- */
173
- _createDataStoreWithProps(
174
- pkg: string | string[],
175
- props?: any,
176
- id?: string,
177
- ): Promise<IDataStore>;
178
-
179
- /**
180
- * Creates a data store and returns an object that exposes a handle to the data store's entryPoint, and also serves
181
- * as the data store's router. The data store is not bound to a container, and in such state is not persisted to
182
- * storage (file). Storing the entryPoint handle (or any other handle inside the data store, e.g. for DDS) into an
183
- * already attached DDS (or non-attached DDS that will eventually get attached to storage) will result in this
184
- * store being attached to storage.
185
- * @param pkg - Package name of the data store factory
186
- */
187
- createDataStore(pkg: string | string[]): Promise<IDataStore>;
188
-
189
- /**
190
- * Creates detached data store context. Only after context.attachRuntime() is called,
191
- * data store initialization is considered complete.
192
- */
193
- createDetachedDataStore(pkg: Readonly<string[]>): IFluidDataStoreContextDetached;
194
-
195
- /**
196
- * Get an absolute url for a provided container-relative request.
197
- * Returns undefined if the container or data store isn't attached to storage.
198
- * @param relativeUrl - A relative request within the container
199
- */
200
- getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
201
-
202
- uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
203
-
204
- /**
205
- * Returns the current quorum.
206
- */
207
- getQuorum(): IQuorumClients;
208
-
209
- /**
210
- * Returns the current audience.
211
- */
212
- getAudience(): IAudience;
146
+ export interface IContainerRuntimeBase
147
+ extends IEventProvider<IContainerRuntimeBaseEvents>,
148
+ IProvideFluidHandleContext {
149
+ readonly logger: ITelemetryBaseLogger;
150
+ readonly clientDetails: IClientDetails;
151
+
152
+ /**
153
+ * Invokes the given callback and guarantees that all operations generated within the callback will be ordered
154
+ * sequentially. Total size of all messages must be less than maxOpSize.
155
+ */
156
+ orderSequentially(callback: () => void): void;
157
+
158
+ /**
159
+ * Executes a request against the container runtime
160
+ */
161
+ request(request: IRequest): Promise<IResponse>;
162
+
163
+ /**
164
+ * Submits a container runtime level signal to be sent to other clients.
165
+ * @param type - Type of the signal.
166
+ * @param content - Content of the signal.
167
+ */
168
+ submitSignal(type: string, content: any): void;
169
+
170
+ /**
171
+ * @deprecated 0.16 Issue #1537, #3631
172
+ * @internal
173
+ */
174
+ _createDataStoreWithProps(
175
+ pkg: string | string[],
176
+ props?: any,
177
+ id?: string,
178
+ ): Promise<IDataStore>;
179
+
180
+ /**
181
+ * Creates a data store and returns an object that exposes a handle to the data store's entryPoint, and also serves
182
+ * as the data store's router. The data store is not bound to a container, and in such state is not persisted to
183
+ * storage (file). Storing the entryPoint handle (or any other handle inside the data store, e.g. for DDS) into an
184
+ * already attached DDS (or non-attached DDS that will eventually get attached to storage) will result in this
185
+ * store being attached to storage.
186
+ * @param pkg - Package name of the data store factory
187
+ */
188
+ createDataStore(pkg: string | string[]): Promise<IDataStore>;
189
+
190
+ /**
191
+ * Creates detached data store context. Only after context.attachRuntime() is called,
192
+ * data store initialization is considered complete.
193
+ */
194
+ createDetachedDataStore(pkg: Readonly<string[]>): IFluidDataStoreContextDetached;
195
+
196
+ /**
197
+ * Get an absolute url for a provided container-relative request.
198
+ * Returns undefined if the container or data store isn't attached to storage.
199
+ * @param relativeUrl - A relative request within the container
200
+ */
201
+ getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
202
+
203
+ uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
204
+
205
+ /**
206
+ * Returns the current quorum.
207
+ */
208
+ getQuorum(): IQuorumClients;
209
+
210
+ /**
211
+ * Returns the current audience.
212
+ */
213
+ getAudience(): IAudience;
213
214
  }
214
215
 
215
216
  /**
216
217
  * @deprecated Used only in deprecated API bindToContext
217
218
  */
218
219
  export enum BindState {
219
- NotBound = "NotBound",
220
- Binding = "Binding",
221
- Bound = "Bound",
220
+ NotBound = "NotBound",
221
+ Binding = "Binding",
222
+ Bound = "Bound",
222
223
  }
223
224
 
224
225
  /**
@@ -227,270 +228,267 @@ export enum BindState {
227
228
  * Functionality include attach, snapshot, op/signal processing, request routes, expose an entryPoint,
228
229
  * and connection state notifications
229
230
  */
230
- export interface IFluidDataStoreChannel extends
231
- IFluidRouter,
232
- IDisposable {
233
-
234
- readonly id: string;
235
-
236
- /**
237
- * Indicates the attachment state of the channel to a host service.
238
- */
239
- readonly attachState: AttachState;
240
-
241
- readonly visibilityState?: VisibilityState;
242
-
243
- /**
244
- * Runs through the graph and attaches the bound handles. Then binds this runtime to the container.
245
- * @deprecated This will be removed in favor of {@link IFluidDataStoreChannel.makeVisibleAndAttachGraph}.
246
- */
247
- attachGraph(): void;
248
-
249
- /**
250
- * Makes the data store channel visible in the container. Also, runs through its graph and attaches all
251
- * bound handles that represent its dependencies in the container's graph.
252
- */
253
- makeVisibleAndAttachGraph(): void;
254
-
255
- /**
256
- * Retrieves the summary used as part of the initial summary message
257
- */
258
- getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
259
-
260
- /**
261
- * Processes the op.
262
- */
263
- process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
264
-
265
- /**
266
- * Processes the signal.
267
- */
268
- processSignal(message: any, local: boolean): void;
269
-
270
- /**
271
- * Generates a summary for the channel.
272
- * Introduced with summarizerNode - will be required in a future release.
273
- * @param fullTree - true to bypass optimizations and force a full summary tree.
274
- * @param trackState - This tells whether we should track state from this summary.
275
- * @param telemetryContext - summary data passed through the layers for telemetry purposes
276
- */
277
- summarize(
278
- fullTree?: boolean,
279
- trackState?: boolean,
280
- telemetryContext?: ITelemetryContext,
281
- ): Promise<ISummaryTreeWithStats>;
282
-
283
- /**
284
- * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context
285
- * including any of its children. Each node has a list of outbound routes to other GC nodes in the document.
286
- * @param fullGC - true to bypass optimizations and force full generation of GC data.
287
- */
288
- getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
289
-
290
- /**
291
- * After GC has run, called to notify this channel of routes that are used in it.
292
- * @param usedRoutes - The routes that are used in this channel.
293
- */
294
- updateUsedRoutes(usedRoutes: string[]): void;
295
-
296
- /**
297
- * Notifies this object about changes in the connection state.
298
- * @param value - New connection state.
299
- * @param clientId - ID of the client. It's old ID when in disconnected state and
300
- * it's new client ID when we are connecting or connected.
301
- */
302
- setConnectionState(connected: boolean, clientId?: string);
303
-
304
- /**
305
- * Ask the DDS to resubmit a message. This could be because we reconnected and this message was not acked.
306
- * @param type - The type of the original message.
307
- * @param content - The content of the original message.
308
- * @param localOpMetadata - The local metadata associated with the original message.
309
- */
310
- reSubmit(type: string, content: any, localOpMetadata: unknown);
311
-
312
- applyStashedOp(content: any): Promise<unknown>;
313
-
314
- /**
315
- * Revert a local message.
316
- * @param type - The type of the original message.
317
- * @param content - The content of the original message.
318
- * @param localOpMetadata - The local metadata associated with the original message.
319
- */
320
- rollback?(type: string, content: any, localOpMetadata: unknown): void;
321
-
322
- /**
323
- * Exposes a handle to the root object / entryPoint of the component. Use this as the primary way of interacting
324
- * with the component. If this property is undefined (meaning that exposing the entryPoint hasn't been implemented
325
- * in a particular scenario) fall back to the current approach of requesting the root object through the request
326
- * pattern.
327
- *
328
- * @remarks The plan is that eventually the component will stop providing IFluidRouter functionality, this property
329
- * will become non-optional and return an IFluidHandle (no undefined) and will become the only way to access
330
- * the component's entryPoint.
331
- */
332
- readonly entryPoint?: IFluidHandle<FluidObject>;
231
+ export interface IFluidDataStoreChannel extends IFluidRouter, IDisposable {
232
+ readonly id: string;
233
+
234
+ /**
235
+ * Indicates the attachment state of the channel to a host service.
236
+ */
237
+ readonly attachState: AttachState;
238
+
239
+ readonly visibilityState?: VisibilityState;
240
+
241
+ /**
242
+ * Runs through the graph and attaches the bound handles. Then binds this runtime to the container.
243
+ * @deprecated This will be removed in favor of {@link IFluidDataStoreChannel.makeVisibleAndAttachGraph}.
244
+ */
245
+ attachGraph(): void;
246
+
247
+ /**
248
+ * Makes the data store channel visible in the container. Also, runs through its graph and attaches all
249
+ * bound handles that represent its dependencies in the container's graph.
250
+ */
251
+ makeVisibleAndAttachGraph(): void;
252
+
253
+ /**
254
+ * Retrieves the summary used as part of the initial summary message
255
+ */
256
+ getAttachSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
257
+
258
+ /**
259
+ * Processes the op.
260
+ */
261
+ process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
262
+
263
+ /**
264
+ * Processes the signal.
265
+ */
266
+ processSignal(message: any, local: boolean): void;
267
+
268
+ /**
269
+ * Generates a summary for the channel.
270
+ * Introduced with summarizerNode - will be required in a future release.
271
+ * @param fullTree - true to bypass optimizations and force a full summary tree.
272
+ * @param trackState - This tells whether we should track state from this summary.
273
+ * @param telemetryContext - summary data passed through the layers for telemetry purposes
274
+ */
275
+ summarize(
276
+ fullTree?: boolean,
277
+ trackState?: boolean,
278
+ telemetryContext?: ITelemetryContext,
279
+ ): Promise<ISummaryTreeWithStats>;
280
+
281
+ /**
282
+ * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context
283
+ * including any of its children. Each node has a list of outbound routes to other GC nodes in the document.
284
+ * @param fullGC - true to bypass optimizations and force full generation of GC data.
285
+ */
286
+ getGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;
287
+
288
+ /**
289
+ * After GC has run, called to notify this channel of routes that are used in it.
290
+ * @param usedRoutes - The routes that are used in this channel.
291
+ */
292
+ updateUsedRoutes(usedRoutes: string[]): void;
293
+
294
+ /**
295
+ * Notifies this object about changes in the connection state.
296
+ * @param value - New connection state.
297
+ * @param clientId - ID of the client. It's old ID when in disconnected state and
298
+ * it's new client ID when we are connecting or connected.
299
+ */
300
+ setConnectionState(connected: boolean, clientId?: string);
301
+
302
+ /**
303
+ * Ask the DDS to resubmit a message. This could be because we reconnected and this message was not acked.
304
+ * @param type - The type of the original message.
305
+ * @param content - The content of the original message.
306
+ * @param localOpMetadata - The local metadata associated with the original message.
307
+ */
308
+ reSubmit(type: string, content: any, localOpMetadata: unknown);
309
+
310
+ applyStashedOp(content: any): Promise<unknown>;
311
+
312
+ /**
313
+ * Revert a local message.
314
+ * @param type - The type of the original message.
315
+ * @param content - The content of the original message.
316
+ * @param localOpMetadata - The local metadata associated with the original message.
317
+ */
318
+ rollback?(type: string, content: any, localOpMetadata: unknown): void;
319
+
320
+ /**
321
+ * Exposes a handle to the root object / entryPoint of the component. Use this as the primary way of interacting
322
+ * with the component. If this property is undefined (meaning that exposing the entryPoint hasn't been implemented
323
+ * in a particular scenario) fall back to the current approach of requesting the root object through the request
324
+ * pattern.
325
+ *
326
+ * @remarks The plan is that eventually the component will stop providing IFluidRouter functionality, this property
327
+ * will become non-optional and return an IFluidHandle (no undefined) and will become the only way to access
328
+ * the component's entryPoint.
329
+ */
330
+ readonly entryPoint?: IFluidHandle<FluidObject>;
333
331
  }
334
332
 
335
333
  export type CreateChildSummarizerNodeFn = (
336
- summarizeInternal: SummarizeInternalFn,
337
- getGCDataFn: (fullGC?: boolean) => Promise<IGarbageCollectionData>,
338
- /**
339
- * @deprecated - The functionality to get base GC details has been moved to summarizer node.
340
- */
341
- getBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,
334
+ summarizeInternal: SummarizeInternalFn,
335
+ getGCDataFn: (fullGC?: boolean) => Promise<IGarbageCollectionData>,
336
+ /**
337
+ * @deprecated - The functionality to get base GC details has been moved to summarizer node.
338
+ */
339
+ getBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,
342
340
  ) => ISummarizerNodeWithGC;
343
341
 
344
342
  export interface IFluidDataStoreContextEvents extends IEvent {
345
- (event: "attaching" | "attached", listener: () => void);
343
+ (event: "attaching" | "attached", listener: () => void);
346
344
  }
347
345
 
348
346
  /**
349
347
  * Represents the context for the data store. It is used by the data store runtime to
350
348
  * get information and call functionality to the container.
351
349
  */
352
- export interface IFluidDataStoreContext extends
353
- IEventProvider<IFluidDataStoreContextEvents>,
354
- Partial<IProvideFluidDataStoreRegistry>,
355
- IProvideFluidHandleContext {
356
- readonly id: string;
357
- /**
358
- * A data store created by a client, is a local data store for that client. Also, when a detached container loads
359
- * from a snapshot, all the data stores are treated as local data stores because at that stage the container
360
- * still doesn't exists in storage and so the data store couldn't have been created by any other client.
361
- * Value of this never changes even after the data store is attached.
362
- * As implementer of data store runtime, you can use this property to check that this data store belongs to this
363
- * client and hence implement any scenario based on that.
364
- */
365
- readonly isLocalDataStore: boolean;
366
- /**
367
- * The package path of the data store as per the package factory.
368
- */
369
- readonly packagePath: readonly string[];
370
- readonly options: ILoaderOptions;
371
- readonly clientId: string | undefined;
372
- readonly connected: boolean;
373
- readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
374
- readonly storage: IDocumentStorageService;
375
- readonly baseSnapshot: ISnapshotTree | undefined;
376
- readonly logger: ITelemetryBaseLogger;
377
- readonly clientDetails: IClientDetails;
378
- /**
379
- * Indicates the attachment state of the data store to a host service.
380
- */
381
- readonly attachState: AttachState;
382
-
383
- readonly containerRuntime: IContainerRuntimeBase;
384
-
385
- /**
386
- * @deprecated 0.16 Issue #1635, #3631
387
- */
388
- readonly createProps?: any;
389
-
390
- /**
391
- * Ambient services provided with the context
392
- */
393
- readonly scope: FluidObject;
394
-
395
- /**
396
- * Returns the current quorum.
397
- */
398
- getQuorum(): IQuorumClients;
399
-
400
- /**
401
- * Returns the current audience.
402
- */
403
- getAudience(): IAudience;
404
-
405
- /**
406
- * Invokes the given callback and expects that no ops are submitted
407
- * until execution finishes. If an op is submitted, an error will be raised.
408
- *
409
- * Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`
410
- *
411
- * @param callback - the callback to be invoked
412
- */
413
- ensureNoDataModelChanges<T>(callback: () => T): T;
414
-
415
- /**
416
- * Submits the message to be sent to other clients.
417
- * @param type - Type of the message.
418
- * @param content - Content of the message.
419
- * @param localOpMetadata - The local metadata associated with the message. This is kept locally and not sent to
420
- * the server. This will be sent back when this message is received back from the server. This is also sent if
421
- * we are asked to resubmit the message.
422
- */
423
- submitMessage(type: string, content: any, localOpMetadata: unknown): void;
424
-
425
- /**
426
- * Submits the signal to be sent to other clients.
427
- * @param type - Type of the signal.
428
- * @param content - Content of the signal.
429
- */
430
- submitSignal(type: string, content: any): void;
431
-
432
- /**
433
- * @deprecated To be removed in favor of makeVisible.
434
- * Register the runtime to the container
435
- */
436
- bindToContext(): void;
437
-
438
- /**
439
- * Called to make the data store locally visible in the container. This happens automatically for root data stores
440
- * when they are marked as root. For non-root data stores, this happens when their handle is added to a visible DDS.
441
- */
442
- makeLocallyVisible(): void;
443
-
444
- /**
445
- * Call by IFluidDataStoreChannel, indicates that a channel is dirty and needs to be part of the summary.
446
- * @param address - The address of the channel that is dirty.
447
- */
448
- setChannelDirty(address: string): void;
449
-
450
- /**
451
- * Get an absolute url to the container based on the provided relativeUrl.
452
- * Returns undefined if the container or data store isn't attached to storage.
453
- * @param relativeUrl - A relative request within the container
454
- */
455
- getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
456
-
457
- getCreateChildSummarizerNodeFn(
458
- /**
459
- * Initial id or path part of this node
460
- */
461
- id: string,
462
- /**
463
- * Information needed to create the node.
464
- * If it is from a base summary, it will assert that a summary has been seen.
465
- * Attach information if it is created from an attach op.
466
- * If it is local, it will throw unsupported errors on calls to summarize.
467
- */
468
- createParam: CreateChildSummarizerNodeParam,
469
- ): CreateChildSummarizerNodeFn;
470
-
471
- uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
472
-
473
- /**
474
- * Returns the GC details in the initial summary of this data store. This is used to initialize the data store
475
- * and its children with the GC details from the previous summary.
476
- */
477
- getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;
478
-
479
- /**
480
- * Called when a new outbound reference is added to another node. This is used by garbage collection to identify
481
- * all references added in the system.
482
- * @param srcHandle - The handle of the node that added the reference.
483
- * @param outboundHandle - The handle of the outbound node that is referenced.
484
- */
485
- addedGCOutboundReference?(srcHandle: IFluidHandle, outboundHandle: IFluidHandle): void;
350
+ export interface IFluidDataStoreContext
351
+ extends IEventProvider<IFluidDataStoreContextEvents>,
352
+ Partial<IProvideFluidDataStoreRegistry>,
353
+ IProvideFluidHandleContext {
354
+ readonly id: string;
355
+ /**
356
+ * A data store created by a client, is a local data store for that client. Also, when a detached container loads
357
+ * from a snapshot, all the data stores are treated as local data stores because at that stage the container
358
+ * still doesn't exists in storage and so the data store couldn't have been created by any other client.
359
+ * Value of this never changes even after the data store is attached.
360
+ * As implementer of data store runtime, you can use this property to check that this data store belongs to this
361
+ * client and hence implement any scenario based on that.
362
+ */
363
+ readonly isLocalDataStore: boolean;
364
+ /**
365
+ * The package path of the data store as per the package factory.
366
+ */
367
+ readonly packagePath: readonly string[];
368
+ readonly options: ILoaderOptions;
369
+ readonly clientId: string | undefined;
370
+ readonly connected: boolean;
371
+ readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
372
+ readonly storage: IDocumentStorageService;
373
+ readonly baseSnapshot: ISnapshotTree | undefined;
374
+ readonly logger: ITelemetryBaseLogger;
375
+ readonly clientDetails: IClientDetails;
376
+ /**
377
+ * Indicates the attachment state of the data store to a host service.
378
+ */
379
+ readonly attachState: AttachState;
380
+
381
+ readonly containerRuntime: IContainerRuntimeBase;
382
+
383
+ /**
384
+ * @deprecated 0.16 Issue #1635, #3631
385
+ */
386
+ readonly createProps?: any;
387
+
388
+ /**
389
+ * Ambient services provided with the context
390
+ */
391
+ readonly scope: FluidObject;
392
+
393
+ /**
394
+ * Returns the current quorum.
395
+ */
396
+ getQuorum(): IQuorumClients;
397
+
398
+ /**
399
+ * Returns the current audience.
400
+ */
401
+ getAudience(): IAudience;
402
+
403
+ /**
404
+ * Invokes the given callback and expects that no ops are submitted
405
+ * until execution finishes. If an op is submitted, an error will be raised.
406
+ *
407
+ * Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`
408
+ *
409
+ * @param callback - the callback to be invoked
410
+ */
411
+ ensureNoDataModelChanges<T>(callback: () => T): T;
412
+
413
+ /**
414
+ * Submits the message to be sent to other clients.
415
+ * @param type - Type of the message.
416
+ * @param content - Content of the message.
417
+ * @param localOpMetadata - The local metadata associated with the message. This is kept locally and not sent to
418
+ * the server. This will be sent back when this message is received back from the server. This is also sent if
419
+ * we are asked to resubmit the message.
420
+ */
421
+ submitMessage(type: string, content: any, localOpMetadata: unknown): void;
422
+
423
+ /**
424
+ * Submits the signal to be sent to other clients.
425
+ * @param type - Type of the signal.
426
+ * @param content - Content of the signal.
427
+ */
428
+ submitSignal(type: string, content: any): void;
429
+
430
+ /**
431
+ * @deprecated To be removed in favor of makeVisible.
432
+ * Register the runtime to the container
433
+ */
434
+ bindToContext(): void;
435
+
436
+ /**
437
+ * Called to make the data store locally visible in the container. This happens automatically for root data stores
438
+ * when they are marked as root. For non-root data stores, this happens when their handle is added to a visible DDS.
439
+ */
440
+ makeLocallyVisible(): void;
441
+
442
+ /**
443
+ * Call by IFluidDataStoreChannel, indicates that a channel is dirty and needs to be part of the summary.
444
+ * @param address - The address of the channel that is dirty.
445
+ */
446
+ setChannelDirty(address: string): void;
447
+
448
+ /**
449
+ * Get an absolute url to the container based on the provided relativeUrl.
450
+ * Returns undefined if the container or data store isn't attached to storage.
451
+ * @param relativeUrl - A relative request within the container
452
+ */
453
+ getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
454
+
455
+ getCreateChildSummarizerNodeFn(
456
+ /**
457
+ * Initial id or path part of this node
458
+ */
459
+ id: string,
460
+ /**
461
+ * Information needed to create the node.
462
+ * If it is from a base summary, it will assert that a summary has been seen.
463
+ * Attach information if it is created from an attach op.
464
+ * If it is local, it will throw unsupported errors on calls to summarize.
465
+ */
466
+ createParam: CreateChildSummarizerNodeParam,
467
+ ): CreateChildSummarizerNodeFn;
468
+
469
+ uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
470
+
471
+ /**
472
+ * Returns the GC details in the initial summary of this data store. This is used to initialize the data store
473
+ * and its children with the GC details from the previous summary.
474
+ */
475
+ getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;
476
+
477
+ /**
478
+ * Called when a new outbound reference is added to another node. This is used by garbage collection to identify
479
+ * all references added in the system.
480
+ * @param srcHandle - The handle of the node that added the reference.
481
+ * @param outboundHandle - The handle of the outbound node that is referenced.
482
+ */
483
+ addedGCOutboundReference?(srcHandle: IFluidHandle, outboundHandle: IFluidHandle): void;
486
484
  }
487
485
 
488
486
  export interface IFluidDataStoreContextDetached extends IFluidDataStoreContext {
489
- /**
490
- * Binds a runtime to the context.
491
- */
492
- attachRuntime(
493
- factory: IProvideFluidDataStoreFactory,
494
- dataStoreRuntime: IFluidDataStoreChannel,
495
- ): Promise<void>;
487
+ /**
488
+ * Binds a runtime to the context.
489
+ */
490
+ attachRuntime(
491
+ factory: IProvideFluidDataStoreFactory,
492
+ dataStoreRuntime: IFluidDataStoreChannel,
493
+ ): Promise<void>;
496
494
  }