@fluidframework/replay-driver 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/api-extractor.json +2 -2
- package/dist/emptyDeltaStorageService.d.ts.map +1 -1
- package/dist/emptyDeltaStorageService.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/replayController.d.ts.map +1 -1
- package/dist/replayController.js.map +1 -1
- package/dist/replayDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/replayDocumentDeltaConnection.js +12 -9
- package/dist/replayDocumentDeltaConnection.js.map +1 -1
- package/dist/replayDocumentService.d.ts.map +1 -1
- package/dist/replayDocumentService.js.map +1 -1
- package/dist/replayDocumentServiceFactory.d.ts +0 -1
- package/dist/replayDocumentServiceFactory.d.ts.map +1 -1
- package/dist/replayDocumentServiceFactory.js +0 -1
- package/dist/replayDocumentServiceFactory.js.map +1 -1
- package/dist/storageImplementations.d.ts +0 -1
- package/dist/storageImplementations.d.ts.map +1 -1
- package/dist/storageImplementations.js +0 -1
- package/dist/storageImplementations.js.map +1 -1
- package/lib/emptyDeltaStorageService.d.ts.map +1 -1
- package/lib/emptyDeltaStorageService.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/replayController.d.ts.map +1 -1
- package/lib/replayController.js.map +1 -1
- package/lib/replayDocumentDeltaConnection.d.ts.map +1 -1
- package/lib/replayDocumentDeltaConnection.js +12 -9
- package/lib/replayDocumentDeltaConnection.js.map +1 -1
- package/lib/replayDocumentService.d.ts.map +1 -1
- package/lib/replayDocumentService.js.map +1 -1
- package/lib/replayDocumentServiceFactory.d.ts +0 -1
- package/lib/replayDocumentServiceFactory.d.ts.map +1 -1
- package/lib/replayDocumentServiceFactory.js +0 -1
- package/lib/replayDocumentServiceFactory.js.map +1 -1
- package/lib/storageImplementations.d.ts +0 -1
- package/lib/storageImplementations.d.ts.map +1 -1
- package/lib/storageImplementations.js +0 -1
- package/lib/storageImplementations.js.map +1 -1
- package/lib/test/types/validateReplayDriverPrevious.generated.js.map +1 -1
- package/package.json +35 -39
- package/prettier.config.cjs +1 -1
- package/src/emptyDeltaStorageService.ts +14 -13
- package/src/packageVersion.ts +1 -1
- package/src/replayController.ts +59 -55
- package/src/replayDocumentDeltaConnection.ts +323 -310
- package/src/replayDocumentService.ts +46 -44
- package/src/replayDocumentServiceFactory.ts +55 -45
- package/src/storageImplementations.ts +153 -150
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +8 -13
package/src/replayController.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
IDocumentService,
|
|
8
|
+
IDocumentStorageService,
|
|
9
|
+
ISummaryContext,
|
|
10
10
|
} from "@fluidframework/driver-definitions";
|
|
11
11
|
import * as api from "@fluidframework/protocol-definitions";
|
|
12
12
|
|
|
@@ -14,25 +14,28 @@ import * as api from "@fluidframework/protocol-definitions";
|
|
|
14
14
|
* Partial implementation of IDocumentStorageService
|
|
15
15
|
*/
|
|
16
16
|
export abstract class ReadDocumentStorageServiceBase implements IDocumentStorageService {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
public abstract getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
|
|
18
|
+
public abstract getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
|
|
19
|
+
public abstract readBlob(blobId: string): Promise<ArrayBufferLike>;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
public async uploadSummaryWithContext(
|
|
22
|
+
summary: api.ISummaryTree,
|
|
23
|
+
context: ISummaryContext,
|
|
24
|
+
): Promise<string> {
|
|
25
|
+
return Promise.reject(new Error("Invalid operation"));
|
|
26
|
+
}
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
public async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {
|
|
29
|
+
return Promise.reject(new Error("Invalid operation"));
|
|
30
|
+
}
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
public async downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree> {
|
|
33
|
+
return Promise.reject(new Error("Invalid operation"));
|
|
34
|
+
}
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
public get repositoryUrl(): string {
|
|
37
|
+
throw new Error("Invalid operation");
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
/**
|
|
@@ -41,45 +44,46 @@ export abstract class ReadDocumentStorageServiceBase implements IDocumentStorage
|
|
|
41
44
|
* As well as dispatch of ops
|
|
42
45
|
*/
|
|
43
46
|
export abstract class ReplayController extends ReadDocumentStorageServiceBase {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Initialize reply controller
|
|
49
|
+
* @param documentService - the real document service
|
|
50
|
+
* @returns - Boolean, indicating if controller should be used.
|
|
51
|
+
* If false is returned, caller should fallback to original storage.
|
|
52
|
+
*/
|
|
53
|
+
public abstract initStorage(documentService: IDocumentService): Promise<boolean>;
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Returns sequence number to start processing ops
|
|
57
|
+
* Should be zero if not using snapshot, and snapshot seq# otherwise
|
|
58
|
+
*/
|
|
59
|
+
public abstract getStartingOpSequence(): Promise<number>;
|
|
57
60
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Returns last op number to fetch from current op
|
|
63
|
+
* Note: this API is called while replay() is in progress - next batch of ops is downloaded in parallel
|
|
64
|
+
* @param currentOp - current op
|
|
65
|
+
*/
|
|
66
|
+
public abstract fetchTo(currentOp: number): number | undefined;
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Returns true if no more ops should be processed (or downloaded for future processing).
|
|
70
|
+
* It's called at end of each batch with latest op timestamp.
|
|
71
|
+
* Also it's called when there are no more ops available (lastTimeStamp === undefined).
|
|
72
|
+
* If false is returned and there are no more ops, request for more ops is made every 2 seconds.
|
|
73
|
+
* Note: this API is called while replay() is in progress - next batch of ops is downloaded in parallel
|
|
74
|
+
* @param currentOp - current op
|
|
75
|
+
* @param lastTimeStamp - timestamp of last op (if more ops are available). Undefined otherwise.
|
|
76
|
+
*/
|
|
77
|
+
public abstract isDoneFetch(currentOp: number, lastTimeStamp?: number): boolean;
|
|
75
78
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Replay batch of ops
|
|
81
|
+
* NOTE: new batch of ops is fetched (fetchTo() & isDoneFetch() APIs are called) while this call is in flights
|
|
82
|
+
* @param emitter - callback to emit ops
|
|
83
|
+
* @param fetchedOps - ops to process
|
|
84
|
+
*/
|
|
85
|
+
public abstract replay(
|
|
86
|
+
emitter: (op: api.ISequencedDocumentMessage[]) => void,
|
|
87
|
+
fetchedOps: api.ISequencedDocumentMessage[],
|
|
88
|
+
): Promise<void>;
|
|
85
89
|
}
|