@fluidframework/replay-driver 2.0.0-internal.7.3.0 → 2.0.0-internal.8.0.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.
- package/CHANGELOG.md +8 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +3 -3
- package/api-report/replay-driver.api.md +9 -9
- package/dist/replay-driver-alpha.d.ts +34 -0
- package/dist/replay-driver-beta.d.ts +48 -0
- package/dist/replay-driver-public.d.ts +48 -0
- package/dist/replay-driver-untrimmed.d.ts +187 -0
- package/dist/replayController.cjs +2 -0
- package/dist/replayController.cjs.map +1 -1
- package/dist/replayController.d.ts +2 -0
- package/dist/replayController.d.ts.map +1 -1
- package/dist/replayDocumentService.cjs +1 -0
- package/dist/replayDocumentService.cjs.map +1 -1
- package/dist/replayDocumentService.d.ts +1 -0
- package/dist/replayDocumentService.d.ts.map +1 -1
- package/dist/replayDocumentServiceFactory.cjs +3 -0
- package/dist/replayDocumentServiceFactory.cjs.map +1 -1
- package/dist/replayDocumentServiceFactory.d.ts +3 -0
- package/dist/replayDocumentServiceFactory.d.ts.map +1 -1
- package/dist/storageImplementations.cjs +12 -0
- package/dist/storageImplementations.cjs.map +1 -1
- package/dist/storageImplementations.d.ts +13 -0
- package/dist/storageImplementations.d.ts.map +1 -1
- package/lib/emptyDeltaStorageService.d.ts.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/replay-driver-alpha.d.ts +34 -0
- package/lib/replay-driver-beta.d.ts +48 -0
- package/lib/replay-driver-public.d.ts +48 -0
- package/lib/replay-driver-untrimmed.d.ts +187 -0
- package/lib/replayController.d.ts +2 -0
- package/lib/replayController.d.ts.map +1 -1
- package/lib/replayController.mjs +2 -0
- package/lib/replayController.mjs.map +1 -1
- package/lib/replayDocumentDeltaConnection.d.ts +1 -1
- package/lib/replayDocumentDeltaConnection.d.ts.map +1 -1
- package/lib/replayDocumentService.d.ts +2 -1
- package/lib/replayDocumentService.d.ts.map +1 -1
- package/lib/replayDocumentService.mjs +1 -0
- package/lib/replayDocumentService.mjs.map +1 -1
- package/lib/replayDocumentServiceFactory.d.ts +4 -1
- package/lib/replayDocumentServiceFactory.d.ts.map +1 -1
- package/lib/replayDocumentServiceFactory.mjs +3 -0
- package/lib/replayDocumentServiceFactory.mjs.map +1 -1
- package/lib/storageImplementations.d.ts +14 -1
- package/lib/storageImplementations.d.ts.map +1 -1
- package/lib/storageImplementations.mjs +12 -0
- package/lib/storageImplementations.mjs.map +1 -1
- package/package.json +27 -12
- package/src/replayController.ts +2 -0
- package/src/replayDocumentService.ts +1 -0
- package/src/replayDocumentServiceFactory.ts +3 -0
- package/src/storageImplementations.ts +13 -0
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
import { createChildLogger } from "@fluidframework/telemetry-utils";
|
|
6
6
|
import { ReplayControllerStatic } from "./replayDocumentDeltaConnection.mjs";
|
|
7
7
|
import { ReplayDocumentService } from "./replayDocumentService.mjs";
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
8
11
|
export class ReplayDocumentServiceFactory {
|
|
9
12
|
static create(from, to, documentServiceFactory) {
|
|
10
13
|
return new ReplayDocumentServiceFactory(documentServiceFactory, new ReplayControllerStatic(from, to));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replayDocumentServiceFactory.mjs","sourceRoot":"","sources":["../src/replayDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;OASI,EAAE,iBAAiB,EAAE,MAAM,iCAAiC;OAE5D,EAAE,sBAAsB,EAAE;OAC1B,EAAE,qBAAqB,EAAE;AAEhC,MAAM,OAAO,4BAA4B;IACjC,MAAM,CAAC,MAAM,CACnB,IAAY,EACZ,EAAU,EACV,sBAA+C;QAE/C,OAAO,IAAI,4BAA4B,CACtC,sBAAsB,EACtB,IAAI,sBAAsB,CAAC,IAAI,EAAE,EAAE,CAAC,CACpC,CAAC;IACH,CAAC;IAED,YACkB,sBAA+C,EAC/C,UAA4B;QAD5B,2BAAsB,GAAtB,sBAAsB,CAAyB;QAC/C,eAAU,GAAV,UAAU,CAAkB;IAC3C,CAAC;IAEJ;;;;;OAKG;IACI,KAAK,CAAC,qBAAqB,CACjC,WAAyB,EACzB,MAA6B,EAC7B,kBAA4B;QAE5B,iEAAiE;QACjE,wGAAwG;QACxG,MAAM,YAAY,GAAG,iBAAiB,CAAC;YACtC,MAAM;YACN,UAAU,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;SACvC,CAAC,CAAC;QAEH,OAAO,qBAAqB,CAAC,MAAM,CAClC,MAAM,IAAI,CAAC,sBAAsB,CAAC,qBAAqB,CACtD,WAAW,EACX,YAAY,EACZ,kBAAkB,CAClB,EACD,IAAI,CAAC,UAAU,CACf,CAAC;IACH,CAAC;IAED,8EAA8E;IACvE,KAAK,CAAC,eAAe,CAC3B,gBAA8B,EAC9B,WAAyB,EACzB,MAA6B,EAC7B,kBAA4B;QAE5B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDocumentService,\n\tIDocumentServiceFactory,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { ReplayController } from \"./replayController\";\nimport { ReplayControllerStatic } from \"./replayDocumentDeltaConnection\";\nimport { ReplayDocumentService } from \"./replayDocumentService\";\n\nexport class ReplayDocumentServiceFactory implements IDocumentServiceFactory {\n\tpublic static create(\n\t\tfrom: number,\n\t\tto: number,\n\t\tdocumentServiceFactory: IDocumentServiceFactory,\n\t) {\n\t\treturn new ReplayDocumentServiceFactory(\n\t\t\tdocumentServiceFactory,\n\t\t\tnew ReplayControllerStatic(from, to),\n\t\t);\n\t}\n\n\tpublic constructor(\n\t\tprivate readonly documentServiceFactory: IDocumentServiceFactory,\n\t\tprivate readonly controller: ReplayController,\n\t) {}\n\n\t/**\n\t * Creates a replay document service which uses the document service of provided\n\t * documentServiceFactory for connecting to delta stream endpoint.\n\t * @param resolvedUrl - URL to be used for connecting to endpoints.\n\t * @returns returns the requested document service\n\t */\n\tpublic async createDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\t// Always include isReplay: true on events for the Replay Driver.\n\t\t// It's used in testing/debugging scenarios, so we want to be able to filter these events out sometimes.\n\t\tconst replayLogger = createChildLogger({\n\t\t\tlogger,\n\t\t\tproperties: { all: { isReplay: true } },\n\t\t});\n\n\t\treturn ReplayDocumentService.create(\n\t\t\tawait this.documentServiceFactory.createDocumentService(\n\t\t\t\tresolvedUrl,\n\t\t\t\treplayLogger,\n\t\t\t\tclientIsSummarizer,\n\t\t\t),\n\t\t\tthis.controller,\n\t\t);\n\t}\n\n\t// TODO: Issue-2109 Implement detach container api or put appropriate comment.\n\tpublic async createContainer(\n\t\tcreateNewSummary: ISummaryTree,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"replayDocumentServiceFactory.mjs","sourceRoot":"","sources":["../src/replayDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;OASI,EAAE,iBAAiB,EAAE,MAAM,iCAAiC;OAE5D,EAAE,sBAAsB,EAAE;OAC1B,EAAE,qBAAqB,EAAE;AAEhC;;GAEG;AACH,MAAM,OAAO,4BAA4B;IACjC,MAAM,CAAC,MAAM,CACnB,IAAY,EACZ,EAAU,EACV,sBAA+C;QAE/C,OAAO,IAAI,4BAA4B,CACtC,sBAAsB,EACtB,IAAI,sBAAsB,CAAC,IAAI,EAAE,EAAE,CAAC,CACpC,CAAC;IACH,CAAC;IAED,YACkB,sBAA+C,EAC/C,UAA4B;QAD5B,2BAAsB,GAAtB,sBAAsB,CAAyB;QAC/C,eAAU,GAAV,UAAU,CAAkB;IAC3C,CAAC;IAEJ;;;;;OAKG;IACI,KAAK,CAAC,qBAAqB,CACjC,WAAyB,EACzB,MAA6B,EAC7B,kBAA4B;QAE5B,iEAAiE;QACjE,wGAAwG;QACxG,MAAM,YAAY,GAAG,iBAAiB,CAAC;YACtC,MAAM;YACN,UAAU,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;SACvC,CAAC,CAAC;QAEH,OAAO,qBAAqB,CAAC,MAAM,CAClC,MAAM,IAAI,CAAC,sBAAsB,CAAC,qBAAqB,CACtD,WAAW,EACX,YAAY,EACZ,kBAAkB,CAClB,EACD,IAAI,CAAC,UAAU,CACf,CAAC;IACH,CAAC;IAED,8EAA8E;IACvE,KAAK,CAAC,eAAe,CAC3B,gBAA8B,EAC9B,WAAyB,EACzB,MAA6B,EAC7B,kBAA4B;QAE5B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDocumentService,\n\tIDocumentServiceFactory,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { ReplayController } from \"./replayController\";\nimport { ReplayControllerStatic } from \"./replayDocumentDeltaConnection\";\nimport { ReplayDocumentService } from \"./replayDocumentService\";\n\n/**\n * @internal\n */\nexport class ReplayDocumentServiceFactory implements IDocumentServiceFactory {\n\tpublic static create(\n\t\tfrom: number,\n\t\tto: number,\n\t\tdocumentServiceFactory: IDocumentServiceFactory,\n\t) {\n\t\treturn new ReplayDocumentServiceFactory(\n\t\t\tdocumentServiceFactory,\n\t\t\tnew ReplayControllerStatic(from, to),\n\t\t);\n\t}\n\n\tpublic constructor(\n\t\tprivate readonly documentServiceFactory: IDocumentServiceFactory,\n\t\tprivate readonly controller: ReplayController,\n\t) {}\n\n\t/**\n\t * Creates a replay document service which uses the document service of provided\n\t * documentServiceFactory for connecting to delta stream endpoint.\n\t * @param resolvedUrl - URL to be used for connecting to endpoints.\n\t * @returns returns the requested document service\n\t */\n\tpublic async createDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\t// Always include isReplay: true on events for the Replay Driver.\n\t\t// It's used in testing/debugging scenarios, so we want to be able to filter these events out sometimes.\n\t\tconst replayLogger = createChildLogger({\n\t\t\tlogger,\n\t\t\tproperties: { all: { isReplay: true } },\n\t\t});\n\n\t\treturn ReplayDocumentService.create(\n\t\t\tawait this.documentServiceFactory.createDocumentService(\n\t\t\t\tresolvedUrl,\n\t\t\t\treplayLogger,\n\t\t\t\tclientIsSummarizer,\n\t\t\t),\n\t\t\tthis.controller,\n\t\t);\n\t}\n\n\t// TODO: Issue-2109 Implement detach container api or put appropriate comment.\n\tpublic async createContainer(\n\t\tcreateNewSummary: ISummaryTree,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n}\n"]}
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
import { IDocumentDeltaConnection, IDocumentDeltaStorageService, IDocumentService, IDocumentServiceFactory, IDocumentStorageService, IResolvedUrl } from "@fluidframework/driver-definitions";
|
|
6
6
|
import { IClient, ISnapshotTree, ITree, IVersion, ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
8
|
-
import { ReadDocumentStorageServiceBase } from "./replayController";
|
|
8
|
+
import { ReadDocumentStorageServiceBase } from "./replayController.mjs";
|
|
9
9
|
/**
|
|
10
10
|
* Structure of snapshot on disk, when we store snapshot as single file
|
|
11
|
+
* @internal
|
|
11
12
|
*/
|
|
12
13
|
export interface IFileSnapshot {
|
|
13
14
|
tree: ITree;
|
|
@@ -15,6 +16,9 @@ export interface IFileSnapshot {
|
|
|
15
16
|
[key: string]: ITree;
|
|
16
17
|
};
|
|
17
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
18
22
|
export declare class FileSnapshotReader extends ReadDocumentStorageServiceBase implements IDocumentStorageService {
|
|
19
23
|
protected static readonly FileStorageVersionTreeId = "FileStorageTreeId";
|
|
20
24
|
protected docId?: string;
|
|
@@ -31,6 +35,9 @@ export declare class FileSnapshotReader extends ReadDocumentStorageServiceBase i
|
|
|
31
35
|
getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null>;
|
|
32
36
|
readBlob(blobId: string): Promise<ArrayBufferLike>;
|
|
33
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
34
41
|
export declare class SnapshotStorage extends ReadDocumentStorageServiceBase {
|
|
35
42
|
protected readonly storage: IDocumentStorageService;
|
|
36
43
|
protected readonly docTree: ISnapshotTree | null;
|
|
@@ -40,6 +47,9 @@ export declare class SnapshotStorage extends ReadDocumentStorageServiceBase {
|
|
|
40
47
|
getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null>;
|
|
41
48
|
readBlob(blobId: string): Promise<ArrayBufferLike>;
|
|
42
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
43
53
|
export declare class OpStorage extends ReadDocumentStorageServiceBase {
|
|
44
54
|
getVersions(versionId: string | null, count: number): Promise<IVersion[]>;
|
|
45
55
|
getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
|
|
@@ -54,6 +64,9 @@ export declare class StaticStorageDocumentService implements IDocumentService {
|
|
|
54
64
|
connectToDeltaStorage(): Promise<IDocumentDeltaStorageService>;
|
|
55
65
|
connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection>;
|
|
56
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
57
70
|
export declare class StaticStorageDocumentServiceFactory implements IDocumentServiceFactory {
|
|
58
71
|
protected readonly storage: IDocumentStorageService;
|
|
59
72
|
constructor(storage: IDocumentStorageService);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageImplementations.d.ts","sourceRoot":"","sources":["../src/storageImplementations.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"storageImplementations.d.ts","sourceRoot":"","sources":["../src/storageImplementations.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EACN,wBAAwB,EACxB,4BAA4B,EAC5B,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,MAAM,oCAAoC;OAEpC,EACN,OAAO,EACP,aAAa,EACb,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,MAAM,sCAAsC;OACtC,EAAE,mBAAmB,EAAE,MAAM,iCAAiC;OAE9D,EAAE,8BAA8B,EAAE;AAEzC;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,KAAK,CAAC;IACZ,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAA;KAAE,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,kBACZ,SAAQ,8BACR,YAAW,uBAAuB;IAGlC,SAAS,CAAC,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|
import { EmptyDeltaStorageService } from "./emptyDeltaStorageService.mjs";
|
|
8
8
|
import { ReadDocumentStorageServiceBase } from "./replayController.mjs";
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
9
12
|
export class FileSnapshotReader extends ReadDocumentStorageServiceBase {
|
|
10
13
|
constructor(json) {
|
|
11
14
|
super();
|
|
@@ -55,6 +58,9 @@ export class FileSnapshotReader extends ReadDocumentStorageServiceBase {
|
|
|
55
58
|
}
|
|
56
59
|
// IVersion.treeId used to communicate between getVersions() & getSnapshotTree() calls to indicate IVersion is ours.
|
|
57
60
|
FileSnapshotReader.FileStorageVersionTreeId = "FileStorageTreeId";
|
|
61
|
+
/**
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
58
64
|
export class SnapshotStorage extends ReadDocumentStorageServiceBase {
|
|
59
65
|
constructor(storage, docTree) {
|
|
60
66
|
super();
|
|
@@ -81,6 +87,9 @@ export class SnapshotStorage extends ReadDocumentStorageServiceBase {
|
|
|
81
87
|
return this.storage.readBlob(blobId);
|
|
82
88
|
}
|
|
83
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
84
93
|
export class OpStorage extends ReadDocumentStorageServiceBase {
|
|
85
94
|
async getVersions(versionId, count) {
|
|
86
95
|
return [];
|
|
@@ -109,6 +118,9 @@ export class StaticStorageDocumentService {
|
|
|
109
118
|
return new Promise(() => { });
|
|
110
119
|
}
|
|
111
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
112
124
|
export class StaticStorageDocumentServiceFactory {
|
|
113
125
|
constructor(storage) {
|
|
114
126
|
this.storage = storage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageImplementations.mjs","sourceRoot":"","sources":["../src/storageImplementations.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAS5C,EAAE,iBAAiB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AAI,CAAC;IAEZ,KAAK,CAAC,gBAAgB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,qBAAqB;QACjC,OAAO,IAAI,wBAAwB,EAAE,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAe;QAChD,4DAA4D;QAC5D,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;CACD;AAED,MAAM,OAAO,mCAAmC;IAC/C,YAAsC,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;IAAG,CAAC;IAEnE,KAAK,CAAC,qBAAqB,CACjC,OAAqB,EACrB,MAA4B,EAC5B,kBAA4B;QAE5B,OAAO,IAAI,4BAA4B,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;IAED,8EAA8E;IACvE,KAAK,CAAC,eAAe,CAC3B,gBAA8B,EAC9B,WAAyB,EACzB,MAA2B,EAC3B,kBAA4B;QAE5B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceFactory,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport {\n\tIClient,\n\tISnapshotTree,\n\tITree,\n\tIVersion,\n\tISummaryTree,\n} from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { EmptyDeltaStorageService } from \"./emptyDeltaStorageService\";\nimport { ReadDocumentStorageServiceBase } from \"./replayController\";\n\n/**\n * Structure of snapshot on disk, when we store snapshot as single file\n */\nexport interface IFileSnapshot {\n\ttree: ITree;\n\tcommits: { [key: string]: ITree };\n}\n\nexport class FileSnapshotReader\n\textends ReadDocumentStorageServiceBase\n\timplements IDocumentStorageService\n{\n\t// IVersion.treeId used to communicate between getVersions() & getSnapshotTree() calls to indicate IVersion is ours.\n\tprotected static readonly FileStorageVersionTreeId = \"FileStorageTreeId\";\n\n\tprotected docId?: string;\n\tprotected docTree: ISnapshotTree;\n\tprotected blobs: Map<string, ArrayBufferLike>;\n\tprotected readonly commits: { [key: string]: ITree } = {};\n\tprotected readonly trees: { [key: string]: ISnapshotTree } = {};\n\n\tpublic constructor(json: IFileSnapshot) {\n\t\tsuper();\n\t\tthis.commits = json.commits;\n\n\t\tthis.blobs = new Map<string, ArrayBufferLike>();\n\t\tthis.docTree = buildSnapshotTree(json.tree.entries, this.blobs);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.docId === undefined || this.docId === versionId || versionId === null) {\n\t\t\tif (versionId !== null) {\n\t\t\t\tthis.docId = versionId;\n\t\t\t}\n\t\t\treturn [{ id: \"latest\", treeId: \"\" }];\n\t\t}\n\n\t\tif (this.commits[versionId] !== undefined) {\n\t\t\treturn [{ id: versionId, treeId: FileSnapshotReader.FileStorageVersionTreeId }];\n\t\t}\n\t\tthrow new Error(`Unknown version ID: ${versionId}`);\n\t}\n\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (!versionRequested || versionRequested.id === \"latest\") {\n\t\t\treturn this.docTree;\n\t\t}\n\t\tif (versionRequested.treeId !== FileSnapshotReader.FileStorageVersionTreeId) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\tthrow new Error(`Unknown version id: ${versionRequested}`);\n\t\t}\n\n\t\tlet snapshotTree = this.trees[versionRequested.id];\n\t\tif (snapshotTree === undefined) {\n\t\t\tconst tree = this.commits[versionRequested.id];\n\t\t\tif (tree === undefined) {\n\t\t\t\tthrow new Error(`Can't find version ${versionRequested.id}`);\n\t\t\t}\n\n\t\t\tthis.trees[versionRequested.id] = snapshotTree = buildSnapshotTree(\n\t\t\t\ttree.entries,\n\t\t\t\tthis.blobs,\n\t\t\t);\n\t\t}\n\t\treturn snapshotTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tconst blob = this.blobs.get(blobId);\n\t\tif (blob !== undefined) {\n\t\t\treturn blob;\n\t\t}\n\t\tthrow new Error(`Unknown blob ID: ${blobId}`);\n\t}\n}\n\nexport class SnapshotStorage extends ReadDocumentStorageServiceBase {\n\tprotected docId?: string;\n\n\tconstructor(\n\t\tprotected readonly storage: IDocumentStorageService,\n\t\tprotected readonly docTree: ISnapshotTree | null,\n\t) {\n\t\tsuper();\n\t\tassert(!!this.docTree, 0x0b0 /* \"Missing document snapshot tree!\" */);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.docId === undefined || this.docId === versionId || versionId === null) {\n\t\t\tif (versionId !== null) {\n\t\t\t\tthis.docId = versionId;\n\t\t\t}\n\t\t\treturn [{ id: \"latest\", treeId: \"\" }];\n\t\t}\n\t\treturn this.storage.getVersions(versionId, count);\n\t}\n\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (versionRequested && versionRequested.id !== \"latest\") {\n\t\t\treturn this.storage.getSnapshotTree(versionRequested);\n\t\t}\n\n\t\treturn this.docTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\treturn this.storage.readBlob(blobId);\n\t}\n}\n\nexport class OpStorage extends ReadDocumentStorageServiceBase {\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\treturn [];\n\t}\n\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\tthrow new Error(\"no snapshot tree should be asked when playing ops\");\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tthrow new Error(`Unknown blob ID: ${blobId}`);\n\t}\n}\n\nexport class StaticStorageDocumentService implements IDocumentService {\n\tconstructor(\n\t\tpublic readonly resolvedUrl: IResolvedUrl,\n\t\tprivate readonly storage: IDocumentStorageService,\n\t) {}\n\n\tpublic dispose() {}\n\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\treturn this.storage;\n\t}\n\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\treturn new EmptyDeltaStorageService();\n\t}\n\n\tpublic async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\t// We have no delta stream, so make it not return forever...\n\t\treturn new Promise(() => {});\n\t}\n}\n\nexport class StaticStorageDocumentServiceFactory implements IDocumentServiceFactory {\n\tpublic constructor(protected readonly storage: IDocumentStorageService) {}\n\n\tpublic async createDocumentService(\n\t\tfileURL: IResolvedUrl,\n\t\tlogger?: ITelemetryLoggerExt,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\treturn new StaticStorageDocumentService(fileURL, this.storage);\n\t}\n\n\t// TODO: Issue-2109 Implement detach container api or put appropriate comment.\n\tpublic async createContainer(\n\t\tcreateNewSummary: ISummaryTree,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"storageImplementations.mjs","sourceRoot":"","sources":["../src/storageImplementations.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAS5C,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OASzD,EAAE,wBAAwB,EAAE;OAC5B,EAAE,8BAA8B,EAAE;AAWzC;;GAEG;AACH,MAAM,OAAO,kBACZ,SAAQ,8BAA8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M,KAAK,CAAC,qBAAqB;QACjC,OAAO,IAAI,wBAAwB,EAAE,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAe;QAChD,4DAA4D;QAC5D,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,mCAAmC;IAC/C,YAAsC,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;IAAG,CAAC;IAEnE,KAAK,CAAC,qBAAqB,CACjC,OAAqB,EACrB,MAA4B,EAC5B,kBAA4B;QAE5B,OAAO,IAAI,4BAA4B,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;IAED,8EAA8E;IACvE,KAAK,CAAC,eAAe,CAC3B,gBAA8B,EAC9B,WAAyB,EACzB,MAA2B,EAC3B,kBAA4B;QAE5B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceFactory,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport {\n\tIClient,\n\tISnapshotTree,\n\tITree,\n\tIVersion,\n\tISummaryTree,\n} from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { EmptyDeltaStorageService } from \"./emptyDeltaStorageService\";\nimport { ReadDocumentStorageServiceBase } from \"./replayController\";\n\n/**\n * Structure of snapshot on disk, when we store snapshot as single file\n * @internal\n */\nexport interface IFileSnapshot {\n\ttree: ITree;\n\tcommits: { [key: string]: ITree };\n}\n\n/**\n * @internal\n */\nexport class FileSnapshotReader\n\textends ReadDocumentStorageServiceBase\n\timplements IDocumentStorageService\n{\n\t// IVersion.treeId used to communicate between getVersions() & getSnapshotTree() calls to indicate IVersion is ours.\n\tprotected static readonly FileStorageVersionTreeId = \"FileStorageTreeId\";\n\n\tprotected docId?: string;\n\tprotected docTree: ISnapshotTree;\n\tprotected blobs: Map<string, ArrayBufferLike>;\n\tprotected readonly commits: { [key: string]: ITree } = {};\n\tprotected readonly trees: { [key: string]: ISnapshotTree } = {};\n\n\tpublic constructor(json: IFileSnapshot) {\n\t\tsuper();\n\t\tthis.commits = json.commits;\n\n\t\tthis.blobs = new Map<string, ArrayBufferLike>();\n\t\tthis.docTree = buildSnapshotTree(json.tree.entries, this.blobs);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.docId === undefined || this.docId === versionId || versionId === null) {\n\t\t\tif (versionId !== null) {\n\t\t\t\tthis.docId = versionId;\n\t\t\t}\n\t\t\treturn [{ id: \"latest\", treeId: \"\" }];\n\t\t}\n\n\t\tif (this.commits[versionId] !== undefined) {\n\t\t\treturn [{ id: versionId, treeId: FileSnapshotReader.FileStorageVersionTreeId }];\n\t\t}\n\t\tthrow new Error(`Unknown version ID: ${versionId}`);\n\t}\n\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (!versionRequested || versionRequested.id === \"latest\") {\n\t\t\treturn this.docTree;\n\t\t}\n\t\tif (versionRequested.treeId !== FileSnapshotReader.FileStorageVersionTreeId) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\tthrow new Error(`Unknown version id: ${versionRequested}`);\n\t\t}\n\n\t\tlet snapshotTree = this.trees[versionRequested.id];\n\t\tif (snapshotTree === undefined) {\n\t\t\tconst tree = this.commits[versionRequested.id];\n\t\t\tif (tree === undefined) {\n\t\t\t\tthrow new Error(`Can't find version ${versionRequested.id}`);\n\t\t\t}\n\n\t\t\tthis.trees[versionRequested.id] = snapshotTree = buildSnapshotTree(\n\t\t\t\ttree.entries,\n\t\t\t\tthis.blobs,\n\t\t\t);\n\t\t}\n\t\treturn snapshotTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tconst blob = this.blobs.get(blobId);\n\t\tif (blob !== undefined) {\n\t\t\treturn blob;\n\t\t}\n\t\tthrow new Error(`Unknown blob ID: ${blobId}`);\n\t}\n}\n\n/**\n * @internal\n */\nexport class SnapshotStorage extends ReadDocumentStorageServiceBase {\n\tprotected docId?: string;\n\n\tconstructor(\n\t\tprotected readonly storage: IDocumentStorageService,\n\t\tprotected readonly docTree: ISnapshotTree | null,\n\t) {\n\t\tsuper();\n\t\tassert(!!this.docTree, 0x0b0 /* \"Missing document snapshot tree!\" */);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.docId === undefined || this.docId === versionId || versionId === null) {\n\t\t\tif (versionId !== null) {\n\t\t\t\tthis.docId = versionId;\n\t\t\t}\n\t\t\treturn [{ id: \"latest\", treeId: \"\" }];\n\t\t}\n\t\treturn this.storage.getVersions(versionId, count);\n\t}\n\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (versionRequested && versionRequested.id !== \"latest\") {\n\t\t\treturn this.storage.getSnapshotTree(versionRequested);\n\t\t}\n\n\t\treturn this.docTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\treturn this.storage.readBlob(blobId);\n\t}\n}\n\n/**\n * @internal\n */\nexport class OpStorage extends ReadDocumentStorageServiceBase {\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\treturn [];\n\t}\n\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\tthrow new Error(\"no snapshot tree should be asked when playing ops\");\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tthrow new Error(`Unknown blob ID: ${blobId}`);\n\t}\n}\n\nexport class StaticStorageDocumentService implements IDocumentService {\n\tconstructor(\n\t\tpublic readonly resolvedUrl: IResolvedUrl,\n\t\tprivate readonly storage: IDocumentStorageService,\n\t) {}\n\n\tpublic dispose() {}\n\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\treturn this.storage;\n\t}\n\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\treturn new EmptyDeltaStorageService();\n\t}\n\n\tpublic async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\t// We have no delta stream, so make it not return forever...\n\t\treturn new Promise(() => {});\n\t}\n}\n\n/**\n * @internal\n */\nexport class StaticStorageDocumentServiceFactory implements IDocumentServiceFactory {\n\tpublic constructor(protected readonly storage: IDocumentStorageService) {}\n\n\tpublic async createDocumentService(\n\t\tfileURL: IResolvedUrl,\n\t\tlogger?: ITelemetryLoggerExt,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\treturn new StaticStorageDocumentService(fileURL, this.storage);\n\t}\n\n\t// TODO: Issue-2109 Implement detach container api or put appropriate comment.\n\tpublic async createContainer(\n\t\tcreateNewSummary: ISummaryTree,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/replay-driver",
|
|
3
|
-
"version": "2.0.0-internal.
|
|
3
|
+
"version": "2.0.0-internal.8.0.0",
|
|
4
4
|
"description": "Document replay version of Socket.IO implementation",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -15,15 +15,16 @@
|
|
|
15
15
|
"module": "lib/index.mjs",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@fluid-internal/client-utils": ">=2.0.0-internal.
|
|
19
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.
|
|
20
|
-
"@fluidframework/core-utils": ">=2.0.0-internal.
|
|
21
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.
|
|
22
|
-
"@fluidframework/driver-utils": ">=2.0.0-internal.
|
|
18
|
+
"@fluid-internal/client-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
19
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
20
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
21
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
22
|
+
"@fluidframework/driver-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
|
|
23
23
|
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
24
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.
|
|
24
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
+
"@arethetypeswrong/cli": "^0.13.3",
|
|
27
28
|
"@fluid-tools/build-cli": "^0.28.0",
|
|
28
29
|
"@fluidframework/build-common": "^2.0.3",
|
|
29
30
|
"@fluidframework/build-tools": "^0.28.0",
|
|
@@ -31,7 +32,8 @@
|
|
|
31
32
|
"@fluidframework/replay-driver-previous": "npm:@fluidframework/replay-driver@2.0.0-internal.7.2.0",
|
|
32
33
|
"@microsoft/api-extractor": "^7.38.3",
|
|
33
34
|
"@types/nock": "^9.3.0",
|
|
34
|
-
"@types/node": "^
|
|
35
|
+
"@types/node": "^18.19.0",
|
|
36
|
+
"copyfiles": "^2.4.1",
|
|
35
37
|
"eslint": "~8.50.0",
|
|
36
38
|
"nock": "^13.3.3",
|
|
37
39
|
"prettier": "~3.0.3",
|
|
@@ -41,6 +43,14 @@
|
|
|
41
43
|
},
|
|
42
44
|
"fluidBuild": {
|
|
43
45
|
"tasks": {
|
|
46
|
+
"build:docs": {
|
|
47
|
+
"dependsOn": [
|
|
48
|
+
"...",
|
|
49
|
+
"api-extractor:commonjs",
|
|
50
|
+
"api-extractor:esnext"
|
|
51
|
+
],
|
|
52
|
+
"script": false
|
|
53
|
+
},
|
|
44
54
|
"tsc": [
|
|
45
55
|
"...",
|
|
46
56
|
"typetests:gen"
|
|
@@ -51,19 +61,24 @@
|
|
|
51
61
|
"broken": {}
|
|
52
62
|
},
|
|
53
63
|
"scripts": {
|
|
64
|
+
"api": "fluid-build . --task api",
|
|
65
|
+
"api-extractor:commonjs": "api-extractor run --local",
|
|
66
|
+
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
|
|
54
67
|
"build": "fluid-build . --task build",
|
|
55
68
|
"build:compile": "fluid-build . --task compile",
|
|
56
|
-
"build:docs": "
|
|
69
|
+
"build:docs": "fluid-build . --task api",
|
|
57
70
|
"build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
|
|
71
|
+
"check:are-the-types-wrong": "attw --pack",
|
|
72
|
+
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
58
73
|
"ci:build:docs": "api-extractor run",
|
|
59
74
|
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
|
|
60
75
|
"eslint": "eslint --format stylish src",
|
|
61
76
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
62
77
|
"format": "npm run prettier:fix",
|
|
63
|
-
"lint": "npm run prettier && npm run eslint",
|
|
78
|
+
"lint": "npm run prettier && npm run check:release-tags && npm run eslint",
|
|
64
79
|
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
65
|
-
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
66
|
-
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
80
|
+
"prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
81
|
+
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
67
82
|
"tsc": "tsc-multi --config ../../../common/build/build-common/tsc-multi.cjs.json",
|
|
68
83
|
"typetests:gen": "fluid-type-test-generator",
|
|
69
84
|
"typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
|
package/src/replayController.ts
CHANGED
|
@@ -12,6 +12,7 @@ import * as api from "@fluidframework/protocol-definitions";
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Partial implementation of IDocumentStorageService
|
|
15
|
+
* @internal
|
|
15
16
|
*/
|
|
16
17
|
export abstract class ReadDocumentStorageServiceBase implements IDocumentStorageService {
|
|
17
18
|
public abstract getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
|
|
@@ -42,6 +43,7 @@ export abstract class ReadDocumentStorageServiceBase implements IDocumentStorage
|
|
|
42
43
|
* Replay controller object
|
|
43
44
|
* It controls where we start (snapshot, local file, no snapshots)
|
|
44
45
|
* As well as dispatch of ops
|
|
46
|
+
* @internal
|
|
45
47
|
*/
|
|
46
48
|
export abstract class ReplayController extends ReadDocumentStorageServiceBase {
|
|
47
49
|
/**
|
|
@@ -13,6 +13,7 @@ import { ReplayDocumentDeltaConnection } from "./replayDocumentDeltaConnection";
|
|
|
13
13
|
* The Replay document service dummies out the snapshot and the delta storage.
|
|
14
14
|
* Delta connection simulates the socket by fetching the ops from delta storage
|
|
15
15
|
* and emitting them with a pre determined delay
|
|
16
|
+
* @internal
|
|
16
17
|
*/
|
|
17
18
|
// eslint-disable-next-line import/namespace
|
|
18
19
|
export class ReplayDocumentService implements api.IDocumentService {
|
|
@@ -15,6 +15,9 @@ import { ReplayController } from "./replayController";
|
|
|
15
15
|
import { ReplayControllerStatic } from "./replayDocumentDeltaConnection";
|
|
16
16
|
import { ReplayDocumentService } from "./replayDocumentService";
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
18
21
|
export class ReplayDocumentServiceFactory implements IDocumentServiceFactory {
|
|
19
22
|
public static create(
|
|
20
23
|
from: number,
|
|
@@ -26,12 +26,16 @@ import { ReadDocumentStorageServiceBase } from "./replayController";
|
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Structure of snapshot on disk, when we store snapshot as single file
|
|
29
|
+
* @internal
|
|
29
30
|
*/
|
|
30
31
|
export interface IFileSnapshot {
|
|
31
32
|
tree: ITree;
|
|
32
33
|
commits: { [key: string]: ITree };
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
35
39
|
export class FileSnapshotReader
|
|
36
40
|
extends ReadDocumentStorageServiceBase
|
|
37
41
|
implements IDocumentStorageService
|
|
@@ -100,6 +104,9 @@ export class FileSnapshotReader
|
|
|
100
104
|
}
|
|
101
105
|
}
|
|
102
106
|
|
|
107
|
+
/**
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
103
110
|
export class SnapshotStorage extends ReadDocumentStorageServiceBase {
|
|
104
111
|
protected docId?: string;
|
|
105
112
|
|
|
@@ -134,6 +141,9 @@ export class SnapshotStorage extends ReadDocumentStorageServiceBase {
|
|
|
134
141
|
}
|
|
135
142
|
}
|
|
136
143
|
|
|
144
|
+
/**
|
|
145
|
+
* @internal
|
|
146
|
+
*/
|
|
137
147
|
export class OpStorage extends ReadDocumentStorageServiceBase {
|
|
138
148
|
public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {
|
|
139
149
|
return [];
|
|
@@ -170,6 +180,9 @@ export class StaticStorageDocumentService implements IDocumentService {
|
|
|
170
180
|
}
|
|
171
181
|
}
|
|
172
182
|
|
|
183
|
+
/**
|
|
184
|
+
* @internal
|
|
185
|
+
*/
|
|
173
186
|
export class StaticStorageDocumentServiceFactory implements IDocumentServiceFactory {
|
|
174
187
|
public constructor(protected readonly storage: IDocumentStorageService) {}
|
|
175
188
|
|