@fluidframework/datastore-definitions 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229
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.
- package/.eslintrc.js +5 -7
- package/README.md +7 -7
- package/api-extractor.json +2 -2
- package/dist/channel.d.ts +45 -14
- package/dist/channel.d.ts.map +1 -1
- package/dist/channel.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts +9 -0
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jsonable.d.ts.map +1 -1
- package/dist/jsonable.js.map +1 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js.map +1 -1
- package/package.json +30 -35
- package/prettier.config.cjs +1 -1
- package/src/channel.ts +212 -179
- package/src/dataStoreRuntime.ts +118 -108
- package/src/index.ts +5 -5
- package/src/jsonable.ts +14 -11
- package/src/storage.ts +13 -13
- package/tsconfig.json +8 -12
package/src/channel.ts
CHANGED
|
@@ -6,191 +6,224 @@
|
|
|
6
6
|
import { IFluidHandle, IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
7
7
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
IGarbageCollectionData,
|
|
10
|
+
IExperimentalIncrementalSummaryContext,
|
|
11
|
+
ISummaryTreeWithStats,
|
|
12
|
+
ITelemetryContext,
|
|
12
13
|
} from "@fluidframework/runtime-definitions";
|
|
13
14
|
import { IChannelAttributes } from "./storage";
|
|
14
15
|
import { IFluidDataStoreRuntime } from "./dataStoreRuntime";
|
|
15
16
|
|
|
16
17
|
export interface IChannel extends IFluidLoadable {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
/**
|
|
19
|
+
* A readonly identifier for the channel
|
|
20
|
+
*/
|
|
21
|
+
readonly id: string;
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
readonly owner?: string;
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
readonly attributes: IChannelAttributes;
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Generates summary of the channel synchronously. It is called when an `attach message`
|
|
29
|
+
* for a local channel is generated. In other words, when the channel is being attached
|
|
30
|
+
* to make it visible to other clients.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
*
|
|
34
|
+
* Note: Since the Attach Summary is generated for local channels when making them visible to
|
|
35
|
+
* remote clients, they don't have any previous summaries to compare against. For this reason,
|
|
36
|
+
* the attach summary cannot contain summary handles (paths to sub-trees or blobs).
|
|
37
|
+
* It can, however, contain {@link @fluidframework/protocol-definitions#ISummaryAttachment}
|
|
38
|
+
* (handles to blobs uploaded async via the blob manager).
|
|
39
|
+
*
|
|
40
|
+
* @param fullTree - A flag indicating whether the attempt should generate a full
|
|
41
|
+
* summary tree without any handles for unchanged subtrees.
|
|
42
|
+
*
|
|
43
|
+
* Default: `false`
|
|
44
|
+
*
|
|
45
|
+
* @param trackState - An optimization for tracking state of objects across summaries. If the state
|
|
46
|
+
* of an object did not change since last successful summary, an
|
|
47
|
+
* {@link @fluidframework/protocol-definitions#ISummaryHandle} can be used
|
|
48
|
+
* instead of re-summarizing it. If this is `false`, the expectation is that you should never
|
|
49
|
+
* send an `ISummaryHandle`, since you are not expected to track state.
|
|
50
|
+
*
|
|
51
|
+
* Note: The goal is to remove the trackState and automatically decided whether the
|
|
52
|
+
* handles will be used or not: {@link https://github.com/microsoft/FluidFramework/issues/10455}
|
|
53
|
+
*
|
|
54
|
+
* Default: `false`
|
|
55
|
+
*
|
|
56
|
+
* @param telemetryContext - See {@link @fluidframework/runtime-definitions#ITelemetryContext}.
|
|
57
|
+
*
|
|
58
|
+
* @returns A summary capturing the current state of the channel.
|
|
59
|
+
*/
|
|
60
|
+
getAttachSummary(
|
|
61
|
+
fullTree?: boolean,
|
|
62
|
+
trackState?: boolean,
|
|
63
|
+
telemetryContext?: ITelemetryContext,
|
|
64
|
+
): ISummaryTreeWithStats;
|
|
49
65
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Generates summary of the channel asynchronously.
|
|
68
|
+
* This should not be called where the channel can be modified while summarization is in progress.
|
|
69
|
+
*
|
|
70
|
+
* @param fullTree - flag indicating whether the attempt should generate a full
|
|
71
|
+
* summary tree without any handles for unchanged subtrees. It should only be set to true when generating
|
|
72
|
+
* a summary from the entire container.
|
|
73
|
+
*
|
|
74
|
+
* Default: `false`
|
|
75
|
+
*
|
|
76
|
+
* @param trackState - An optimization for tracking state of objects across summaries. If the state
|
|
77
|
+
* of an object did not change since last successful summary, an
|
|
78
|
+
* {@link @fluidframework/protocol-definitions#ISummaryHandle} can be used
|
|
79
|
+
* instead of re-summarizing it. If this is `false`, the expectation is that you should never
|
|
80
|
+
* send an `ISummaryHandle`, since you are not expected to track state.
|
|
81
|
+
*
|
|
82
|
+
* Default: `false`
|
|
83
|
+
*
|
|
84
|
+
* Note: The goal is to remove the trackState and automatically decided whether the
|
|
85
|
+
* handles will be used or not: {@link https://github.com/microsoft/FluidFramework/issues/10455}
|
|
86
|
+
*
|
|
87
|
+
* @param telemetryContext - See {@link @fluidframework/runtime-definitions#ITelemetryContext}.
|
|
88
|
+
*
|
|
89
|
+
* @returns A summary capturing the current state of the channel.
|
|
90
|
+
*/
|
|
91
|
+
summarize(
|
|
92
|
+
fullTree?: boolean,
|
|
93
|
+
trackState?: boolean,
|
|
94
|
+
telemetryContext?: ITelemetryContext,
|
|
95
|
+
incrementalSummaryContext?: IExperimentalIncrementalSummaryContext,
|
|
96
|
+
): Promise<ISummaryTreeWithStats>;
|
|
64
97
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Checks if the channel is attached to storage.
|
|
100
|
+
* @returns True iff the channel is attached.
|
|
101
|
+
*/
|
|
102
|
+
isAttached(): boolean;
|
|
70
103
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Enables the channel to send and receive ops.
|
|
106
|
+
* @param services - The services to connect to.
|
|
107
|
+
*/
|
|
108
|
+
connect(services: IChannelServices): void;
|
|
76
109
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Returns the GC data for this channel. It contains a list of GC nodes that contains references to
|
|
112
|
+
* other GC nodes.
|
|
113
|
+
* @param fullGC - true to bypass optimizations and force full generation of GC data.
|
|
114
|
+
*/
|
|
115
|
+
getGCData(fullGC?: boolean): IGarbageCollectionData;
|
|
83
116
|
}
|
|
84
117
|
|
|
85
118
|
/**
|
|
86
119
|
* Handler provided by shared data structure to process requests from the runtime.
|
|
87
120
|
*/
|
|
88
121
|
export interface IDeltaHandler {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Processes the op.
|
|
124
|
+
* @param message - The message to process
|
|
125
|
+
* @param local - Whether the message originated from the local client
|
|
126
|
+
* @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
|
|
127
|
+
* For messages from a remote client, this will be undefined.
|
|
128
|
+
*/
|
|
129
|
+
process: (message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) => void;
|
|
97
130
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
131
|
+
/**
|
|
132
|
+
* State change events to indicate changes to the delta connection
|
|
133
|
+
* @param connected - true if connected, false otherwise
|
|
134
|
+
*/
|
|
135
|
+
setConnectionState(connected: boolean): void;
|
|
103
136
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
137
|
+
/**
|
|
138
|
+
* Called when the runtime asks the client to resubmit an op. This may be because the Container reconnected and
|
|
139
|
+
* this op was not acked.
|
|
140
|
+
* The client can choose to resubmit the same message, submit different / multiple messages or not submit anything
|
|
141
|
+
* at all.
|
|
142
|
+
* @param message - The original message that was submitted.
|
|
143
|
+
* @param localOpMetadata - The local metadata associated with the original message.
|
|
144
|
+
*/
|
|
145
|
+
reSubmit(message: any, localOpMetadata: unknown): void;
|
|
113
146
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Apply changes from an op. Used when rehydrating an attached container
|
|
149
|
+
* with pending changes. This prepares the SharedObject for seeing an ACK
|
|
150
|
+
* for the op or resubmitting the op upon reconnection.
|
|
151
|
+
* @param message - Contents of a stashed op.
|
|
152
|
+
* @returns localMetadata of the op, to be passed to process() or resubmit()
|
|
153
|
+
* when the op is ACKed or resubmitted, respectively
|
|
154
|
+
*/
|
|
155
|
+
applyStashedOp(message: any): unknown;
|
|
123
156
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
157
|
+
/**
|
|
158
|
+
* Revert a local op.
|
|
159
|
+
* @param message - The original message that was submitted.
|
|
160
|
+
* @param localOpMetadata - The local metadata associated with the original message.
|
|
161
|
+
*/
|
|
162
|
+
rollback?(message: any, localOpMetadata: unknown): void;
|
|
130
163
|
}
|
|
131
164
|
|
|
132
165
|
/**
|
|
133
166
|
* Interface to represent a connection to a delta notification stream.
|
|
134
167
|
*/
|
|
135
168
|
export interface IDeltaConnection {
|
|
136
|
-
|
|
169
|
+
connected: boolean;
|
|
137
170
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
171
|
+
/**
|
|
172
|
+
* Send new messages to the server.
|
|
173
|
+
* @param messageContent - The content of the message to be sent.
|
|
174
|
+
* @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime
|
|
175
|
+
* and not sent to the server. It will be provided back when this message is acknowledged by the server. It will
|
|
176
|
+
* also be provided back when asked to resubmit the message.
|
|
177
|
+
*/
|
|
178
|
+
submit(messageContent: any, localOpMetadata: unknown): void;
|
|
146
179
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
180
|
+
/**
|
|
181
|
+
* Attaches a message handler to the delta connection
|
|
182
|
+
*/
|
|
183
|
+
attach(handler: IDeltaHandler): void;
|
|
151
184
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Indicates that the channel is dirty and needs to be part of the summary. It is called by a SharedSummaryBlock
|
|
187
|
+
* that needs to be part of the summary but does not generate ops.
|
|
188
|
+
*/
|
|
189
|
+
dirty(): void;
|
|
157
190
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
191
|
+
/**
|
|
192
|
+
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
193
|
+
* all references added in the system.
|
|
194
|
+
* @param srcHandle - The handle of the node that added the reference.
|
|
195
|
+
* @param outboundHandle - The handle of the outbound node that is referenced.
|
|
196
|
+
*/
|
|
197
|
+
addedGCOutboundReference?(srcHandle: IFluidHandle, outboundHandle: IFluidHandle): void;
|
|
165
198
|
}
|
|
166
199
|
|
|
167
200
|
/**
|
|
168
201
|
* Storage services to read the objects at a given path.
|
|
169
202
|
*/
|
|
170
203
|
export interface IChannelStorageService {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
204
|
+
/**
|
|
205
|
+
* Reads the object contained at the given path. Returns a buffer representation for the object.
|
|
206
|
+
*/
|
|
207
|
+
readBlob(path: string): Promise<ArrayBufferLike>;
|
|
175
208
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
209
|
+
/**
|
|
210
|
+
* Determines if there is an object contained at the given path.
|
|
211
|
+
*/
|
|
212
|
+
contains(path: string): Promise<boolean>;
|
|
180
213
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
214
|
+
/**
|
|
215
|
+
* Lists the blobs that exist at a specific path.
|
|
216
|
+
*/
|
|
217
|
+
list(path: string): Promise<string[]>;
|
|
185
218
|
}
|
|
186
219
|
|
|
187
220
|
/**
|
|
188
221
|
* Storage services to read the objects at a given path using the given delta connection.
|
|
189
222
|
*/
|
|
190
223
|
export interface IChannelServices {
|
|
191
|
-
|
|
224
|
+
deltaConnection: IDeltaConnection;
|
|
192
225
|
|
|
193
|
-
|
|
226
|
+
objectStorage: IChannelStorageService;
|
|
194
227
|
}
|
|
195
228
|
|
|
196
229
|
/**
|
|
@@ -210,48 +243,48 @@ export interface IChannelServices {
|
|
|
210
243
|
* @remarks Factories follow a common model but enable custom behavior.
|
|
211
244
|
*/
|
|
212
245
|
export interface IChannelFactory {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
246
|
+
/**
|
|
247
|
+
* String representing the type of the factory.
|
|
248
|
+
*/
|
|
249
|
+
readonly type: string;
|
|
217
250
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
251
|
+
/**
|
|
252
|
+
* Attributes of the channel.
|
|
253
|
+
*/
|
|
254
|
+
readonly attributes: IChannelAttributes;
|
|
222
255
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
256
|
+
/**
|
|
257
|
+
* Loads the given channel. This call is only ever invoked internally as the only thing
|
|
258
|
+
* that is ever directly loaded is the document itself. Load will then only be called on documents that
|
|
259
|
+
* were created and added to a channel.
|
|
260
|
+
* @param runtime - Data store runtime containing state/info/helper methods about the data store.
|
|
261
|
+
* @param id - ID of the channel.
|
|
262
|
+
* @param services - Services to read objects at a given path using the delta connection.
|
|
263
|
+
* @param channelAttributes - The attributes for the the channel to be loaded.
|
|
264
|
+
* @returns The loaded object
|
|
265
|
+
*
|
|
266
|
+
* @privateRemarks
|
|
267
|
+
* Thought: should the storage object include the version information and limit access to just files
|
|
268
|
+
* for the given object? The latter seems good in general. But both are probably good things. We then just
|
|
269
|
+
* need a way to allow the document to provide later storage for the object.
|
|
270
|
+
*/
|
|
271
|
+
load(
|
|
272
|
+
runtime: IFluidDataStoreRuntime,
|
|
273
|
+
id: string,
|
|
274
|
+
services: IChannelServices,
|
|
275
|
+
channelAttributes: Readonly<IChannelAttributes>,
|
|
276
|
+
): Promise<IChannel>;
|
|
244
277
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
278
|
+
/**
|
|
279
|
+
* Creates a local version of the channel.
|
|
280
|
+
* Calling attach on the object later will insert it into the object stream.
|
|
281
|
+
* @param runtime - The runtime the new object will be associated with
|
|
282
|
+
* @param id - The unique ID of the new object
|
|
283
|
+
* @returns The newly created object.
|
|
284
|
+
*
|
|
285
|
+
* @privateRemarks
|
|
286
|
+
* NOTE here - When we attach we need to submit all the pending ops prior to actually doing the attach
|
|
287
|
+
* for consistency.
|
|
288
|
+
*/
|
|
289
|
+
create(runtime: IFluidDataStoreRuntime, id: string): IChannel;
|
|
257
290
|
}
|