@fluidframework/driver-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 +2 -5
- package/api-extractor.json +2 -2
- package/dist/driverError.d.ts +21 -7
- package/dist/driverError.d.ts.map +1 -1
- package/dist/driverError.js +10 -2
- package/dist/driverError.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/storage.d.ts +18 -9
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js.map +1 -1
- package/dist/urlResolver.d.ts +9 -3
- package/dist/urlResolver.d.ts.map +1 -1
- package/dist/urlResolver.js.map +1 -1
- package/lib/driverError.d.ts +21 -7
- package/lib/driverError.d.ts.map +1 -1
- package/lib/driverError.js +10 -2
- package/lib/driverError.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/storage.d.ts +18 -9
- package/lib/storage.d.ts.map +1 -1
- package/lib/storage.js.map +1 -1
- package/lib/test/types/maximumCacheDurationPolicy.spec.js.map +1 -1
- package/lib/test/types/validateDriverDefinitionsPrevious.generated.js +2 -2
- package/lib/test/types/validateDriverDefinitionsPrevious.generated.js.map +1 -1
- package/lib/urlResolver.d.ts +9 -3
- package/lib/urlResolver.d.ts.map +1 -1
- package/lib/urlResolver.js.map +1 -1
- package/package.json +27 -31
- package/prettier.config.cjs +1 -1
- package/src/driverError.ts +145 -123
- package/src/index.ts +34 -34
- package/src/storage.ts +339 -310
- package/src/urlResolver.ts +60 -53
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +8 -13
package/src/storage.ts
CHANGED
|
@@ -3,357 +3,386 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IDisposable, IEventProvider, IErrorEvent, ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
7
6
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
IDisposable,
|
|
8
|
+
IEventProvider,
|
|
9
|
+
IErrorEvent,
|
|
10
|
+
ITelemetryBaseLogger,
|
|
11
|
+
} from "@fluidframework/common-definitions";
|
|
12
|
+
import {
|
|
13
|
+
ConnectionMode,
|
|
14
|
+
IClient,
|
|
15
|
+
IClientConfiguration,
|
|
16
|
+
ICreateBlobResponse,
|
|
17
|
+
IDocumentMessage,
|
|
18
|
+
INack,
|
|
19
|
+
ISequencedDocumentMessage,
|
|
20
|
+
ISignalClient,
|
|
21
|
+
ISignalMessage,
|
|
22
|
+
ISnapshotTree,
|
|
23
|
+
ISummaryHandle,
|
|
24
|
+
ISummaryTree,
|
|
25
|
+
ITokenClaims,
|
|
26
|
+
IVersion,
|
|
22
27
|
} from "@fluidframework/protocol-definitions";
|
|
23
28
|
import { IAnyDriverError } from "./driverError";
|
|
24
29
|
import { IResolvedUrl } from "./urlResolver";
|
|
25
30
|
|
|
26
31
|
export interface IDeltasFetchResult {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Sequential set of messages starting from 'from' sequence number.
|
|
34
|
+
* May be partial result, i.e. not fulfill original request in full.
|
|
35
|
+
*/
|
|
36
|
+
messages: ISequencedDocumentMessage[];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* If true, storage only partially fulfilled request, but has more ops
|
|
40
|
+
* If false, the request was fulfilled. If less ops were returned then
|
|
41
|
+
* requested, then storage does not have more ops in this range.
|
|
42
|
+
*/
|
|
43
|
+
partialResult: boolean;
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
/**
|
|
42
47
|
* Interface to provide access to stored deltas for a shared object
|
|
43
48
|
*/
|
|
44
49
|
export interface IDeltaStorageService {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves all the delta operations within the inclusive sequence number range
|
|
52
|
+
* @param tenantId - Id of the tenant.
|
|
53
|
+
* @param id - document id.
|
|
54
|
+
* @param from - first op to retrieve (inclusive)
|
|
55
|
+
* @param to - first op not to retrieve (exclusive end)
|
|
56
|
+
* @param fetchReason - Reason for fetching the messages. Example, gap between seq number
|
|
57
|
+
* of Op on wire and known seq number. It should not contain any PII. It can be logged by
|
|
58
|
+
* spo which could help in debugging sessions if any issue occurs.
|
|
59
|
+
*/
|
|
60
|
+
get(
|
|
61
|
+
tenantId: string,
|
|
62
|
+
id: string,
|
|
63
|
+
from: number, // inclusive
|
|
64
|
+
to: number, // exclusive
|
|
65
|
+
fetchReason?: string,
|
|
66
|
+
): Promise<IDeltasFetchResult>;
|
|
62
67
|
}
|
|
63
68
|
|
|
64
|
-
export type IStreamResult<T> = { done: true
|
|
69
|
+
export type IStreamResult<T> = { done: true } | { done: false; value: T };
|
|
65
70
|
|
|
66
71
|
/**
|
|
67
72
|
* Read interface for the Queue
|
|
68
73
|
*/
|
|
69
74
|
export interface IStream<T> {
|
|
70
|
-
|
|
75
|
+
read(): Promise<IStreamResult<T>>;
|
|
71
76
|
}
|
|
72
77
|
|
|
73
78
|
/**
|
|
74
79
|
* Interface to provide access to stored deltas for a shared object
|
|
75
80
|
*/
|
|
76
81
|
export interface IDocumentDeltaStorageService {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Retrieves all the delta operations within the exclusive sequence number range
|
|
84
|
+
* @param from - first op to retrieve (inclusive)
|
|
85
|
+
* @param to - first op not to retrieve (exclusive end)
|
|
86
|
+
* @param abortSignal - signal that aborts operation
|
|
87
|
+
* @param cachedOnly - return only cached ops, i.e. ops available locally on client.
|
|
88
|
+
* @param fetchReason - Reason for fetching the messages. Example, gap between seq number
|
|
89
|
+
* of Op on wire and known seq number. It should not contain any PII. It can be logged by
|
|
90
|
+
* spo which could help in debugging sessions if any issue occurs.
|
|
91
|
+
*/
|
|
92
|
+
fetchMessages(
|
|
93
|
+
from: number,
|
|
94
|
+
to: number | undefined,
|
|
95
|
+
abortSignal?: AbortSignal,
|
|
96
|
+
cachedOnly?: boolean,
|
|
97
|
+
fetchReason?: string,
|
|
98
|
+
): IStream<ISequencedDocumentMessage[]>;
|
|
93
99
|
}
|
|
94
100
|
|
|
95
|
-
// DO NOT INCREASE THIS TYPE'S VALUE
|
|
96
|
-
|
|
101
|
+
// DO NOT INCREASE THIS TYPE'S VALUE
|
|
102
|
+
// If a driver started using a larger value,
|
|
103
|
+
// internal assumptions of the Runtime's GC feature will be violated
|
|
104
|
+
// DO NOT INCREASE THIS TYPE'S VALUE
|
|
105
|
+
export type FiveDaysMs = 432_000_000; /* 5 days in milliseconds */
|
|
97
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Policies describing attributes or characteristics of the driver's storage service,
|
|
109
|
+
* to direct how other components interact with the driver
|
|
110
|
+
*/
|
|
98
111
|
export interface IDocumentStorageServicePolicies {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Should the Loader implement any sort of pre-fetching or caching mechanism?
|
|
114
|
+
*/
|
|
115
|
+
readonly caching?: LoaderCachingPolicy;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* If this policy is provided, it tells runtime on ideal size for blobs.
|
|
119
|
+
* Blobs that are smaller than that size should be aggregated into bigger blobs.
|
|
120
|
+
*/
|
|
121
|
+
readonly minBlobSize?: number;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* IMPORTANT: This policy MUST be set to 5 days and PROPERLY ENFORCED for drivers that are used
|
|
125
|
+
* in applications where Garbage Collection is enabled. Otherwise data loss may occur.
|
|
126
|
+
*
|
|
127
|
+
* This policy pertains to requests for the latest snapshot from the service.
|
|
128
|
+
* If set, it means that the driver guarantees not to use a cached value that was fetched more than 5 days ago.
|
|
129
|
+
* If undefined, the driver makes no guarantees about the age of snapshots used for loading.
|
|
130
|
+
*/
|
|
131
|
+
readonly maximumCacheDurationMs?: FiveDaysMs;
|
|
114
132
|
}
|
|
115
133
|
|
|
116
134
|
/**
|
|
117
135
|
* Interface to provide access to snapshots saved for a shared object
|
|
118
136
|
*/
|
|
119
137
|
export interface IDocumentStorageService extends Partial<IDisposable> {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
138
|
+
repositoryUrl: string;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Policies implemented/instructed by driver.
|
|
142
|
+
*/
|
|
143
|
+
readonly policies?: IDocumentStorageServicePolicies;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Returns the snapshot tree.
|
|
147
|
+
* @param version - Version of the snapshot to be fetched.
|
|
148
|
+
* @param scenarioName - scenario in which this api is called. This will be recorded by server and would help
|
|
149
|
+
* in debugging purposes to see why this call was made.
|
|
150
|
+
*/
|
|
151
|
+
// TODO: use `undefined` instead.
|
|
152
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
|
153
|
+
getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Retrieves all versions of the document starting at the specified versionId - or null if from the head
|
|
157
|
+
* @param versionId - Version id of the requested version.
|
|
158
|
+
* @param count - Number of the versions to be fetched.
|
|
159
|
+
* @param scenarioName - scenario in which this api is called. This will be recorded by server and would help
|
|
160
|
+
* in debugging purposes to see why this call was made.
|
|
161
|
+
* @param fetchSource - Callers can specify the source of the response. For ex. Driver may choose to cache
|
|
162
|
+
* requests and serve data from cache. That will result in stale info returned. Callers can disable this
|
|
163
|
+
* functionality by passing fetchSource = noCache and ensuring that driver will return latest information
|
|
164
|
+
* from storage.
|
|
165
|
+
*/
|
|
166
|
+
getVersions(
|
|
167
|
+
// TODO: use `undefined` instead.
|
|
168
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
|
169
|
+
versionId: string | null,
|
|
170
|
+
count: number,
|
|
171
|
+
scenarioName?: string,
|
|
172
|
+
fetchSource?: FetchSource,
|
|
173
|
+
): Promise<IVersion[]>;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Creates a blob out of the given buffer
|
|
177
|
+
*/
|
|
178
|
+
createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Reads the object with the given ID, returns content in arrayBufferLike
|
|
182
|
+
*/
|
|
183
|
+
readBlob(id: string): Promise<ArrayBufferLike>;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Uploads a summary tree to storage using the given context for reference of previous summary handle.
|
|
187
|
+
* The ISummaryHandles in the uploaded tree should have paths to indicate which summary object they are
|
|
188
|
+
* referencing from the previously acked summary.
|
|
189
|
+
* Returns the uploaded summary handle.
|
|
190
|
+
*/
|
|
191
|
+
uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Retrieves the commit that matches the packfile handle. If the packfile has already been committed and the
|
|
195
|
+
* server has deleted it this call may result in a broken promise.
|
|
196
|
+
*/
|
|
197
|
+
downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
|
|
176
198
|
}
|
|
177
199
|
|
|
178
200
|
export interface IDocumentDeltaConnectionEvents extends IErrorEvent {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
201
|
+
(event: "nack", listener: (documentId: string, message: INack[]) => void);
|
|
202
|
+
(event: "disconnect", listener: (reason: IAnyDriverError) => void);
|
|
203
|
+
(event: "op", listener: (documentId: string, messages: ISequencedDocumentMessage[]) => void);
|
|
204
|
+
(event: "signal", listener: (message: ISignalMessage) => void);
|
|
205
|
+
(event: "pong", listener: (latency: number) => void);
|
|
206
|
+
// TODO: Use something other than `any`.
|
|
207
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
208
|
+
(event: "error", listener: (error: any) => void);
|
|
185
209
|
}
|
|
186
210
|
|
|
187
|
-
export interface IDocumentDeltaConnection
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
211
|
+
export interface IDocumentDeltaConnection
|
|
212
|
+
extends IDisposable,
|
|
213
|
+
IEventProvider<IDocumentDeltaConnectionEvents> {
|
|
214
|
+
/**
|
|
215
|
+
* ClientID for the connection
|
|
216
|
+
*/
|
|
217
|
+
clientId: string;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Claims for the client
|
|
221
|
+
*/
|
|
222
|
+
claims: ITokenClaims;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Mode of the client
|
|
226
|
+
*/
|
|
227
|
+
mode: ConnectionMode;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Whether the connection was made to a new or existing document
|
|
231
|
+
*/
|
|
232
|
+
existing: boolean;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Protocol version being used with the service
|
|
236
|
+
*/
|
|
237
|
+
version: string;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Messages sent during the connection
|
|
241
|
+
*/
|
|
242
|
+
initialMessages: ISequencedDocumentMessage[];
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Signals sent during the connection
|
|
246
|
+
*/
|
|
247
|
+
initialSignals: ISignalMessage[];
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Prior clients already connected.
|
|
251
|
+
*/
|
|
252
|
+
initialClients: ISignalClient[];
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Configuration details provided by the service
|
|
256
|
+
*/
|
|
257
|
+
serviceConfiguration: IClientConfiguration;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Last known sequence number to ordering service at the time of connection
|
|
261
|
+
* It may lap actual last sequence number (quite a bit, if container is very active).
|
|
262
|
+
* But it's best information for client to figure out how far it is behind, at least
|
|
263
|
+
* for "read" connections. "write" connections may use own "join" op to similar information,
|
|
264
|
+
* that is likely to be more up-to-date.
|
|
265
|
+
*/
|
|
266
|
+
checkpointSequenceNumber?: number;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Properties that server can send to client to tell info about node that client is connected to. For ex, for spo
|
|
270
|
+
* it could contain info like build version, environment, region etc. These properties can be logged by client
|
|
271
|
+
* to better understand server environment etc. and use it in case error occurs.
|
|
272
|
+
* Format: "prop1:val1;prop2:val2;prop3:val3"
|
|
273
|
+
*/
|
|
274
|
+
relayServiceAgent?: string;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Submit a new message to the server
|
|
278
|
+
*/
|
|
279
|
+
submit(messages: IDocumentMessage[]): void;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Submit a new signal to the server
|
|
283
|
+
*/
|
|
284
|
+
// TODO: Use something other than `any`.
|
|
285
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
286
|
+
submitSignal(message: any): void;
|
|
259
287
|
}
|
|
260
288
|
|
|
261
289
|
export enum LoaderCachingPolicy {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
290
|
+
/**
|
|
291
|
+
* The loader should not implement any prefetching or caching policy.
|
|
292
|
+
*/
|
|
293
|
+
NoCaching,
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* The loader should implement prefetching policy, i.e. it should prefetch resources from the latest snapshot.
|
|
297
|
+
*/
|
|
298
|
+
Prefetch,
|
|
271
299
|
}
|
|
272
300
|
|
|
273
301
|
export interface IDocumentServicePolicies {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
302
|
+
/**
|
|
303
|
+
* Do not connect to delta stream
|
|
304
|
+
*/
|
|
305
|
+
readonly storageOnly?: boolean;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Summarizer uploads the protocol tree too when summarizing.
|
|
309
|
+
*/
|
|
310
|
+
readonly summarizeProtocolTree?: boolean;
|
|
278
311
|
}
|
|
279
312
|
|
|
280
313
|
export interface IDocumentService {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
314
|
+
resolvedUrl: IResolvedUrl;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Policies implemented/instructed by driver.
|
|
318
|
+
*/
|
|
319
|
+
policies?: IDocumentServicePolicies;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Access to storage associated with the document
|
|
323
|
+
*/
|
|
324
|
+
connectToStorage(): Promise<IDocumentStorageService>;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Access to delta storage associated with the document
|
|
328
|
+
*/
|
|
329
|
+
connectToDeltaStorage(): Promise<IDocumentDeltaStorageService>;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Subscribes to the document delta stream
|
|
333
|
+
*/
|
|
334
|
+
connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection>;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Dispose storage. Called by storage consumer (Container) when it's done with storage (Container closed).
|
|
338
|
+
* Useful for storage to commit any pending state if any (including any local caching).
|
|
339
|
+
* Please note that it does not remove the need for caller to close all active delta connections,
|
|
340
|
+
* as storage may not be tracking such objects.
|
|
341
|
+
* @param error - tells if container (and storage) are closed due to critical error.
|
|
342
|
+
* Error might be due to disconnect between client & server knowledge about file, like file being overwritten
|
|
343
|
+
* in storage, but client having stale local cache.
|
|
344
|
+
* If driver implements any kind of local caching, such caches needs to be cleared on on critical errors.
|
|
345
|
+
*/
|
|
346
|
+
// TODO: Use something other than `any`.
|
|
347
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
348
|
+
dispose(error?: any): void;
|
|
315
349
|
}
|
|
316
350
|
|
|
317
351
|
export interface IDocumentServiceFactory {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
createNewSummary: ISummaryTree | undefined,
|
|
353
|
-
createNewResolvedUrl: IResolvedUrl,
|
|
354
|
-
logger?: ITelemetryBaseLogger,
|
|
355
|
-
clientIsSummarizer?: boolean,
|
|
356
|
-
): Promise<IDocumentService>;
|
|
352
|
+
/**
|
|
353
|
+
* Creates the document service after extracting different endpoints URLs from a resolved URL.
|
|
354
|
+
*
|
|
355
|
+
* @param resolvedUrl - Endpoint URL data. See {@link IResolvedUrl}.
|
|
356
|
+
* @param logger - Optional telemetry logger to which telemetry events will be forwarded.
|
|
357
|
+
* @param clientIsSummarizer - Whether or not the client is the
|
|
358
|
+
* {@link https://fluidframework.com/docs/concepts/summarizer/ | summarizer}.
|
|
359
|
+
* `undefined` =\> false
|
|
360
|
+
*
|
|
361
|
+
* @returns An instance of {@link IDocumentService}.
|
|
362
|
+
*/
|
|
363
|
+
createDocumentService(
|
|
364
|
+
resolvedUrl: IResolvedUrl,
|
|
365
|
+
logger?: ITelemetryBaseLogger,
|
|
366
|
+
clientIsSummarizer?: boolean,
|
|
367
|
+
): Promise<IDocumentService>;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Creates a new document with the provided options. Returns the document service.
|
|
371
|
+
*
|
|
372
|
+
* @param createNewSummary - Summary used to create file. If undefined, an empty file will be created and a summary
|
|
373
|
+
* should be posted later, before connecting to ordering service.
|
|
374
|
+
* @param createNewResolvedUrl - Endpoint URL data. See {@link IResolvedUrl}.
|
|
375
|
+
* @param logger - Optional telemetry logger to which telemetry events will be forwarded.
|
|
376
|
+
* @param clientIsSummarizer - Whether or not the client is the
|
|
377
|
+
* {@link https://fluidframework.com/docs/concepts/summarizer/ | summarizer}.
|
|
378
|
+
* `undefined` =\> false
|
|
379
|
+
*/
|
|
380
|
+
createContainer(
|
|
381
|
+
createNewSummary: ISummaryTree | undefined,
|
|
382
|
+
createNewResolvedUrl: IResolvedUrl,
|
|
383
|
+
logger?: ITelemetryBaseLogger,
|
|
384
|
+
clientIsSummarizer?: boolean,
|
|
385
|
+
): Promise<IDocumentService>;
|
|
357
386
|
}
|
|
358
387
|
|
|
359
388
|
/**
|
|
@@ -361,20 +390,20 @@ export interface IDocumentServiceFactory {
|
|
|
361
390
|
* Indicates the previously acked summary.
|
|
362
391
|
*/
|
|
363
392
|
export interface ISummaryContext {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
393
|
+
/**
|
|
394
|
+
* Parent summary proposed handle (from summary op)
|
|
395
|
+
*/
|
|
396
|
+
readonly proposalHandle: string | undefined;
|
|
368
397
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
398
|
+
/**
|
|
399
|
+
* Parent summary acked handle (from summary ack)
|
|
400
|
+
*/
|
|
401
|
+
readonly ackHandle: string | undefined;
|
|
373
402
|
|
|
374
|
-
|
|
403
|
+
readonly referenceSequenceNumber: number;
|
|
375
404
|
}
|
|
376
405
|
|
|
377
406
|
export enum FetchSource {
|
|
378
|
-
|
|
379
|
-
|
|
407
|
+
default = "default",
|
|
408
|
+
noCache = "noCache",
|
|
380
409
|
}
|