@fluidframework/file-driver 2.0.0-dev.7.4.0.215747 → 2.0.0-dev.7.4.0.216897
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/api-extractor-lint.json +13 -0
- package/api-extractor.json +0 -4
- package/api-report/file-driver.api.md +10 -10
- package/dist/file-driver-alpha.d.ts +46 -173
- package/dist/file-driver-beta.d.ts +46 -173
- package/dist/file-driver-public.d.ts +46 -173
- package/dist/file-driver-untrimmed.d.ts +22 -0
- package/dist/fileDeltaStorageService.d.ts +1 -0
- package/dist/fileDeltaStorageService.d.ts.map +1 -1
- package/dist/fileDeltaStorageService.js +1 -0
- package/dist/fileDeltaStorageService.js.map +1 -1
- package/dist/fileDocumentDeltaConnection.d.ts +4 -0
- package/dist/fileDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/fileDocumentDeltaConnection.js +4 -0
- package/dist/fileDocumentDeltaConnection.js.map +1 -1
- package/dist/fileDocumentServiceFactory.d.ts +1 -0
- package/dist/fileDocumentServiceFactory.d.ts.map +1 -1
- package/dist/fileDocumentServiceFactory.js +1 -0
- package/dist/fileDocumentServiceFactory.js.map +1 -1
- package/dist/fileDocumentStorageService.d.ts +16 -0
- package/dist/fileDocumentStorageService.d.ts.map +1 -1
- package/dist/fileDocumentStorageService.js +10 -0
- package/dist/fileDocumentStorageService.js.map +1 -1
- package/lib/file-driver-alpha.d.ts +46 -173
- package/lib/file-driver-beta.d.ts +46 -173
- package/lib/file-driver-public.d.ts +46 -173
- package/lib/file-driver-untrimmed.d.ts +22 -0
- package/package.json +9 -8
- package/src/fileDeltaStorageService.ts +1 -0
- package/src/fileDocumentDeltaConnection.ts +4 -0
- package/src/fileDocumentServiceFactory.ts +1 -0
- package/src/fileDocumentStorageService.ts +16 -0
|
@@ -2,186 +2,59 @@ import * as api from '@fluidframework/protocol-definitions';
|
|
|
2
2
|
import { ConnectionMode } from '@fluidframework/protocol-definitions';
|
|
3
3
|
import { IClientConfiguration } from '@fluidframework/protocol-definitions';
|
|
4
4
|
import { IConnected } from '@fluidframework/protocol-definitions';
|
|
5
|
-
import { IDisposable } from '@fluidframework/core-interfaces';
|
|
6
|
-
import { IDocumentDeltaConnection } from '@fluidframework/driver-definitions';
|
|
7
|
-
import { IDocumentDeltaConnectionEvents } from '@fluidframework/driver-definitions';
|
|
8
|
-
import { IDocumentDeltaStorageService } from '@fluidframework/driver-definitions';
|
|
9
5
|
import { IDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
10
|
-
import { IDocumentService } from '@fluidframework/driver-definitions';
|
|
11
|
-
import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
|
|
12
|
-
import { IDocumentStorageService } from '@fluidframework/driver-definitions';
|
|
13
6
|
import { IDocumentStorageServicePolicies } from '@fluidframework/driver-definitions';
|
|
14
|
-
import { IFileSnapshot } from '@fluidframework/replay-driver';
|
|
15
|
-
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
16
7
|
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
17
8
|
import { ISignalClient } from '@fluidframework/protocol-definitions';
|
|
18
9
|
import { ISignalMessage } from '@fluidframework/protocol-definitions';
|
|
19
|
-
import { IStream } from '@fluidframework/driver-definitions';
|
|
20
|
-
import { ISummaryContext } from '@fluidframework/driver-definitions';
|
|
21
10
|
import { ISummaryTree } from '@fluidframework/protocol-definitions';
|
|
22
|
-
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
23
11
|
import { ITokenClaims } from '@fluidframework/protocol-definitions';
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
onSnapshotHandler(snapshot: IFileSnapshot): void;
|
|
71
|
-
readBlob(sha: string): Promise<ArrayBufferLike>;
|
|
72
|
-
getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
|
|
73
|
-
getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
|
|
74
|
-
uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string>;
|
|
75
|
-
buildTree(snapshotTree: api.ISnapshotTree): Promise<api.ITree>;
|
|
76
|
-
repositoryUrl: string;
|
|
77
|
-
readonly policies?: IDocumentStorageServicePolicies | undefined;
|
|
78
|
-
createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse>;
|
|
79
|
-
downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree>;
|
|
80
|
-
readonly disposed?: boolean | undefined;
|
|
81
|
-
dispose?: ((error?: Error | undefined) => void) | undefined;
|
|
82
|
-
};
|
|
83
|
-
} & TBase;
|
|
84
|
-
|
|
85
|
-
export declare const FileStorageDocumentName = "FileStorageDocId";
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Document storage service for the file driver.
|
|
89
|
-
*/
|
|
90
|
-
export declare class FluidFetchReader extends ReadDocumentStorageServiceBase implements IDocumentStorageService {
|
|
91
|
-
private readonly path;
|
|
92
|
-
private readonly versionName?;
|
|
93
|
-
protected docTree: api.ISnapshotTree | null;
|
|
94
|
-
constructor(path: string, versionName?: string | undefined);
|
|
95
|
-
/**
|
|
96
|
-
* Read the file and returns the snapshot tree.
|
|
97
|
-
* @param version - The version contains the path of the file which contains the snapshot tree.
|
|
98
|
-
*/
|
|
99
|
-
getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
|
|
100
|
-
/**
|
|
101
|
-
* Gets the path of the snapshot tree to be read.
|
|
102
|
-
* @param versionId - version ID.
|
|
103
|
-
* @param count - Number of versions to be returned.
|
|
104
|
-
*/
|
|
105
|
-
getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
|
|
106
|
-
readBlob(sha: string): Promise<ArrayBufferLike>;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export declare const FluidFetchReaderFileSnapshotWriter: {
|
|
110
|
-
new (...args: any[]): {
|
|
111
|
-
blobsWriter: Map<string, ArrayBufferLike>;
|
|
112
|
-
latestWriterTree?: api.ISnapshotTree | undefined;
|
|
113
|
-
docId?: string | undefined;
|
|
114
|
-
reset(): void;
|
|
115
|
-
onSnapshotHandler(snapshot: IFileSnapshot): void;
|
|
116
|
-
readBlob(sha: string): Promise<ArrayBufferLike>;
|
|
117
|
-
getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
|
|
118
|
-
getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
|
|
119
|
-
uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string>;
|
|
120
|
-
buildTree(snapshotTree: api.ISnapshotTree): Promise<api.ITree>;
|
|
121
|
-
repositoryUrl: string;
|
|
122
|
-
readonly policies?: IDocumentStorageServicePolicies | undefined;
|
|
123
|
-
createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse>;
|
|
124
|
-
downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree>;
|
|
125
|
-
readonly disposed?: boolean | undefined;
|
|
126
|
-
dispose?: ((error?: Error | undefined) => void) | undefined;
|
|
127
|
-
};
|
|
128
|
-
} & typeof FluidFetchReader;
|
|
129
|
-
|
|
130
|
-
export declare interface ISnapshotWriterStorage extends IDocumentStorageService {
|
|
131
|
-
onSnapshotHandler(snapshot: IFileSnapshot): void;
|
|
132
|
-
reset(): void;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export declare type ReaderConstructor = new (...args: any[]) => IDocumentStorageService;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Replay service used to play ops using the delta connection.
|
|
139
|
-
*/
|
|
140
|
-
export declare class Replayer {
|
|
141
|
-
private readonly deltaConnection;
|
|
142
|
-
private readonly documentStorageService;
|
|
143
|
-
private currentReplayOp;
|
|
144
|
-
constructor(deltaConnection: ReplayFileDeltaConnection, documentStorageService: FileDeltaStorageService);
|
|
145
|
-
get currentReplayedOp(): number;
|
|
146
|
-
set currentReplayedOp(op: number);
|
|
147
|
-
get ops(): readonly Readonly<ISequencedDocumentMessage>[];
|
|
148
|
-
/**
|
|
149
|
-
* Replay the ops upto a certain number.
|
|
150
|
-
* @param replayTo - The last op number to be replayed.
|
|
151
|
-
*/
|
|
152
|
-
replay(replayTo: number): number;
|
|
153
|
-
private isDoneFetch;
|
|
154
|
-
private emit;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export declare class ReplayFileDeltaConnection extends TypedEventEmitter<IDocumentDeltaConnectionEvents> implements IDocumentDeltaConnection, IDisposable {
|
|
158
|
-
details: IConnected;
|
|
159
|
-
/**
|
|
160
|
-
* Mimic the delta connection to replay ops on it.
|
|
161
|
-
*
|
|
162
|
-
* @param documentDeltaStorageService - The delta storage service to get ops from.
|
|
163
|
-
* @returns Document delta connection.
|
|
164
|
-
*/
|
|
165
|
-
static create(documentDeltaStorageService: FileDeltaStorageService): Promise<ReplayFileDeltaConnection>;
|
|
166
|
-
readonly maxMessageSize: number;
|
|
167
|
-
private readonly replayer;
|
|
168
|
-
constructor(details: IConnected, documentDeltaStorageService: FileDeltaStorageService);
|
|
169
|
-
getReplayer(): Replayer;
|
|
170
|
-
get clientId(): string;
|
|
171
|
-
get mode(): ConnectionMode;
|
|
172
|
-
get claims(): ITokenClaims;
|
|
173
|
-
get existing(): boolean;
|
|
174
|
-
get version(): string;
|
|
175
|
-
get initialMessages(): ISequencedDocumentMessage[];
|
|
176
|
-
get initialSignals(): ISignalMessage[];
|
|
177
|
-
get initialClients(): ISignalClient[];
|
|
178
|
-
get serviceConfiguration(): IClientConfiguration;
|
|
179
|
-
submit(documentMessages: IDocumentMessage[]): void;
|
|
180
|
-
submitSignal(message: any): Promise<void>;
|
|
181
|
-
private _disposed;
|
|
182
|
-
get disposed(): boolean;
|
|
183
|
-
dispose(): void;
|
|
184
|
-
}
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: FileDeltaStorageService */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: FileDocumentServiceFactory */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: FileSnapshotWriterClassFactory */
|
|
18
|
+
|
|
19
|
+
/* Excluded from this release type: FileStorageDocumentName */
|
|
20
|
+
|
|
21
|
+
/* Excluded from this release type: FluidFetchReader */
|
|
22
|
+
|
|
23
|
+
/* Excluded from this release type: FluidFetchReaderFileSnapshotWriter */
|
|
24
|
+
|
|
25
|
+
/* Excluded from this release type: IDisposable */
|
|
26
|
+
|
|
27
|
+
/* Excluded from this release type: IDocumentDeltaConnection */
|
|
28
|
+
|
|
29
|
+
/* Excluded from this release type: IDocumentDeltaConnectionEvents */
|
|
30
|
+
|
|
31
|
+
/* Excluded from this release type: IDocumentDeltaStorageService */
|
|
32
|
+
|
|
33
|
+
/* Excluded from this release type: IDocumentService */
|
|
34
|
+
|
|
35
|
+
/* Excluded from this release type: IDocumentServiceFactory */
|
|
36
|
+
|
|
37
|
+
/* Excluded from this release type: IDocumentStorageService */
|
|
38
|
+
|
|
39
|
+
/* Excluded from this release type: IFileSnapshot */
|
|
40
|
+
|
|
41
|
+
/* Excluded from this release type: IResolvedUrl */
|
|
42
|
+
|
|
43
|
+
/* Excluded from this release type: ISnapshotWriterStorage */
|
|
44
|
+
|
|
45
|
+
/* Excluded from this release type: IStream */
|
|
46
|
+
|
|
47
|
+
/* Excluded from this release type: ISummaryContext */
|
|
48
|
+
|
|
49
|
+
/* Excluded from this release type: ITelemetryBaseLogger */
|
|
50
|
+
|
|
51
|
+
/* Excluded from this release type: ReadDocumentStorageServiceBase */
|
|
52
|
+
|
|
53
|
+
/* Excluded from this release type: ReaderConstructor */
|
|
54
|
+
|
|
55
|
+
/* Excluded from this release type: Replayer */
|
|
56
|
+
|
|
57
|
+
/* Excluded from this release type: ReplayFileDeltaConnection */
|
|
185
58
|
|
|
186
59
|
/* Excluded from this release type: TypedEventEmitter */
|
|
187
60
|
|
|
@@ -26,6 +26,7 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Provides access to the underlying delta storage on the local file storage for file driver.
|
|
29
|
+
* @internal
|
|
29
30
|
*/
|
|
30
31
|
export declare class FileDeltaStorageService implements IDocumentDeltaStorageService {
|
|
31
32
|
private readonly path;
|
|
@@ -46,6 +47,7 @@ export declare class FileDeltaStorageService implements IDocumentDeltaStorageSer
|
|
|
46
47
|
/**
|
|
47
48
|
* Factory for creating the file document service. Use this if you want to
|
|
48
49
|
* use the local file storage as underlying storage.
|
|
50
|
+
* @internal
|
|
49
51
|
*/
|
|
50
52
|
export declare class FileDocumentServiceFactory implements IDocumentServiceFactory {
|
|
51
53
|
private readonly storage;
|
|
@@ -62,6 +64,9 @@ export declare class FileDocumentServiceFactory implements IDocumentServiceFacto
|
|
|
62
64
|
createContainer(createNewSummary: ISummaryTree, resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
|
|
63
65
|
}
|
|
64
66
|
|
|
67
|
+
/**
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
65
70
|
export declare const FileSnapshotWriterClassFactory: <TBase extends ReaderConstructor>(Base: TBase) => {
|
|
66
71
|
new (...args: any[]): {
|
|
67
72
|
blobsWriter: Map<string, ArrayBufferLike>;
|
|
@@ -83,10 +88,14 @@ export declare const FileSnapshotWriterClassFactory: <TBase extends ReaderConstr
|
|
|
83
88
|
};
|
|
84
89
|
} & TBase;
|
|
85
90
|
|
|
91
|
+
/**
|
|
92
|
+
* @internal
|
|
93
|
+
*/
|
|
86
94
|
export declare const FileStorageDocumentName = "FileStorageDocId";
|
|
87
95
|
|
|
88
96
|
/**
|
|
89
97
|
* Document storage service for the file driver.
|
|
98
|
+
* @internal
|
|
90
99
|
*/
|
|
91
100
|
export declare class FluidFetchReader extends ReadDocumentStorageServiceBase implements IDocumentStorageService {
|
|
92
101
|
private readonly path;
|
|
@@ -107,6 +116,9 @@ export declare class FluidFetchReader extends ReadDocumentStorageServiceBase imp
|
|
|
107
116
|
readBlob(sha: string): Promise<ArrayBufferLike>;
|
|
108
117
|
}
|
|
109
118
|
|
|
119
|
+
/**
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
110
122
|
export declare const FluidFetchReaderFileSnapshotWriter: {
|
|
111
123
|
new (...args: any[]): {
|
|
112
124
|
blobsWriter: Map<string, ArrayBufferLike>;
|
|
@@ -128,15 +140,22 @@ export declare const FluidFetchReaderFileSnapshotWriter: {
|
|
|
128
140
|
};
|
|
129
141
|
} & typeof FluidFetchReader;
|
|
130
142
|
|
|
143
|
+
/**
|
|
144
|
+
* @internal
|
|
145
|
+
*/
|
|
131
146
|
export declare interface ISnapshotWriterStorage extends IDocumentStorageService {
|
|
132
147
|
onSnapshotHandler(snapshot: IFileSnapshot): void;
|
|
133
148
|
reset(): void;
|
|
134
149
|
}
|
|
135
150
|
|
|
151
|
+
/**
|
|
152
|
+
* @internal
|
|
153
|
+
*/
|
|
136
154
|
export declare type ReaderConstructor = new (...args: any[]) => IDocumentStorageService;
|
|
137
155
|
|
|
138
156
|
/**
|
|
139
157
|
* Replay service used to play ops using the delta connection.
|
|
158
|
+
* @internal
|
|
140
159
|
*/
|
|
141
160
|
export declare class Replayer {
|
|
142
161
|
private readonly deltaConnection;
|
|
@@ -155,6 +174,9 @@ export declare class Replayer {
|
|
|
155
174
|
private emit;
|
|
156
175
|
}
|
|
157
176
|
|
|
177
|
+
/**
|
|
178
|
+
* @internal
|
|
179
|
+
*/
|
|
158
180
|
export declare class ReplayFileDeltaConnection extends TypedEventEmitter<IDocumentDeltaConnectionEvents> implements IDocumentDeltaConnection, IDisposable {
|
|
159
181
|
details: IConnected;
|
|
160
182
|
/**
|
|
@@ -6,6 +6,7 @@ import { IDocumentDeltaStorageService, IStream } from "@fluidframework/driver-de
|
|
|
6
6
|
import * as api from "@fluidframework/protocol-definitions";
|
|
7
7
|
/**
|
|
8
8
|
* Provides access to the underlying delta storage on the local file storage for file driver.
|
|
9
|
+
* @internal
|
|
9
10
|
*/
|
|
10
11
|
export declare class FileDeltaStorageService implements IDocumentDeltaStorageService {
|
|
11
12
|
private readonly path;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileDeltaStorageService.d.ts","sourceRoot":"","sources":["../src/fileDeltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,4BAA4B,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAE3F,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"fileDeltaStorageService.d.ts","sourceRoot":"","sources":["../src/fileDeltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,4BAA4B,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAE3F,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAE5D;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,4BAA4B;IAI/D,OAAO,CAAC,QAAQ,CAAC,IAAI;IAHjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAC3D,OAAO,CAAC,OAAO,CAAuC;gBAEzB,IAAI,EAAE,MAAM;IAkBlC,aAAa,CACnB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GAAG,SAAS,EACtB,WAAW,CAAC,EAAE,WAAW,EACzB,UAAU,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC;IAI3C,IAAW,GAAG,IAAI,SAAS,QAAQ,CAAC,GAAG,CAAC,yBAAyB,CAAC,EAAE,CAEnE;IAED;;;;;OAKG;IACI,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,GAAG,CAAC,yBAAyB,EAAE;CAmBlF"}
|
|
@@ -13,6 +13,7 @@ const core_utils_1 = require("@fluidframework/core-utils");
|
|
|
13
13
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
14
14
|
/**
|
|
15
15
|
* Provides access to the underlying delta storage on the local file storage for file driver.
|
|
16
|
+
* @internal
|
|
16
17
|
*/
|
|
17
18
|
class FileDeltaStorageService {
|
|
18
19
|
constructor(path) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileDeltaStorageService.js","sourceRoot":"","sources":["../src/fileDeltaStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,4CAAoB;AACpB,2DAAoD;AAEpD,+DAAkE;AAGlE
|
|
1
|
+
{"version":3,"file":"fileDeltaStorageService.js","sourceRoot":"","sources":["../src/fileDeltaStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,4CAAoB;AACpB,2DAAoD;AAEpD,+DAAkE;AAGlE;;;GAGG;AACH,MAAa,uBAAuB;IAInC,YAA6B,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;QAFjC,YAAO,GAAoC,EAAE,CAAC;QAGrD,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,iDAAiD;QACjD,OAAO,IAAI,EAAE;YACZ,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,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AK,QAAQ,GAAG,CAAC,EAAE;YAC/E,OAAO,IAAI,CAAC,OAAO,CAAC;SACpB;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACrD,IAAA,mBAAM,EACL,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc,KAAK,QAAQ,GAAG,CAAC,EAC/C,KAAK,CAAC,kEAAkE,CACxE,CAAC;QACF,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;CACD;AA5DD,0DA4DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport fs from \"fs\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDocumentDeltaStorageService, IStream } from \"@fluidframework/driver-definitions\";\nimport { emptyMessageStream } from \"@fluidframework/driver-utils\";\nimport * as api from \"@fluidframework/protocol-definitions\";\n\n/**\n * Provides access to the underlying delta storage on the local file storage for file driver.\n * @internal\n */\nexport class FileDeltaStorageService implements IDocumentDeltaStorageService {\n\tprivate readonly messages: api.ISequencedDocumentMessage[];\n\tprivate lastOps: api.ISequencedDocumentMessage[] = [];\n\n\tconstructor(private readonly path: string) {\n\t\tthis.messages = [];\n\t\tlet counter = 0;\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\tconst filename = `${this.path}//messages${counter === 0 ? \"\" : counter}.json`;\n\t\t\tif (!fs.existsSync(filename)) {\n\t\t\t\tif (counter === 0) {\n\t\t\t\t\tthrow new Error(`file ${filename} not found`);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tconst data = fs.readFileSync(filename);\n\t\t\tthis.messages = this.messages.concat(JSON.parse(data.toString(\"utf-8\")));\n\t\t\tcounter++;\n\t\t}\n\t}\n\n\tpublic fetchMessages(\n\t\tfrom: number,\n\t\tto: number | undefined,\n\t\tabortSignal?: AbortSignal,\n\t\tcachedOnly?: boolean,\n\t): IStream<api.ISequencedDocumentMessage[]> {\n\t\treturn emptyMessageStream;\n\t}\n\n\tpublic get ops(): readonly Readonly<api.ISequencedDocumentMessage>[] {\n\t\treturn this.messages;\n\t}\n\n\t/**\n\t * Retrieve ops within the exclusive sequence number range.\n\t *\n\t * @param from - First op to be fetched.\n\t * @param to - Last op to be fetched. This is exclusive.\n\t */\n\tpublic getFromWebSocket(from: number, to: number): api.ISequencedDocumentMessage[] {\n\t\tconst readFrom = Math.max(from, 0); // Inclusive\n\t\tconst readTo = Math.min(to, this.messages.length); // Exclusive\n\n\t\tif (readFrom >= this.messages.length || readTo <= 0 || readFrom >= readTo) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// Optimizations for multiple readers (replay tool)\n\t\tif (this.lastOps.length > 0 && this.lastOps[0].sequenceNumber === readFrom + 1) {\n\t\t\treturn this.lastOps;\n\t\t}\n\t\tthis.lastOps = this.messages.slice(readFrom, readTo);\n\t\tassert(\n\t\t\tthis.lastOps[0].sequenceNumber === readFrom + 1,\n\t\t\t0x091 /* \"Retrieved ops' first sequence number has unexpected value!\" */,\n\t\t);\n\t\treturn this.lastOps;\n\t}\n}\n"]}
|
|
@@ -9,6 +9,7 @@ import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
|
9
9
|
import { FileDeltaStorageService } from "./fileDeltaStorageService";
|
|
10
10
|
/**
|
|
11
11
|
* Replay service used to play ops using the delta connection.
|
|
12
|
+
* @internal
|
|
12
13
|
*/
|
|
13
14
|
export declare class Replayer {
|
|
14
15
|
private readonly deltaConnection;
|
|
@@ -26,6 +27,9 @@ export declare class Replayer {
|
|
|
26
27
|
private isDoneFetch;
|
|
27
28
|
private emit;
|
|
28
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
29
33
|
export declare class ReplayFileDeltaConnection extends TypedEventEmitter<IDocumentDeltaConnectionEvents> implements IDocumentDeltaConnection, IDisposable {
|
|
30
34
|
details: IConnected;
|
|
31
35
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileDocumentDeltaConnection.d.ts","sourceRoot":"","sources":["../src/fileDocumentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EACN,wBAAwB,EACxB,8BAA8B,EAC9B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,cAAc,EACd,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,yBAAyB,EACzB,aAAa,EACb,cAAc,EACd,YAAY,EAEZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAuBpE
|
|
1
|
+
{"version":3,"file":"fileDocumentDeltaConnection.d.ts","sourceRoot":"","sources":["../src/fileDocumentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EACN,wBAAwB,EACxB,8BAA8B,EAC9B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,cAAc,EACd,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,yBAAyB,EACzB,aAAa,EACb,cAAc,EACd,YAAY,EAEZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAuBpE;;;GAGG;AACH,qBAAa,QAAQ;IAInB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IAJxC,OAAO,CAAC,eAAe,CAAK;gBAGV,eAAe,EAAE,yBAAyB,EAC1C,sBAAsB,EAAE,uBAAuB;IAGjE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play ops using the delta connection.
|
|
28
|
+
* @internal
|
|
28
29
|
*/
|
|
29
30
|
class Replayer {
|
|
30
31
|
constructor(deltaConnection, documentStorageService) {
|
|
@@ -79,6 +80,9 @@ class Replayer {
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
exports.Replayer = Replayer;
|
|
83
|
+
/**
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
82
86
|
class ReplayFileDeltaConnection extends client_utils_1.TypedEventEmitter {
|
|
83
87
|
/**
|
|
84
88
|
* Mimic the delta connection to replay ops on it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileDocumentDeltaConnection.js","sourceRoot":"","sources":["../src/fileDocumentDeltaConnection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,+EAU8C;AAC9C,+DAAiE;AAGjE,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B,qFAAqF;AACrF,MAAM,oBAAoB,GAAG,EAAE,GAAG,IAAI,CAAC;AAEvC,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAErC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAEvC,MAAM,MAAM,GAAiB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,CAAC,gCAAS,CAAC,OAAO,CAAC;IAC3B,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE;QACL,EAAE,EAAE,EAAE;KACN;IACD,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IAC5C,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE;IACtD,GAAG,EAAE,KAAK;CACV,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"fileDocumentDeltaConnection.js","sourceRoot":"","sources":["../src/fileDocumentDeltaConnection.ts"],"names":[],"mappings":";AA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xB,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;IACpC,CAAC;IAED,IAAW,oBAAoB;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;IAC1C,CAAC;IAEM,MAAM,CAAC,gBAAoC;QACjD,0FAA0F;QAC1F,0CAA0C;QAC1C,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACvE,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,OAAY,IAAG,CAAC;IAG1C,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IACM,OAAO;QACb,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACvB,CAAC;CACD;AAxGD,8DAwGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport {\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaConnectionEvents,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tConnectionMode,\n\tIClientConfiguration,\n\tIConnected,\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tISignalClient,\n\tISignalMessage,\n\tITokenClaims,\n\tScopeType,\n} from \"@fluidframework/protocol-definitions\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { FileDeltaStorageService } from \"./fileDeltaStorageService\";\n\nconst MaxBatchDeltas = 2000;\n\n// Since the replay service never actually sends messages the size below is arbitrary\nconst ReplayMaxMessageSize = 16 * 1024;\n\nconst fileProtocolVersion = \"^0.1.0\";\n\nconst replayDocumentId = \"replayDocId\";\n\nconst Claims: ITokenClaims = {\n\tdocumentId: replayDocumentId,\n\tscopes: [ScopeType.DocRead],\n\ttenantId: \"\",\n\tuser: {\n\t\tid: \"\",\n\t},\n\tiat: Math.round(new Date().getTime() / 1000),\n\texp: Math.round(new Date().getTime() / 1000) + 60 * 60, // 1 hour expiration\n\tver: \"1.0\",\n};\n\n/**\n * Replay service used to play ops using the delta connection.\n * @internal\n */\nexport class Replayer {\n\tprivate currentReplayOp = 0;\n\n\tconstructor(\n\t\tprivate readonly deltaConnection: ReplayFileDeltaConnection,\n\t\tprivate readonly documentStorageService: FileDeltaStorageService,\n\t) {}\n\n\tpublic get currentReplayedOp() {\n\t\treturn this.currentReplayOp;\n\t}\n\n\tpublic set currentReplayedOp(op: number) {\n\t\tthis.currentReplayOp = op;\n\t}\n\n\tpublic get ops(): readonly Readonly<ISequencedDocumentMessage>[] {\n\t\treturn this.documentStorageService.ops;\n\t}\n\n\t/**\n\t * Replay the ops upto a certain number.\n\t * @param replayTo - The last op number to be replayed.\n\t */\n\tpublic replay(replayTo: number) {\n\t\tlet totalReplayedOps = 0;\n\t\tlet done: boolean;\n\t\tdo {\n\t\t\tconst fetchToBatch = this.currentReplayOp + MaxBatchDeltas;\n\t\t\tconst fetchTo = Math.min(fetchToBatch, replayTo);\n\n\t\t\tconst fetchedOps = this.documentStorageService.getFromWebSocket(\n\t\t\t\tthis.currentReplayOp,\n\t\t\t\tfetchTo,\n\t\t\t);\n\n\t\t\tif (fetchedOps.length <= 0) {\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tthis.emit(fetchedOps);\n\t\t\t\ttotalReplayedOps += fetchedOps.length;\n\t\t\t\tthis.currentReplayOp += fetchedOps.length;\n\t\t\t\tdone = this.isDoneFetch(replayTo);\n\t\t\t}\n\t\t} while (!done);\n\t\treturn totalReplayedOps;\n\t}\n\n\tprivate isDoneFetch(replayTo: number) {\n\t\tif (replayTo >= 0) {\n\t\t\treturn this.currentReplayOp >= replayTo;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate emit(ops: ISequencedDocumentMessage[]) {\n\t\t// Note: do not clone messages here!\n\t\t// If Replay Tool fails due to one container patching message in-place,\n\t\t// then same thing can happen in shipping product due to\n\t\t// socket reuse in ODSP between main and summarizer containers.\n\t\tthis.deltaConnection.emit(\"op\", replayDocumentId, ops);\n\t}\n}\n\n/**\n * @internal\n */\nexport class ReplayFileDeltaConnection\n\textends TypedEventEmitter<IDocumentDeltaConnectionEvents>\n\timplements IDocumentDeltaConnection, IDisposable\n{\n\t/**\n\t * Mimic the delta connection to replay ops on it.\n\t *\n\t * @param documentDeltaStorageService - The delta storage service to get ops from.\n\t * @returns Document delta connection.\n\t */\n\tpublic static async create(\n\t\tdocumentDeltaStorageService: FileDeltaStorageService,\n\t): Promise<ReplayFileDeltaConnection> {\n\t\tconst mode: ConnectionMode = \"read\";\n\t\tconst connection = {\n\t\t\tclaims: Claims,\n\t\t\tclientId: \"PseudoClientId\",\n\t\t\texisting: true,\n\t\t\tinitialMessages: [],\n\t\t\tinitialSignals: [],\n\t\t\tinitialClients: [],\n\t\t\tmaxMessageSize: ReplayMaxMessageSize,\n\t\t\tmode,\n\t\t\tserviceConfiguration: {\n\t\t\t\tblockSize: 64436,\n\t\t\t\tmaxMessageSize: ReplayMaxMessageSize,\n\t\t\t},\n\t\t\tsupportedVersions: [fileProtocolVersion],\n\t\t\tuser: null,\n\t\t\tversion: fileProtocolVersion,\n\t\t};\n\t\tconst deltaConnection = new ReplayFileDeltaConnection(\n\t\t\tconnection,\n\t\t\tdocumentDeltaStorageService,\n\t\t);\n\t\treturn deltaConnection;\n\t}\n\n\tpublic readonly maxMessageSize = ReplayMaxMessageSize;\n\tprivate readonly replayer: Replayer;\n\n\tpublic constructor(\n\t\tpublic details: IConnected,\n\t\tdocumentDeltaStorageService: FileDeltaStorageService,\n\t) {\n\t\tsuper();\n\t\tthis.replayer = new Replayer(this, documentDeltaStorageService);\n\t}\n\n\tpublic getReplayer() {\n\t\treturn this.replayer;\n\t}\n\n\tpublic get clientId(): string {\n\t\treturn this.details.clientId;\n\t}\n\n\tpublic get mode(): ConnectionMode {\n\t\treturn this.details.mode;\n\t}\n\n\tpublic get claims(): ITokenClaims {\n\t\treturn this.details.claims;\n\t}\n\n\tpublic get existing(): boolean {\n\t\treturn this.details.existing;\n\t}\n\n\tpublic get version(): string {\n\t\treturn this.details.version;\n\t}\n\n\tpublic get initialMessages(): ISequencedDocumentMessage[] {\n\t\treturn this.details.initialMessages;\n\t}\n\n\tpublic get initialSignals(): ISignalMessage[] {\n\t\treturn this.details.initialSignals;\n\t}\n\n\tpublic get initialClients(): ISignalClient[] {\n\t\treturn this.details.initialClients;\n\t}\n\n\tpublic get serviceConfiguration(): IClientConfiguration {\n\t\treturn this.details.serviceConfiguration;\n\t}\n\n\tpublic submit(documentMessages: IDocumentMessage[]): void {\n\t\t// ReplayFileDeltaConnection.submit() can't be called - client never sees its own join on,\n\t\t// and thus can never move to sending ops.\n\t\tthrow new Error(\"ReplayFileDeltaConnection.submit() can't be called\");\n\t}\n\n\tpublic async submitSignal(message: any) {}\n\n\tprivate _disposed = false;\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\tpublic dispose() {\n\t\tthis._disposed = true;\n\t}\n}\n"]}
|
|
@@ -9,6 +9,7 @@ import { FileDeltaStorageService } from "./fileDeltaStorageService";
|
|
|
9
9
|
/**
|
|
10
10
|
* Factory for creating the file document service. Use this if you want to
|
|
11
11
|
* use the local file storage as underlying storage.
|
|
12
|
+
* @internal
|
|
12
13
|
*/
|
|
13
14
|
export declare class FileDocumentServiceFactory implements IDocumentServiceFactory {
|
|
14
15
|
private readonly storage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/fileDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE
|
|
1
|
+
{"version":3,"file":"fileDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/fileDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE;;;;GAIG;AACH,qBAAa,0BAA2B,YAAW,uBAAuB;IAExE,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAFf,OAAO,EAAE,uBAAuB,EAChC,YAAY,EAAE,uBAAuB,EACrC,eAAe,EAAE,wBAAwB;IAG3D;;;;;OAKG;IACU,qBAAqB,CACjC,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;IAUf,eAAe,CAC3B,gBAAgB,EAAE,YAAY,EAC9B,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;CAG5B"}
|
|
@@ -9,6 +9,7 @@ const fileDocumentService_1 = require("./fileDocumentService");
|
|
|
9
9
|
/**
|
|
10
10
|
* Factory for creating the file document service. Use this if you want to
|
|
11
11
|
* use the local file storage as underlying storage.
|
|
12
|
+
* @internal
|
|
12
13
|
*/
|
|
13
14
|
class FileDocumentServiceFactory {
|
|
14
15
|
constructor(storage, deltaStorage, deltaConnection) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileDocumentServiceFactory.js","sourceRoot":"","sources":["../src/fileDocumentServiceFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAYH,+DAA4D;AAE5D
|
|
1
|
+
{"version":3,"file":"fileDocumentServiceFactory.js","sourceRoot":"","sources":["../src/fileDocumentServiceFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAYH,+DAA4D;AAE5D;;;;GAIG;AACH,MAAa,0BAA0B;IACtC,YACkB,OAAgC,EAChC,YAAqC,EACrC,eAAyC;QAFzC,YAAO,GAAP,OAAO,CAAyB;QAChC,iBAAY,GAAZ,YAAY,CAAyB;QACrC,oBAAe,GAAf,eAAe,CAA0B;IACxD,CAAC;IAEJ;;;;;OAKG;IACI,KAAK,CAAC,qBAAqB,CACjC,WAAyB,EACzB,MAA6B,EAC7B,kBAA4B;QAE5B,OAAO,IAAI,yCAAmB,CAC7B,WAAW,EACX,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,eAAe,CACpB,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;AAnCD,gEAmCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDocumentDeltaConnection,\n\tIDocumentService,\n\tIDocumentServiceFactory,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { FileDeltaStorageService } from \"./fileDeltaStorageService\";\nimport { FileDocumentService } from \"./fileDocumentService\";\n\n/**\n * Factory for creating the file document service. Use this if you want to\n * use the local file storage as underlying storage.\n * @internal\n */\nexport class FileDocumentServiceFactory implements IDocumentServiceFactory {\n\tconstructor(\n\t\tprivate readonly storage: IDocumentStorageService,\n\t\tprivate readonly deltaStorage: FileDeltaStorageService,\n\t\tprivate readonly deltaConnection: IDocumentDeltaConnection,\n\t) {}\n\n\t/**\n\t * Creates the file document service if the path exists.\n\t *\n\t * @param fileURL - Path of directory containing ops/snapshots.\n\t * @returns file 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\treturn new FileDocumentService(\n\t\t\tresolvedUrl,\n\t\t\tthis.storage,\n\t\t\tthis.deltaStorage,\n\t\t\tthis.deltaConnection,\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,13 @@
|
|
|
5
5
|
import { IDocumentStorageService, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
6
6
|
import * as api from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { IFileSnapshot, ReadDocumentStorageServiceBase } from "@fluidframework/replay-driver";
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
8
11
|
export declare const FileStorageDocumentName = "FileStorageDocId";
|
|
9
12
|
/**
|
|
10
13
|
* Document storage service for the file driver.
|
|
14
|
+
* @internal
|
|
11
15
|
*/
|
|
12
16
|
export declare class FluidFetchReader extends ReadDocumentStorageServiceBase implements IDocumentStorageService {
|
|
13
17
|
private readonly path;
|
|
@@ -27,11 +31,20 @@ export declare class FluidFetchReader extends ReadDocumentStorageServiceBase imp
|
|
|
27
31
|
getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
|
|
28
32
|
readBlob(sha: string): Promise<ArrayBufferLike>;
|
|
29
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
30
37
|
export interface ISnapshotWriterStorage extends IDocumentStorageService {
|
|
31
38
|
onSnapshotHandler(snapshot: IFileSnapshot): void;
|
|
32
39
|
reset(): void;
|
|
33
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
34
44
|
export type ReaderConstructor = new (...args: any[]) => IDocumentStorageService;
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
35
48
|
export declare const FileSnapshotWriterClassFactory: <TBase extends ReaderConstructor>(Base: TBase) => {
|
|
36
49
|
new (...args: any[]): {
|
|
37
50
|
blobsWriter: Map<string, ArrayBufferLike>;
|
|
@@ -52,6 +65,9 @@ export declare const FileSnapshotWriterClassFactory: <TBase extends ReaderConstr
|
|
|
52
65
|
dispose?: ((error?: Error | undefined) => void) | undefined;
|
|
53
66
|
};
|
|
54
67
|
} & TBase;
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
55
71
|
export declare const FluidFetchReaderFileSnapshotWriter: {
|
|
56
72
|
new (...args: any[]): {
|
|
57
73
|
blobsWriter: Map<string, ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/fileDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE9F,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAI9F,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAK1D
|
|
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G,GAAG,EAAE;;;;;oCAiBd,aAAa,GAAG,IAAI;sBAI5B,MAAM,GAAG,QAAQ,eAAe,CAAC;+BASxB,MAAM,GAAG,IAAI,SAAS,MAAM,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC;kCAkBnD,IAAI,QAAQ,GAAG,QAAQ,IAAI,aAAa,GAAG,IAAI,CAAC;0CAQ7E,IAAI,YAAY,WAChB,eAAe,GACtB,QAAQ,MAAM,CAAC;gCAcmB,IAAI,aAAa,GAAG,QAAQ,IAAI,KAAK,CAAC;;;;;;;;SA8B3E,CAAC;AAcH;;GAEG;AACH,eAAO,MAAM,kCAAkC;kBAvHD,GAAG,EAAE;;;;;oCAiBd,aAAa,GAAG,IAAI;sBAI5B,MAAM,GAAG,QAAQ,eAAe,CAAC;+BASxB,MAAM,GAAG,IAAI,SAAS,MAAM,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC;kCAkBnD,IAAI,QAAQ,GAAG,QAAQ,IAAI,aAAa,GAAG,IAAI,CAAC;0CAQ7E,IAAI,YAAY,WAChB,eAAe,GACtB,QAAQ,MAAM,CAAC;gCAcmB,IAAI,aAAa,GAAG,QAAQ,IAAI,KAAK,CAAC;;;;;;;;2BA+CqB,CAAC"}
|
|
@@ -39,11 +39,15 @@ const api = __importStar(require("@fluidframework/protocol-definitions"));
|
|
|
39
39
|
const replay_driver_1 = require("@fluidframework/replay-driver");
|
|
40
40
|
// This ID is used by replay tool as Document Id.
|
|
41
41
|
// We leverage it to figure out when container is asking for root document tree.
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
42
45
|
exports.FileStorageDocumentName = "FileStorageDocId"; // Some unique document name
|
|
43
46
|
// Tree ID use to communicate between getVersions() & getSnapshotTree() that IVersion is ours.
|
|
44
47
|
const FileStorageVersionTreeId = "FileStorageTreeId";
|
|
45
48
|
/**
|
|
46
49
|
* Document storage service for the file driver.
|
|
50
|
+
* @internal
|
|
47
51
|
*/
|
|
48
52
|
class FluidFetchReader extends replay_driver_1.ReadDocumentStorageServiceBase {
|
|
49
53
|
constructor(path, versionName) {
|
|
@@ -123,6 +127,9 @@ class FluidFetchReader extends replay_driver_1.ReadDocumentStorageServiceBase {
|
|
|
123
127
|
}
|
|
124
128
|
}
|
|
125
129
|
exports.FluidFetchReader = FluidFetchReader;
|
|
130
|
+
/**
|
|
131
|
+
* @internal
|
|
132
|
+
*/
|
|
126
133
|
const FileSnapshotWriterClassFactory = (Base) => class extends Base {
|
|
127
134
|
constructor() {
|
|
128
135
|
super(...arguments);
|
|
@@ -214,5 +221,8 @@ function removeNullTreeIds(tree) {
|
|
|
214
221
|
(0, core_utils_1.assert)(tree.id === undefined || tree.id === null, 0x096 /* "Trying to remove valid tree IDs in removeNullTreeIds()!" */);
|
|
215
222
|
delete tree.id;
|
|
216
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* @internal
|
|
226
|
+
*/
|
|
217
227
|
exports.FluidFetchReaderFileSnapshotWriter = (0, exports.FileSnapshotWriterClassFactory)(FluidFetchReader);
|
|
218
228
|
//# sourceMappingURL=fileDocumentStorageService.js.map
|