@fluidframework/container-loader 0.59.4000 → 1.0.1

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.
Files changed (100) hide show
  1. package/.eslintrc.js +1 -1
  2. package/README.md +1 -1
  3. package/dist/connectionState.d.ts +15 -3
  4. package/dist/connectionState.d.ts.map +1 -1
  5. package/dist/connectionState.js +15 -3
  6. package/dist/connectionState.js.map +1 -1
  7. package/dist/connectionStateHandler.d.ts +6 -4
  8. package/dist/connectionStateHandler.d.ts.map +1 -1
  9. package/dist/connectionStateHandler.js +21 -6
  10. package/dist/connectionStateHandler.js.map +1 -1
  11. package/dist/container.d.ts +18 -26
  12. package/dist/container.d.ts.map +1 -1
  13. package/dist/container.js +54 -88
  14. package/dist/container.js.map +1 -1
  15. package/dist/containerContext.d.ts +6 -4
  16. package/dist/containerContext.d.ts.map +1 -1
  17. package/dist/containerContext.js +8 -7
  18. package/dist/containerContext.js.map +1 -1
  19. package/dist/containerStorageAdapter.d.ts +2 -3
  20. package/dist/containerStorageAdapter.d.ts.map +1 -1
  21. package/dist/containerStorageAdapter.js +0 -3
  22. package/dist/containerStorageAdapter.js.map +1 -1
  23. package/dist/deltaManagerProxy.d.ts +0 -1
  24. package/dist/deltaManagerProxy.d.ts.map +1 -1
  25. package/dist/deltaManagerProxy.js +0 -3
  26. package/dist/deltaManagerProxy.js.map +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/loader.d.ts +1 -13
  31. package/dist/loader.d.ts.map +1 -1
  32. package/dist/loader.js +2 -3
  33. package/dist/loader.js.map +1 -1
  34. package/dist/packageVersion.d.ts +1 -1
  35. package/dist/packageVersion.d.ts.map +1 -1
  36. package/dist/packageVersion.js +1 -1
  37. package/dist/packageVersion.js.map +1 -1
  38. package/dist/protocolTreeDocumentStorageService.d.ts +0 -1
  39. package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
  40. package/dist/protocolTreeDocumentStorageService.js +0 -1
  41. package/dist/protocolTreeDocumentStorageService.js.map +1 -1
  42. package/dist/retriableDocumentStorageService.d.ts +1 -2
  43. package/dist/retriableDocumentStorageService.d.ts.map +1 -1
  44. package/dist/retriableDocumentStorageService.js +0 -3
  45. package/dist/retriableDocumentStorageService.js.map +1 -1
  46. package/lib/connectionState.d.ts +15 -3
  47. package/lib/connectionState.d.ts.map +1 -1
  48. package/lib/connectionState.js +15 -3
  49. package/lib/connectionState.js.map +1 -1
  50. package/lib/connectionStateHandler.d.ts +6 -4
  51. package/lib/connectionStateHandler.d.ts.map +1 -1
  52. package/lib/connectionStateHandler.js +21 -6
  53. package/lib/connectionStateHandler.js.map +1 -1
  54. package/lib/container.d.ts +18 -26
  55. package/lib/container.d.ts.map +1 -1
  56. package/lib/container.js +54 -88
  57. package/lib/container.js.map +1 -1
  58. package/lib/containerContext.d.ts +6 -4
  59. package/lib/containerContext.d.ts.map +1 -1
  60. package/lib/containerContext.js +8 -7
  61. package/lib/containerContext.js.map +1 -1
  62. package/lib/containerStorageAdapter.d.ts +2 -3
  63. package/lib/containerStorageAdapter.d.ts.map +1 -1
  64. package/lib/containerStorageAdapter.js +0 -3
  65. package/lib/containerStorageAdapter.js.map +1 -1
  66. package/lib/deltaManagerProxy.d.ts +0 -1
  67. package/lib/deltaManagerProxy.d.ts.map +1 -1
  68. package/lib/deltaManagerProxy.js +0 -3
  69. package/lib/deltaManagerProxy.js.map +1 -1
  70. package/lib/index.d.ts +1 -1
  71. package/lib/index.d.ts.map +1 -1
  72. package/lib/index.js.map +1 -1
  73. package/lib/loader.d.ts +1 -13
  74. package/lib/loader.d.ts.map +1 -1
  75. package/lib/loader.js +2 -3
  76. package/lib/loader.js.map +1 -1
  77. package/lib/packageVersion.d.ts +1 -1
  78. package/lib/packageVersion.d.ts.map +1 -1
  79. package/lib/packageVersion.js +1 -1
  80. package/lib/packageVersion.js.map +1 -1
  81. package/lib/protocolTreeDocumentStorageService.d.ts +0 -1
  82. package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
  83. package/lib/protocolTreeDocumentStorageService.js +0 -1
  84. package/lib/protocolTreeDocumentStorageService.js.map +1 -1
  85. package/lib/retriableDocumentStorageService.d.ts +1 -2
  86. package/lib/retriableDocumentStorageService.d.ts.map +1 -1
  87. package/lib/retriableDocumentStorageService.js +0 -3
  88. package/lib/retriableDocumentStorageService.js.map +1 -1
  89. package/package.json +25 -25
  90. package/src/connectionState.ts +20 -6
  91. package/src/connectionStateHandler.ts +29 -8
  92. package/src/container.ts +77 -100
  93. package/src/containerContext.ts +10 -10
  94. package/src/containerStorageAdapter.ts +1 -6
  95. package/src/deltaManagerProxy.ts +0 -4
  96. package/src/index.ts +1 -0
  97. package/src/loader.ts +4 -21
  98. package/src/packageVersion.ts +1 -1
  99. package/src/protocolTreeDocumentStorageService.ts +0 -1
  100. package/src/retriableDocumentStorageService.ts +0 -8
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,kCAAkC,CAAC;AAC7C,QAAA,UAAU,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-loader\";\nexport const pkgVersion = \"0.59.4000\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,kCAAkC,CAAC;AAC7C,QAAA,UAAU,GAAG,OAAO,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-loader\";\nexport const pkgVersion = \"1.0.1\";\n"]}
@@ -14,7 +14,6 @@ export declare class ProtocolTreeStorageService implements IDocumentStorageServi
14
14
  get disposed(): boolean;
15
15
  getSnapshotTree: (version?: import("@fluidframework/protocol-definitions").IVersion | undefined) => Promise<import("@fluidframework/protocol-definitions").ISnapshotTree | null>;
16
16
  getVersions: (versionId: string | null, count: number) => Promise<import("@fluidframework/protocol-definitions").IVersion[]>;
17
- write: (root: import("@fluidframework/protocol-definitions").ITree, parents: string[], message: string, ref: string) => Promise<import("@fluidframework/protocol-definitions").IVersion>;
18
17
  createBlob: (file: ArrayBufferLike) => Promise<import("@fluidframework/protocol-definitions").ICreateBlobResponse>;
19
18
  readBlob: (id: string) => Promise<ArrayBufferLike>;
20
19
  downloadSummary: (handle: import("@fluidframework/protocol-definitions").ISummaryHandle) => Promise<ISummaryTree>;
@@ -1 +1 @@
1
- {"version":3,"file":"protocolTreeDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/protocolTreeDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EACH,uBAAuB,EACvB,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACH,YAAY,EACf,MAAM,sCAAsC,CAAC;AAE9C,qBAAa,0BAA2B,YAAW,uBAAuB,EAAE,WAAW;IAE/E,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBADpB,sBAAsB,EAAE,uBAAuB,GAAG,WAAW,EAC7D,oBAAoB,EAAE,MAAM,YAAY;IAG7D,IAAW,QAAQ,6FAElB;IACD,IAAW,aAAa,WAEvB;IACD,IAAW,QAAQ,YAElB;IAED,eAAe,kKAAiF;IAChG,WAAW,kHAA6E;IACxF,KAAK,oLAAuE;IAC5E,UAAU,yGAA4E;IACtF,QAAQ,2CAA0E;IAClF,eAAe,mGAAiF;IAChG,OAAO,sCAAyE;IAE1E,wBAAwB,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;CAMnG"}
1
+ {"version":3,"file":"protocolTreeDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/protocolTreeDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EACH,uBAAuB,EACvB,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACH,YAAY,EACf,MAAM,sCAAsC,CAAC;AAE9C,qBAAa,0BAA2B,YAAW,uBAAuB,EAAE,WAAW;IAE/E,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBADpB,sBAAsB,EAAE,uBAAuB,GAAG,WAAW,EAC7D,oBAAoB,EAAE,MAAM,YAAY;IAG7D,IAAW,QAAQ,6FAElB;IACD,IAAW,aAAa,WAEvB;IACD,IAAW,QAAQ,YAElB;IAED,eAAe,kKAAiF;IAChG,WAAW,kHAA6E;IACxF,UAAU,yGAA4E;IACtF,QAAQ,2CAA0E;IAClF,eAAe,mGAAiF;IAChG,OAAO,sCAAyE;IAE1E,wBAAwB,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;CAMnG"}
@@ -12,7 +12,6 @@ class ProtocolTreeStorageService {
12
12
  this.generateProtocolTree = generateProtocolTree;
13
13
  this.getSnapshotTree = this.internalStorageService.getSnapshotTree.bind(this.internalStorageService);
14
14
  this.getVersions = this.internalStorageService.getVersions.bind(this.internalStorageService);
15
- this.write = this.internalStorageService.write.bind(this.internalStorageService);
16
15
  this.createBlob = this.internalStorageService.createBlob.bind(this.internalStorageService);
17
16
  this.readBlob = this.internalStorageService.readBlob.bind(this.internalStorageService);
18
17
  this.downloadSummary = this.internalStorageService.downloadSummary.bind(this.internalStorageService);
@@ -1 +1 @@
1
- {"version":3,"file":"protocolTreeDocumentStorageService.js","sourceRoot":"","sources":["../src/protocolTreeDocumentStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,+DAA4E;AAK5E,MAAa,0BAA0B;IACnC,YACqB,sBAA6D,EAC7D,oBAAwC;QADxC,2BAAsB,GAAtB,sBAAsB,CAAuC;QAC7D,yBAAoB,GAApB,oBAAoB,CAAoB;QAa7D,oBAAe,GAAG,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAChG,gBAAW,GAAG,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACxF,UAAK,GAAG,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC5E,eAAU,GAAG,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACtF,aAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAClF,oBAAe,GAAG,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAChG,YAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAjBhF,CAAC;IACD,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAChD,CAAC;IACD,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC;IACrD,CAAC;IACD,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAChD,CAAC;IAUD,KAAK,CAAC,wBAAwB,CAAC,OAAqB,EAAE,OAAwB;QAC1E,OAAO,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CACvD,IAAA,2CAA4B,EAAC,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC,EAClE,OAAO,CACV,CAAC;IACN,CAAC;CACJ;AA9BD,gEA8BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable } from \"@fluidframework/common-definitions\";\nimport {\n IDocumentStorageService,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport { combineAppAndProtocolSummary } from \"@fluidframework/driver-utils\";\nimport {\n ISummaryTree,\n} from \"@fluidframework/protocol-definitions\";\n\nexport class ProtocolTreeStorageService implements IDocumentStorageService, IDisposable {\n constructor(\n private readonly internalStorageService: IDocumentStorageService & IDisposable,\n private readonly generateProtocolTree: () => ISummaryTree,\n ) {\n }\n public get policies() {\n return this.internalStorageService.policies;\n }\n public get repositoryUrl() {\n return this.internalStorageService.repositoryUrl;\n }\n public get disposed() {\n return this.internalStorageService.disposed;\n }\n\n getSnapshotTree = this.internalStorageService.getSnapshotTree.bind(this.internalStorageService);\n getVersions = this.internalStorageService.getVersions.bind(this.internalStorageService);\n write = this.internalStorageService.write.bind(this.internalStorageService);\n createBlob = this.internalStorageService.createBlob.bind(this.internalStorageService);\n readBlob = this.internalStorageService.readBlob.bind(this.internalStorageService);\n downloadSummary = this.internalStorageService.downloadSummary.bind(this.internalStorageService);\n dispose = this.internalStorageService.dispose.bind(this.internalStorageService);\n\n async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n return this.internalStorageService.uploadSummaryWithContext(\n combineAppAndProtocolSummary(summary, this.generateProtocolTree()),\n context,\n );\n }\n}\n"]}
1
+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,2CAA4B,EAAC,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC,EAClE,OAAO,CACV,CAAC;IACN,CAAC;CACJ;AA7BD,gEA6BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable } from \"@fluidframework/common-definitions\";\nimport {\n IDocumentStorageService,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport { combineAppAndProtocolSummary } from \"@fluidframework/driver-utils\";\nimport {\n ISummaryTree,\n} from \"@fluidframework/protocol-definitions\";\n\nexport class ProtocolTreeStorageService implements IDocumentStorageService, IDisposable {\n constructor(\n private readonly internalStorageService: IDocumentStorageService & IDisposable,\n private readonly generateProtocolTree: () => ISummaryTree,\n ) {\n }\n public get policies() {\n return this.internalStorageService.policies;\n }\n public get repositoryUrl() {\n return this.internalStorageService.repositoryUrl;\n }\n public get disposed() {\n return this.internalStorageService.disposed;\n }\n\n getSnapshotTree = this.internalStorageService.getSnapshotTree.bind(this.internalStorageService);\n getVersions = this.internalStorageService.getVersions.bind(this.internalStorageService);\n createBlob = this.internalStorageService.createBlob.bind(this.internalStorageService);\n readBlob = this.internalStorageService.readBlob.bind(this.internalStorageService);\n downloadSummary = this.internalStorageService.downloadSummary.bind(this.internalStorageService);\n dispose = this.internalStorageService.dispose.bind(this.internalStorageService);\n\n async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n return this.internalStorageService.uploadSummaryWithContext(\n combineAppAndProtocolSummary(summary, this.generateProtocolTree()),\n context,\n );\n }\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext } from "@fluidframework/driver-definitions";
6
- import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree, ITree, IVersion } from "@fluidframework/protocol-definitions";
6
+ import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
7
7
  import { IDisposable, ITelemetryLogger } from "@fluidframework/common-definitions";
8
8
  export declare class RetriableDocumentStorageService implements IDocumentStorageService, IDisposable {
9
9
  private readonly internalStorageService;
@@ -17,7 +17,6 @@ export declare class RetriableDocumentStorageService implements IDocumentStorage
17
17
  getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
18
18
  readBlob(id: string): Promise<ArrayBufferLike>;
19
19
  getVersions(versionId: string | null, count: number): Promise<IVersion[]>;
20
- write(tree: ITree, parents: string[], message: string, ref: string): Promise<IVersion>;
21
20
  uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
22
21
  downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
23
22
  createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"retriableDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/retriableDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACH,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,KAAK,EACL,QAAQ,EACX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAGnF,qBAAa,+BAAgC,YAAW,uBAAuB,EAAE,WAAW;IAGpF,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAH3B,OAAO,CAAC,SAAS,CAAS;gBAEL,sBAAsB,EAAE,uBAAuB,EAC/C,MAAM,EAAE,gBAAgB;IAI7C,IAAW,QAAQ,IAAI,+BAA+B,GAAG,SAAS,CAEjE;IACD,IAAW,QAAQ,YAA6B;IACzC,OAAO;IAId,IAAW,aAAa,IA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EAAE,uBAAuB,EAC/C,MAAM,EAAE,gBAAgB;IAI7C,IAAW,QAAQ,IAAI,+BAA+B,GAAG,SAAS,CAEjE;IACD,IAAW,QAAQ,YAA6B;IACzC,OAAO;IAId,IAAW,aAAa,IAAI,MAAM,CAEjC;IAEY,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAOlE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAO9C,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAOzE,wBAAwB,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAuB1F,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAO9D,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO5E,OAAO,CAAC,oBAAoB;YAQd,YAAY;CAU7B"}
@@ -33,9 +33,6 @@ class RetriableDocumentStorageService {
33
33
  async getVersions(versionId, count) {
34
34
  return this.runWithRetry(async () => this.internalStorageService.getVersions(versionId, count), "storage_getVersions");
35
35
  }
36
- async write(tree, parents, message, ref) {
37
- return this.runWithRetry(async () => this.internalStorageService.write(tree, parents, message, ref), "storage_write");
38
- }
39
36
  async uploadSummaryWithContext(summary, context) {
40
37
  // Not using retry loop here. Couple reasons:
41
38
  // 1. If client lost connectivity, then retry loop will result in uploading stale summary
@@ -1 +1 @@
1
- {"version":3,"file":"retriableDocumentStorageService.js","sourceRoot":"","sources":["../src/retriableDocumentStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AACtD,qEAA+D;AAe/D,+DAA4D;AAE5D,MAAa,+BAA+B;IAExC,YACqB,sBAA+C,EAC/C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AAO,SAAS,CAAC;IACrB,CAAC;IAEO,KAAK,CAAC,YAAY,CAAI,GAAqB,EAAE,QAAgB;QACjE,OAAO,IAAA,2BAAY,EACf,GAAG,EACH,QAAQ,EACR,IAAI,CAAC,MAAM,EACX;YACI,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE;SAC7C,CACJ,CAAC;IACN,CAAC;CACJ;AAvGD,0EAuGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { GenericError } from \"@fluidframework/container-utils\";\nimport {\n IDocumentStorageService,\n IDocumentStorageServicePolicies,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n ICreateBlobResponse,\n ISnapshotTree,\n ISummaryHandle,\n ISummaryTree,\n ITree,\n IVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { IDisposable, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { runWithRetry } from \"@fluidframework/driver-utils\";\n\nexport class RetriableDocumentStorageService implements IDocumentStorageService, IDisposable {\n private _disposed = false;\n constructor(\n private readonly internalStorageService: IDocumentStorageService,\n private readonly logger: ITelemetryLogger,\n ) {\n }\n\n public get policies(): IDocumentStorageServicePolicies | undefined {\n return this.internalStorageService.policies;\n }\n public get disposed() { return this._disposed; }\n public dispose() {\n this._disposed = true;\n }\n\n public get repositoryUrl(): string {\n return this.internalStorageService.repositoryUrl;\n }\n\n public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n return this.runWithRetry(\n async () => this.internalStorageService.getSnapshotTree(version),\n \"storage_getSnapshotTree\",\n );\n }\n\n public async readBlob(id: string): Promise<ArrayBufferLike> {\n return this.runWithRetry(\n async () => this.internalStorageService.readBlob(id),\n \"storage_readBlob\",\n );\n }\n\n public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n return this.runWithRetry(\n async () => this.internalStorageService.getVersions(versionId, count),\n \"storage_getVersions\",\n );\n }\n\n public async write(tree: ITree, parents: string[], message: string, ref: string): Promise<IVersion> {\n return this.runWithRetry(\n async () => this.internalStorageService.write(tree, parents, message, ref),\n \"storage_write\",\n );\n }\n\n public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n // Not using retry loop here. Couple reasons:\n // 1. If client lost connectivity, then retry loop will result in uploading stale summary\n // by stale summarizer after connectivity comes back. It will cause failures for this client and for\n // real (new) summarizer. This problem in particular should be solved in future by supplying abort handle\n // on all APIs and caller (ContainerRuntime.submitSummary) aborting call on loss of connectivity\n // 2. Similar, if we get 429 with retryAfter = 10 minutes, it's likely not the right call to retry summary\n // upload in 10 minutes - it's better to keep processing ops and retry later. Though caller needs to take\n // retryAfter into account!\n // But retry loop is required for creation flow (Container.attach)\n assert((context.referenceSequenceNumber === 0) === (context.ackHandle === undefined),\n 0x251 /* \"creation summary has to have seq=0 && handle === undefined\" */);\n if (context.referenceSequenceNumber !== 0) {\n return this.internalStorageService.uploadSummaryWithContext(summary, context);\n }\n\n // Creation flow with attachment blobs - need to do retries!\n return this.runWithRetry(\n async () => this.internalStorageService.uploadSummaryWithContext(summary, context),\n \"storage_uploadSummaryWithContext\",\n );\n }\n\n public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n return this.runWithRetry(\n async () => this.internalStorageService.downloadSummary(handle),\n \"storage_downloadSummary\",\n );\n }\n\n public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n return this.runWithRetry(\n async () => this.internalStorageService.createBlob(file),\n \"storage_createBlob\",\n );\n }\n\n private checkStorageDisposed() {\n if (this._disposed) {\n // pre-0.58 error message: storageServiceDisposedCannotRetry\n throw new GenericError(\"Storage Service is disposed. Cannot retry\", { canRetry: false });\n }\n return undefined;\n }\n\n private async runWithRetry<T>(api: () => Promise<T>, callName: string): Promise<T> {\n return runWithRetry(\n api,\n callName,\n this.logger,\n {\n onRetry: () => this.checkStorageDisposed(),\n },\n );\n }\n}\n"]}
1
+ {"version":3,"file":"retriableDocumentStorageService.js","sourceRoot":"","sources":["../src/retriableDocumentStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AACtD,qEAA+D;AAc/D,+DAA4D;AAE5D,MAAa,+BAA+B;IAExC,YACqB,sBAA+C,EAC/C,MAAwB;QADxB,2BAAsB,GAAtB,sBAAsB,CAAyB;QAC/C,WAAM,GAAN,MAAM,CAAkB;QAHrC,cAAS,GAAG,KAAK,CAAC;IAK1B,CAAC;IAED,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAChD,CAAC;IACD,IAAW,QAAQ,KAAK,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACzC,OAAO;QACV,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC;IACrD,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,OAAkB;QAC3C,OAAO,IAAI,CAAC,YAAY,CACpB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,OAAO,CAAC,EAChE,yBAAyB,CAC5B,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,EAAU;QAC5B,OAAO,IAAI,CAAC,YAAY,CACpB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,EAAE,CAAC,EACpD,kBAAkB,CACrB,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,SAAwB,EAAE,KAAa;QAC5D,OAAO,IAAI,CAAC,YAAY,CACpB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,EACrE,qBAAqB,CACxB,CAAC;IACN,CAAC;IAEM,KAA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AAK,CAAC,YAAY,CAAI,GAAqB,EAAE,QAAgB;QACjE,OAAO,IAAA,2BAAY,EACf,GAAG,EACH,QAAQ,EACR,IAAI,CAAC,MAAM,EACX;YACI,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE;SAC7C,CACJ,CAAC;IACN,CAAC;CACJ;AAhGD,0EAgGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { GenericError } from \"@fluidframework/container-utils\";\nimport {\n IDocumentStorageService,\n IDocumentStorageServicePolicies,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n ICreateBlobResponse,\n ISnapshotTree,\n ISummaryHandle,\n ISummaryTree,\n IVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { IDisposable, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { runWithRetry } from \"@fluidframework/driver-utils\";\n\nexport class RetriableDocumentStorageService implements IDocumentStorageService, IDisposable {\n private _disposed = false;\n constructor(\n private readonly internalStorageService: IDocumentStorageService,\n private readonly logger: ITelemetryLogger,\n ) {\n }\n\n public get policies(): IDocumentStorageServicePolicies | undefined {\n return this.internalStorageService.policies;\n }\n public get disposed() { return this._disposed; }\n public dispose() {\n this._disposed = true;\n }\n\n public get repositoryUrl(): string {\n return this.internalStorageService.repositoryUrl;\n }\n\n public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n return this.runWithRetry(\n async () => this.internalStorageService.getSnapshotTree(version),\n \"storage_getSnapshotTree\",\n );\n }\n\n public async readBlob(id: string): Promise<ArrayBufferLike> {\n return this.runWithRetry(\n async () => this.internalStorageService.readBlob(id),\n \"storage_readBlob\",\n );\n }\n\n public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n return this.runWithRetry(\n async () => this.internalStorageService.getVersions(versionId, count),\n \"storage_getVersions\",\n );\n }\n\n public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n // Not using retry loop here. Couple reasons:\n // 1. If client lost connectivity, then retry loop will result in uploading stale summary\n // by stale summarizer after connectivity comes back. It will cause failures for this client and for\n // real (new) summarizer. This problem in particular should be solved in future by supplying abort handle\n // on all APIs and caller (ContainerRuntime.submitSummary) aborting call on loss of connectivity\n // 2. Similar, if we get 429 with retryAfter = 10 minutes, it's likely not the right call to retry summary\n // upload in 10 minutes - it's better to keep processing ops and retry later. Though caller needs to take\n // retryAfter into account!\n // But retry loop is required for creation flow (Container.attach)\n assert((context.referenceSequenceNumber === 0) === (context.ackHandle === undefined),\n 0x251 /* \"creation summary has to have seq=0 && handle === undefined\" */);\n if (context.referenceSequenceNumber !== 0) {\n return this.internalStorageService.uploadSummaryWithContext(summary, context);\n }\n\n // Creation flow with attachment blobs - need to do retries!\n return this.runWithRetry(\n async () => this.internalStorageService.uploadSummaryWithContext(summary, context),\n \"storage_uploadSummaryWithContext\",\n );\n }\n\n public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n return this.runWithRetry(\n async () => this.internalStorageService.downloadSummary(handle),\n \"storage_downloadSummary\",\n );\n }\n\n public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n return this.runWithRetry(\n async () => this.internalStorageService.createBlob(file),\n \"storage_createBlob\",\n );\n }\n\n private checkStorageDisposed() {\n if (this._disposed) {\n // pre-0.58 error message: storageServiceDisposedCannotRetry\n throw new GenericError(\"Storage Service is disposed. Cannot retry\", { canRetry: false });\n }\n return undefined;\n }\n\n private async runWithRetry<T>(api: () => Promise<T>, callName: string): Promise<T> {\n return runWithRetry(\n api,\n callName,\n this.logger,\n {\n onRetry: () => this.checkStorageDisposed(),\n },\n );\n }\n}\n"]}
@@ -4,15 +4,27 @@
4
4
  */
5
5
  export declare enum ConnectionState {
6
6
  /**
7
- * The document is no longer connected to the delta server
7
+ * The container is not connected to the ordering service
8
+ * Note - When in this state the container may be about to reconnect,
9
+ * or may remain disconnected until explicitly told to connect.
8
10
  */
9
11
  Disconnected = 0,
10
12
  /**
11
- * The document has an inbound connection but is still pending for outbound deltas
13
+ * The container is disconnected but actively trying to establish a new connection
14
+ * PLEASE NOTE that this numerical value falls out of the order you may expect for this state
15
+ */
16
+ EstablishingConnection = 3,
17
+ /**
18
+ * @see ConnectionState.CatchingUp, which is the new name for this state.
19
+ * @deprecated - This state itself is not gone, just being renamed. Please use ConnectionState.CatchingUp.
12
20
  */
13
21
  Connecting = 1,
14
22
  /**
15
- * The document is fully connected
23
+ * The container has an inbound connection only, and is catching up to the latest known state from the service.
24
+ */
25
+ CatchingUp = 1,
26
+ /**
27
+ * The container is fully connected and syncing
16
28
  */
17
29
  Connected = 2
18
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"connectionState.d.ts","sourceRoot":"","sources":["../src/connectionState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAY,eAAe;IACvB;;OAEG;IACH,YAAY,IAAA;IAEZ;;OAEG;IACH,UAAU,IAAA;IAEV;;OAEG;IACH,SAAS,IAAA;CACZ"}
1
+ {"version":3,"file":"connectionState.d.ts","sourceRoot":"","sources":["../src/connectionState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAY,eAAe;IACvB;;;;OAIG;IACH,YAAY,IAAI;IAEhB;;;OAGG;IACH,sBAAsB,IAAI;IAE1B;;;OAGG;IACH,UAAU,IAAI;IAEd;;OAEG;IACH,UAAU,IAAI;IAEd;;OAEG;IACH,SAAS,IAAI;CAChB"}
@@ -5,15 +5,27 @@
5
5
  export var ConnectionState;
6
6
  (function (ConnectionState) {
7
7
  /**
8
- * The document is no longer connected to the delta server
8
+ * The container is not connected to the ordering service
9
+ * Note - When in this state the container may be about to reconnect,
10
+ * or may remain disconnected until explicitly told to connect.
9
11
  */
10
12
  ConnectionState[ConnectionState["Disconnected"] = 0] = "Disconnected";
11
13
  /**
12
- * The document has an inbound connection but is still pending for outbound deltas
14
+ * The container is disconnected but actively trying to establish a new connection
15
+ * PLEASE NOTE that this numerical value falls out of the order you may expect for this state
16
+ */
17
+ ConnectionState[ConnectionState["EstablishingConnection"] = 3] = "EstablishingConnection";
18
+ /**
19
+ * @see ConnectionState.CatchingUp, which is the new name for this state.
20
+ * @deprecated - This state itself is not gone, just being renamed. Please use ConnectionState.CatchingUp.
13
21
  */
14
22
  ConnectionState[ConnectionState["Connecting"] = 1] = "Connecting";
15
23
  /**
16
- * The document is fully connected
24
+ * The container has an inbound connection only, and is catching up to the latest known state from the service.
25
+ */
26
+ ConnectionState[ConnectionState["CatchingUp"] = 1] = "CatchingUp";
27
+ /**
28
+ * The container is fully connected and syncing
17
29
  */
18
30
  ConnectionState[ConnectionState["Connected"] = 2] = "Connected";
19
31
  })(ConnectionState || (ConnectionState = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"connectionState.js","sourceRoot":"","sources":["../src/connectionState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAN,IAAY,eAeX;AAfD,WAAY,eAAe;IACvB;;OAEG;IACH,qEAAY,CAAA;IAEZ;;OAEG;IACH,iEAAU,CAAA;IAEV;;OAEG;IACH,+DAAS,CAAA;AACb,CAAC,EAfW,eAAe,KAAf,eAAe,QAe1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport enum ConnectionState {\n /**\n * The document is no longer connected to the delta server\n */\n Disconnected,\n\n /**\n * The document has an inbound connection but is still pending for outbound deltas\n */\n Connecting,\n\n /**\n * The document is fully connected\n */\n Connected,\n}\n"]}
1
+ {"version":3,"file":"connectionState.js","sourceRoot":"","sources":["../src/connectionState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAN,IAAY,eA6BX;AA7BD,WAAY,eAAe;IACvB;;;;OAIG;IACH,qEAAgB,CAAA;IAEhB;;;OAGG;IACH,yFAA0B,CAAA;IAE1B;;;OAGG;IACH,iEAAc,CAAA;IAEd;;OAEG;IACH,iEAAc,CAAA;IAEd;;OAEG;IACH,+DAAa,CAAA;AACjB,CAAC,EA7BW,eAAe,KAAf,eAAe,QA6B1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport enum ConnectionState {\n /**\n * The container is not connected to the ordering service\n * Note - When in this state the container may be about to reconnect,\n * or may remain disconnected until explicitly told to connect.\n */\n Disconnected = 0,\n\n /**\n * The container is disconnected but actively trying to establish a new connection\n * PLEASE NOTE that this numerical value falls out of the order you may expect for this state\n */\n EstablishingConnection = 3,\n\n /**\n * @see ConnectionState.CatchingUp, which is the new name for this state.\n * @deprecated - This state itself is not gone, just being renamed. Please use ConnectionState.CatchingUp.\n */\n Connecting = 1,\n\n /**\n * The container has an inbound connection only, and is catching up to the latest known state from the service.\n */\n CatchingUp = 1,\n\n /**\n * The container is fully connected and syncing\n */\n Connected = 2,\n}\n"]}
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { ITelemetryLogger } from "@fluidframework/common-definitions";
6
6
  import { IConnectionDetails } from "@fluidframework/container-definitions";
7
+ import { ProtocolOpHandler } from "@fluidframework/protocol-base";
7
8
  import { ConnectionMode, IQuorumClients, ISequencedClient } from "@fluidframework/protocol-definitions";
8
9
  import { ConnectionState } from "./connectionState";
9
10
  export interface IConnectionStateHandler {
@@ -20,9 +21,9 @@ export interface ILocalSequencedClient extends ISequencedClient {
20
21
  export declare class ConnectionStateHandler {
21
22
  private readonly handler;
22
23
  private readonly logger;
24
+ private _clientId?;
23
25
  private _connectionState;
24
26
  private _pendingClientId;
25
- private _clientId;
26
27
  private readonly prevClientLeftTimer;
27
28
  private readonly joinOpTimer;
28
29
  private waitEvent;
@@ -30,16 +31,17 @@ export declare class ConnectionStateHandler {
30
31
  get connected(): boolean;
31
32
  get clientId(): string | undefined;
32
33
  get pendingClientId(): string | undefined;
33
- constructor(handler: IConnectionStateHandler, logger: ITelemetryLogger);
34
+ constructor(handler: IConnectionStateHandler, logger: ITelemetryLogger, _clientId?: string | undefined);
34
35
  private startJoinOpTimer;
35
36
  private stopJoinOpTimer;
36
37
  dispose(): void;
37
38
  containerSaved(): void;
38
- receivedAddMemberEvent(clientId: string): void;
39
+ private receivedAddMemberEvent;
39
40
  private applyForConnectedState;
40
- receivedRemoveMemberEvent(clientId: string): void;
41
+ private receivedRemoveMemberEvent;
41
42
  receivedDisconnectEvent(reason: string): void;
42
43
  receivedConnectEvent(connectionMode: ConnectionMode, details: IConnectionDetails): void;
43
44
  private setConnectionState;
45
+ initProtocol(protocol: ProtocolOpHandler): void;
44
46
  }
45
47
  //# sourceMappingURL=connectionStateHandler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connectionStateHandler.d.ts","sourceRoot":"","sources":["../src/connectionStateHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxG,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,uBAAuB;IACpC,aAAa,EAAE,MAAM,cAAc,GAAG,SAAS,CAAC;IAChD,iCAAiC,EAAE,CAC/B,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,eAAe,EACzB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,KAC1B,IAAI,CAAC;IACV,qBAAqB,EAAE,MAAM,OAAO,CAAC;IACrC,sBAAsB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,kBAAkB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,sBAAsB,EAAE,MAAM,IAAI,CAAC;CACtC;AAED,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC3D,cAAc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BAAsB;IAsB9B,OAAO,CAAC,sBAAsB;IAiC9B,OAAO,CAAC,yBAAyB;IAQ1B,uBAAuB,CAAC,MAAM,EAAE,MAAM;IAOtC,oBAAoB,CACvB,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,kBAAkB;IAgC/B,OAAO,CAAC,kBAAkB;IAwDnB,YAAY,CAAC,QAAQ,EAAE,iBAAiB;CAclD"}
@@ -2,15 +2,16 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { PerformanceEvent } from "@fluidframework/telemetry-utils";
6
5
  import { assert, Timer } from "@fluidframework/common-utils";
6
+ import { PerformanceEvent } from "@fluidframework/telemetry-utils";
7
7
  import { ConnectionState } from "./connectionState";
8
8
  const JoinOpTimer = 45000;
9
9
  export class ConnectionStateHandler {
10
- constructor(handler, logger) {
10
+ constructor(handler, logger, _clientId) {
11
11
  var _a;
12
12
  this.handler = handler;
13
13
  this.logger = logger;
14
+ this._clientId = _clientId;
14
15
  this._connectionState = ConnectionState.Disconnected;
15
16
  this.prevClientLeftTimer = new Timer(
16
17
  // Default is 5 min for which we are going to wait for its own "leave" message. This is same as
@@ -25,7 +26,7 @@ export class ConnectionStateHandler {
25
26
  this.joinOpTimer = new Timer(JoinOpTimer, () => {
26
27
  // I've observed timer firing within couple ms from disconnect event, looks like
27
28
  // queued timer callback is not cancelled if timer is cancelled while callback sits in the queue.
28
- if (this.connectionState === ConnectionState.Connecting) {
29
+ if (this.connectionState === ConnectionState.CatchingUp) {
29
30
  this.handler.logConnectionIssue("NoJoinOp");
30
31
  }
31
32
  });
@@ -88,6 +89,8 @@ export class ConnectionStateHandler {
88
89
  var _a;
89
90
  const quorumClients = this.handler.quorumClients();
90
91
  assert(quorumClients !== undefined, 0x236 /* "In all cases it should be already installed" */);
92
+ assert(this.prevClientLeftTimer.hasTimer === false ||
93
+ (this.clientId !== undefined && quorumClients.getMember(this.clientId) !== undefined), 0x2e2 /* "Must only wait for leave message when clientId in quorum" */);
91
94
  // Move to connected state only if we are in Connecting state, we have seen our join op
92
95
  // and there is no timer running which means we are not waiting for previous client to leave
93
96
  // or timeout has occured while doing so.
@@ -127,7 +130,7 @@ export class ConnectionStateHandler {
127
130
  }
128
131
  receivedConnectEvent(connectionMode, details) {
129
132
  const oldState = this._connectionState;
130
- this._connectionState = ConnectionState.Connecting;
133
+ this._connectionState = ConnectionState.CatchingUp;
131
134
  // Stash the clientID to detect when transitioning from connecting (socket.io channel open) to connected
132
135
  // (have received the join message for the client ID)
133
136
  // This is especially important in the reconnect case. It's possible there could be outstanding
@@ -136,7 +139,7 @@ export class ConnectionStateHandler {
136
139
  // we know there can no longer be outstanding ops that we sent with the previous client id.
137
140
  this._pendingClientId = details.clientId;
138
141
  // Report telemetry after we set client id, but before transitioning to Connected state below!
139
- this.handler.logConnectionStateChangeTelemetry(ConnectionState.Connecting, oldState);
142
+ this.handler.logConnectionStateChangeTelemetry(ConnectionState.CatchingUp, oldState);
140
143
  const quorumClients = this.handler.quorumClients();
141
144
  // Check if we already processed our own join op through delta storage!
142
145
  // we are fetching ops from storage in parallel to connecting to ordering service
@@ -166,7 +169,7 @@ export class ConnectionStateHandler {
166
169
  client = quorumClients === null || quorumClients === void 0 ? void 0 : quorumClients.getMember(this._clientId);
167
170
  }
168
171
  if (value === ConnectionState.Connected) {
169
- assert(oldState === ConnectionState.Connecting, 0x1d8 /* "Should only transition from Connecting state" */);
172
+ assert(oldState === ConnectionState.CatchingUp, 0x1d8 /* "Should only transition from Connecting state" */);
170
173
  // Mark our old client should have left in the quorum if it's still there
171
174
  if (client !== undefined) {
172
175
  client.shouldHaveLeft = true;
@@ -202,5 +205,17 @@ export class ConnectionStateHandler {
202
205
  // Propagate event across layers
203
206
  this.handler.connectionStateChanged();
204
207
  }
208
+ initProtocol(protocol) {
209
+ protocol.quorum.on("addMember", (clientId, details) => {
210
+ this.receivedAddMemberEvent(clientId);
211
+ });
212
+ protocol.quorum.on("removeMember", (clientId) => {
213
+ this.receivedRemoveMemberEvent(clientId);
214
+ });
215
+ // if we have a clientId from a previous container we need to wait for its leave message
216
+ if (this.clientId !== undefined && protocol.quorum.getMember(this.clientId) !== undefined) {
217
+ this.prevClientLeftTimer.restart();
218
+ }
219
+ }
205
220
  }
206
221
  //# sourceMappingURL=connectionStateHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"connectionStateHandler.js","sourceRoot":"","sources":["../src/connectionStateHandler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAmBpD,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B,MAAM,OAAO,sBAAsB;IAyB/B,YACqB,OAAgC,EAChC,MAAwB;;QADxB,YAAO,GAAP,OAAO,CAAyB;QAChC,WAAM,GAAN,MAAM,CAAkB;QA1BrC,qBAAgB,GAAG,eAAe,CAAC,YAAY,CAAC;QA4BpD,IAAI,CAAC,mBAAmB,GAAG,IAAI,KAAK;QAChC,+FAA+F;QAC/F,uDAAuD;QACvD,MAAA,IAAI,CAAC,OAAO,CAAC,sBAAsB,mCAAI,MAAM,EAC7C,GAAG,EAAE;YACD,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,EAClB,KAAK,CAAC,6EAA6E,CAAC,CAAC;YACzF,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;QAC3C,CAAC,CACJ,CAAC;QAEF,qGAAqG;QACrG,kGAAkG;QAClG,iEAAiE;QACjE,IAAI,CAAC,WAAW,GAAG,IAAI,KAAK,CACxB,WAAW,EACX,GAAG,EAAE;YACD,gFAAgF;YAChF,iGAAiG;YACjG,IAAI,IAAI,CAAC,eAAe,KAAK,eAAe,CAAC,UAAU,EAAE;gBACrD,IAAI,C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AAM,KAAK,SAAS,EAAE;gBACtB,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;aAChC;YACD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC;SACzC;aAAM,IAAI,KAAK,KAAK,eAAe,CAAC,YAAY,EAAE;YAC/C,4EAA4E;YAC5E,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;YAClC,oGAAoG;YACpG,sGAAsG;YACtG,mCAAmC;YACnC,uGAAuG;YACvG,qGAAqG;YACrG,sGAAsG;YACtG,IAAI,MAAM,KAAK,SAAS;mBACjB,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE;mBACpC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,KAAK,KAAK,EAChD;gBACE,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC;aACtC;iBAAM;gBACH,2FAA2F;gBAC3F,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;oBAC3B,SAAS,EAAE,sBAAsB;oBACjC,QAAQ,EAAE,MAAM,KAAK,SAAS;oBAC9B,QAAQ,EAAE,IAAI,CAAC,mBAAmB,CAAC,QAAQ;oBAC3C,qBAAqB,EAAE,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE;iBAC9D,CAAC,CAAC;aACN;SACJ;QAED,4DAA4D;QAC5D,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,IAAI,CAAC,gBAAgB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAExF,gCAAgC;QAChC,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC;IAC1C,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { IConnectionDetails } from \"@fluidframework/container-definitions\";\nimport { ConnectionMode, IQuorumClients, ISequencedClient } from \"@fluidframework/protocol-definitions\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { assert, Timer } from \"@fluidframework/common-utils\";\nimport { ConnectionState } from \"./connectionState\";\n\nexport interface IConnectionStateHandler {\n quorumClients: () => IQuorumClients | undefined;\n logConnectionStateChangeTelemetry: (\n value: ConnectionState,\n oldState: ConnectionState,\n reason?: string | undefined\n ) => void;\n shouldClientJoinWrite: () => boolean;\n maxClientLeaveWaitTime: number | undefined;\n logConnectionIssue: (eventName: string) => void;\n connectionStateChanged: () => void;\n}\n\nexport interface ILocalSequencedClient extends ISequencedClient {\n shouldHaveLeft?: boolean;\n}\n\nconst JoinOpTimer = 45000;\n\nexport class ConnectionStateHandler {\n private _connectionState = ConnectionState.Disconnected;\n private _pendingClientId: string | undefined;\n private _clientId: string | undefined;\n private readonly prevClientLeftTimer: Timer;\n private readonly joinOpTimer: Timer;\n\n private waitEvent: PerformanceEvent | undefined;\n\n public get connectionState(): ConnectionState {\n return this._connectionState;\n }\n\n public get connected(): boolean {\n return this.connectionState === ConnectionState.Connected;\n }\n\n public get clientId(): string | undefined {\n return this._clientId;\n }\n\n public get pendingClientId(): string | undefined {\n return this._pendingClientId;\n }\n\n constructor(\n private readonly handler: IConnectionStateHandler,\n private readonly logger: ITelemetryLogger,\n ) {\n this.prevClientLeftTimer = new Timer(\n // Default is 5 min for which we are going to wait for its own \"leave\" message. This is same as\n // the max time on server after which leave op is sent.\n this.handler.maxClientLeaveWaitTime ?? 300000,\n () => {\n assert(!this.connected,\n 0x2ac /* \"Connected when timeout waiting for leave from previous session fired!\" */);\n this.applyForConnectedState(\"timeout\");\n },\n );\n\n // Based on recent data, it looks like majority of cases where we get stuck are due to really slow or\n // timing out ops fetches. So attempt recovery infrequently. Also fetch uses 30 second timeout, so\n // if retrying fixes the problem, we should not see these events.\n this.joinOpTimer = new Timer(\n JoinOpTimer,\n () => {\n // I've observed timer firing within couple ms from disconnect event, looks like\n // queued timer callback is not cancelled if timer is cancelled while callback sits in the queue.\n if (this.connectionState === ConnectionState.Connecting) {\n this.handler.logConnectionIssue(\"NoJoinOp\");\n }\n },\n );\n }\n\n private startJoinOpTimer() {\n assert(!this.joinOpTimer.hasTimer, 0x234 /* \"has joinOpTimer\" */);\n this.joinOpTimer.start();\n }\n\n private stopJoinOpTimer() {\n assert(this.joinOpTimer.hasTimer, 0x235 /* \"no joinOpTimer\" */);\n this.joinOpTimer.clear();\n }\n\n public dispose() {\n assert(!this.joinOpTimer.hasTimer, 0x2a5 /* \"join timer\" */);\n this.prevClientLeftTimer.clear();\n }\n\n public containerSaved() {\n // If we were waiting for moving to Connected state, then only apply for state change. Since the container\n // is now saved and we don't have any ops to roundtrip, we can clear the timer and apply for connected state.\n if (this.prevClientLeftTimer.hasTimer) {\n this.prevClientLeftTimer.clear();\n this.applyForConnectedState(\"containerSaved\");\n }\n }\n\n public receivedAddMemberEvent(clientId: string) {\n // This is the only one that requires the pending client ID\n if (clientId === this.pendingClientId) {\n if (this.joinOpTimer.hasTimer) {\n this.stopJoinOpTimer();\n } else {\n // timer has already fired, meaning it took too long to get join on.\n // Record how long it actually took to recover.\n this.handler.logConnectionIssue(\"ReceivedJoinOp\");\n }\n // Start the event in case we are waiting for leave or timeout.\n if (this.prevClientLeftTimer.hasTimer) {\n this.waitEvent = PerformanceEvent.start(this.logger, {\n eventName: \"WaitBeforeClientLeave\",\n waitOnClientId: this._clientId,\n hadOutstandingOps: this.handler.shouldClientJoinWrite(),\n });\n }\n this.applyForConnectedState(\"addMemberEvent\");\n }\n }\n\n private applyForConnectedState(source: \"removeMemberEvent\" | \"addMemberEvent\" | \"timeout\" | \"containerSaved\") {\n const quorumClients = this.handler.quorumClients();\n assert(quorumClients !== undefined, 0x236 /* \"In all cases it should be already installed\" */);\n // Move to connected state only if we are in Connecting state, we have seen our join op\n // and there is no timer running which means we are not waiting for previous client to leave\n // or timeout has occured while doing so.\n if (this.pendingClientId !== this.clientId\n && this.pendingClientId !== undefined\n && quorumClients.getMember(this.pendingClientId) !== undefined\n && !this.prevClientLeftTimer.hasTimer\n ) {\n this.waitEvent?.end({ source });\n this.setConnectionState(ConnectionState.Connected);\n } else {\n // Adding this event temporarily so that we can get help debugging if something goes wrong.\n this.logger.sendTelemetryEvent({\n eventName: \"connectedStateRejected\",\n category: source === \"timeout\" ? \"error\" : \"generic\",\n source,\n pendingClientId: this.pendingClientId,\n clientId: this.clientId,\n hasTimer: this.prevClientLeftTimer.hasTimer,\n inQuorum: quorumClients !== undefined && this.pendingClientId !== undefined\n && quorumClients.getMember(this.pendingClientId) !== undefined,\n });\n }\n }\n\n public receivedRemoveMemberEvent(clientId: string) {\n // If the client which has left was us, then finish the timer.\n if (this.clientId === clientId) {\n this.prevClientLeftTimer.clear();\n this.applyForConnectedState(\"removeMemberEvent\");\n }\n }\n\n public receivedDisconnectEvent(reason: string) {\n if (this.joinOpTimer.hasTimer) {\n this.stopJoinOpTimer();\n }\n this.setConnectionState(ConnectionState.Disconnected, reason);\n }\n\n public receivedConnectEvent(\n connectionMode: ConnectionMode,\n details: IConnectionDetails,\n ) {\n const oldState = this._connectionState;\n this._connectionState = ConnectionState.Connecting;\n\n // Stash the clientID to detect when transitioning from connecting (socket.io channel open) to connected\n // (have received the join message for the client ID)\n // This is especially important in the reconnect case. It's possible there could be outstanding\n // ops sent by this client, so we should keep the old client id until we see our own client's\n // join message. after we see the join message for out new connection with our new client id,\n // we know there can no longer be outstanding ops that we sent with the previous client id.\n this._pendingClientId = details.clientId;\n\n // Report telemetry after we set client id, but before transitioning to Connected state below!\n this.handler.logConnectionStateChangeTelemetry(ConnectionState.Connecting, oldState);\n\n const quorumClients = this.handler.quorumClients();\n // Check if we already processed our own join op through delta storage!\n // we are fetching ops from storage in parallel to connecting to ordering service\n // Given async processes, it's possible that we have already processed our own join message before\n // connection was fully established.\n // Note that we might be still initializing quorum - connection is established proactively on load!\n if (quorumClients?.getMember(details.clientId) !== undefined\n || connectionMode === \"read\"\n ) {\n assert(!this.prevClientLeftTimer.hasTimer, 0x2a6 /* \"there should be no timer for 'read' connections\" */);\n this.setConnectionState(ConnectionState.Connected);\n } else if (connectionMode === \"write\") {\n this.startJoinOpTimer();\n }\n }\n\n private setConnectionState(value: ConnectionState.Disconnected, reason: string);\n private setConnectionState(value: ConnectionState.Connected);\n private setConnectionState(value: ConnectionState, reason?: string) {\n if (this.connectionState === value) {\n // Already in the desired state - exit early\n this.logger.sendErrorEvent({ eventName: \"setConnectionStateSame\", value });\n return;\n }\n\n const oldState = this._connectionState;\n this._connectionState = value;\n const quorumClients = this.handler.quorumClients();\n let client: ILocalSequencedClient | undefined;\n if (this._clientId !== undefined) {\n client = quorumClients?.getMember(this._clientId);\n }\n if (value === ConnectionState.Connected) {\n assert(oldState === ConnectionState.Connecting,\n 0x1d8 /* \"Should only transition from Connecting state\" */);\n // Mark our old client should have left in the quorum if it's still there\n if (client !== undefined) {\n client.shouldHaveLeft = true;\n }\n this._clientId = this.pendingClientId;\n } else if (value === ConnectionState.Disconnected) {\n // Important as we process our own joinSession message through delta request\n this._pendingClientId = undefined;\n // Only wait for \"leave\" message if the connected client exists in the quorum because only the write\n // client will exist in the quorum and only for those clients we will receive \"removeMember\" event and\n // the client has some unacked ops.\n // Also server would not accept ops from read client. Also check if the timer is not already running as\n // we could receive \"Disconnected\" event multiple times without getting connected and in that case we\n // don't want to reset the timer as we still want to wait on original client which started this timer.\n if (client !== undefined\n && this.handler.shouldClientJoinWrite()\n && this.prevClientLeftTimer.hasTimer === false\n ) {\n this.prevClientLeftTimer.restart();\n } else {\n // Adding this event temporarily so that we can get help debugging if something goes wrong.\n this.logger.sendTelemetryEvent({\n eventName: \"noWaitOnDisconnected\",\n inQuorum: client !== undefined,\n hasTimer: this.prevClientLeftTimer.hasTimer,\n shouldClientJoinWrite: this.handler.shouldClientJoinWrite(),\n });\n }\n }\n\n // Report transition before we propagate event across layers\n this.handler.logConnectionStateChangeTelemetry(this._connectionState, oldState, reason);\n\n // Propagate event across layers\n this.handler.connectionStateChanged();\n }\n}\n"]}
1
+ {"version":3,"file":"connectionStateH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AAE,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,EAAE;YAC5C,IAAI,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,wFAAwF;QACxF,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE;YACvF,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC;SACtC;IACL,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, Timer } from \"@fluidframework/common-utils\";\nimport { IConnectionDetails } from \"@fluidframework/container-definitions\";\nimport { ProtocolOpHandler } from \"@fluidframework/protocol-base\";\nimport { ConnectionMode, IQuorumClients, ISequencedClient } from \"@fluidframework/protocol-definitions\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { ConnectionState } from \"./connectionState\";\n\nexport interface IConnectionStateHandler {\n quorumClients: () => IQuorumClients | undefined;\n logConnectionStateChangeTelemetry: (\n value: ConnectionState,\n oldState: ConnectionState,\n reason?: string | undefined\n ) => void;\n shouldClientJoinWrite: () => boolean;\n maxClientLeaveWaitTime: number | undefined;\n logConnectionIssue: (eventName: string) => void;\n connectionStateChanged: () => void;\n}\n\nexport interface ILocalSequencedClient extends ISequencedClient {\n shouldHaveLeft?: boolean;\n}\n\nconst JoinOpTimer = 45000;\n\nexport class ConnectionStateHandler {\n private _connectionState = ConnectionState.Disconnected;\n private _pendingClientId: string | undefined;\n private readonly prevClientLeftTimer: Timer;\n private readonly joinOpTimer: Timer;\n\n private waitEvent: PerformanceEvent | undefined;\n\n public get connectionState(): ConnectionState {\n return this._connectionState;\n }\n\n public get connected(): boolean {\n return this.connectionState === ConnectionState.Connected;\n }\n\n public get clientId(): string | undefined {\n return this._clientId;\n }\n\n public get pendingClientId(): string | undefined {\n return this._pendingClientId;\n }\n\n constructor(\n private readonly handler: IConnectionStateHandler,\n private readonly logger: ITelemetryLogger,\n private _clientId?: string,\n ) {\n this.prevClientLeftTimer = new Timer(\n // Default is 5 min for which we are going to wait for its own \"leave\" message. This is same as\n // the max time on server after which leave op is sent.\n this.handler.maxClientLeaveWaitTime ?? 300000,\n () => {\n assert(!this.connected,\n 0x2ac /* \"Connected when timeout waiting for leave from previous session fired!\" */);\n this.applyForConnectedState(\"timeout\");\n },\n );\n\n // Based on recent data, it looks like majority of cases where we get stuck are due to really slow or\n // timing out ops fetches. So attempt recovery infrequently. Also fetch uses 30 second timeout, so\n // if retrying fixes the problem, we should not see these events.\n this.joinOpTimer = new Timer(\n JoinOpTimer,\n () => {\n // I've observed timer firing within couple ms from disconnect event, looks like\n // queued timer callback is not cancelled if timer is cancelled while callback sits in the queue.\n if (this.connectionState === ConnectionState.CatchingUp) {\n this.handler.logConnectionIssue(\"NoJoinOp\");\n }\n },\n );\n }\n\n private startJoinOpTimer() {\n assert(!this.joinOpTimer.hasTimer, 0x234 /* \"has joinOpTimer\" */);\n this.joinOpTimer.start();\n }\n\n private stopJoinOpTimer() {\n assert(this.joinOpTimer.hasTimer, 0x235 /* \"no joinOpTimer\" */);\n this.joinOpTimer.clear();\n }\n\n public dispose() {\n assert(!this.joinOpTimer.hasTimer, 0x2a5 /* \"join timer\" */);\n this.prevClientLeftTimer.clear();\n }\n\n public containerSaved() {\n // If we were waiting for moving to Connected state, then only apply for state change. Since the container\n // is now saved and we don't have any ops to roundtrip, we can clear the timer and apply for connected state.\n if (this.prevClientLeftTimer.hasTimer) {\n this.prevClientLeftTimer.clear();\n this.applyForConnectedState(\"containerSaved\");\n }\n }\n\n private receivedAddMemberEvent(clientId: string) {\n // This is the only one that requires the pending client ID\n if (clientId === this.pendingClientId) {\n if (this.joinOpTimer.hasTimer) {\n this.stopJoinOpTimer();\n } else {\n // timer has already fired, meaning it took too long to get join on.\n // Record how long it actually took to recover.\n this.handler.logConnectionIssue(\"ReceivedJoinOp\");\n }\n // Start the event in case we are waiting for leave or timeout.\n if (this.prevClientLeftTimer.hasTimer) {\n this.waitEvent = PerformanceEvent.start(this.logger, {\n eventName: \"WaitBeforeClientLeave\",\n waitOnClientId: this._clientId,\n hadOutstandingOps: this.handler.shouldClientJoinWrite(),\n });\n }\n this.applyForConnectedState(\"addMemberEvent\");\n }\n }\n\n private applyForConnectedState(source: \"removeMemberEvent\" | \"addMemberEvent\" | \"timeout\" | \"containerSaved\") {\n const quorumClients = this.handler.quorumClients();\n assert(quorumClients !== undefined, 0x236 /* \"In all cases it should be already installed\" */);\n\n assert(this.prevClientLeftTimer.hasTimer === false ||\n (this.clientId !== undefined && quorumClients.getMember(this.clientId) !== undefined),\n 0x2e2 /* \"Must only wait for leave message when clientId in quorum\" */);\n\n // Move to connected state only if we are in Connecting state, we have seen our join op\n // and there is no timer running which means we are not waiting for previous client to leave\n // or timeout has occured while doing so.\n if (this.pendingClientId !== this.clientId\n && this.pendingClientId !== undefined\n && quorumClients.getMember(this.pendingClientId) !== undefined\n && !this.prevClientLeftTimer.hasTimer\n ) {\n this.waitEvent?.end({ source });\n this.setConnectionState(ConnectionState.Connected);\n } else {\n // Adding this event temporarily so that we can get help debugging if something goes wrong.\n this.logger.sendTelemetryEvent({\n eventName: \"connectedStateRejected\",\n category: source === \"timeout\" ? \"error\" : \"generic\",\n source,\n pendingClientId: this.pendingClientId,\n clientId: this.clientId,\n hasTimer: this.prevClientLeftTimer.hasTimer,\n inQuorum: quorumClients !== undefined && this.pendingClientId !== undefined\n && quorumClients.getMember(this.pendingClientId) !== undefined,\n });\n }\n }\n\n private receivedRemoveMemberEvent(clientId: string) {\n // If the client which has left was us, then finish the timer.\n if (this.clientId === clientId) {\n this.prevClientLeftTimer.clear();\n this.applyForConnectedState(\"removeMemberEvent\");\n }\n }\n\n public receivedDisconnectEvent(reason: string) {\n if (this.joinOpTimer.hasTimer) {\n this.stopJoinOpTimer();\n }\n this.setConnectionState(ConnectionState.Disconnected, reason);\n }\n\n public receivedConnectEvent(\n connectionMode: ConnectionMode,\n details: IConnectionDetails,\n ) {\n const oldState = this._connectionState;\n this._connectionState = ConnectionState.CatchingUp;\n\n // Stash the clientID to detect when transitioning from connecting (socket.io channel open) to connected\n // (have received the join message for the client ID)\n // This is especially important in the reconnect case. It's possible there could be outstanding\n // ops sent by this client, so we should keep the old client id until we see our own client's\n // join message. after we see the join message for out new connection with our new client id,\n // we know there can no longer be outstanding ops that we sent with the previous client id.\n this._pendingClientId = details.clientId;\n\n // Report telemetry after we set client id, but before transitioning to Connected state below!\n this.handler.logConnectionStateChangeTelemetry(ConnectionState.CatchingUp, oldState);\n\n const quorumClients = this.handler.quorumClients();\n // Check if we already processed our own join op through delta storage!\n // we are fetching ops from storage in parallel to connecting to ordering service\n // Given async processes, it's possible that we have already processed our own join message before\n // connection was fully established.\n // Note that we might be still initializing quorum - connection is established proactively on load!\n if (quorumClients?.getMember(details.clientId) !== undefined\n || connectionMode === \"read\"\n ) {\n assert(!this.prevClientLeftTimer.hasTimer, 0x2a6 /* \"there should be no timer for 'read' connections\" */);\n this.setConnectionState(ConnectionState.Connected);\n } else if (connectionMode === \"write\") {\n this.startJoinOpTimer();\n }\n }\n\n private setConnectionState(value: ConnectionState.Disconnected, reason: string);\n private setConnectionState(value: ConnectionState.Connected);\n private setConnectionState(value: ConnectionState, reason?: string) {\n if (this.connectionState === value) {\n // Already in the desired state - exit early\n this.logger.sendErrorEvent({ eventName: \"setConnectionStateSame\", value });\n return;\n }\n\n const oldState = this._connectionState;\n this._connectionState = value;\n const quorumClients = this.handler.quorumClients();\n let client: ILocalSequencedClient | undefined;\n if (this._clientId !== undefined) {\n client = quorumClients?.getMember(this._clientId);\n }\n if (value === ConnectionState.Connected) {\n assert(oldState === ConnectionState.CatchingUp,\n 0x1d8 /* \"Should only transition from Connecting state\" */);\n // Mark our old client should have left in the quorum if it's still there\n if (client !== undefined) {\n client.shouldHaveLeft = true;\n }\n this._clientId = this.pendingClientId;\n } else if (value === ConnectionState.Disconnected) {\n // Important as we process our own joinSession message through delta request\n this._pendingClientId = undefined;\n // Only wait for \"leave\" message if the connected client exists in the quorum because only the write\n // client will exist in the quorum and only for those clients we will receive \"removeMember\" event and\n // the client has some unacked ops.\n // Also server would not accept ops from read client. Also check if the timer is not already running as\n // we could receive \"Disconnected\" event multiple times without getting connected and in that case we\n // don't want to reset the timer as we still want to wait on original client which started this timer.\n if (client !== undefined\n && this.handler.shouldClientJoinWrite()\n && this.prevClientLeftTimer.hasTimer === false\n ) {\n this.prevClientLeftTimer.restart();\n } else {\n // Adding this event temporarily so that we can get help debugging if something goes wrong.\n this.logger.sendTelemetryEvent({\n eventName: \"noWaitOnDisconnected\",\n inQuorum: client !== undefined,\n hasTimer: this.prevClientLeftTimer.hasTimer,\n shouldClientJoinWrite: this.handler.shouldClientJoinWrite(),\n });\n }\n }\n\n // Report transition before we propagate event across layers\n this.handler.logConnectionStateChangeTelemetry(this._connectionState, oldState, reason);\n\n // Propagate event across layers\n this.handler.connectionStateChanged();\n }\n\n public initProtocol(protocol: ProtocolOpHandler) {\n protocol.quorum.on(\"addMember\", (clientId, details) => {\n this.receivedAddMemberEvent(clientId);\n });\n\n protocol.quorum.on(\"removeMember\", (clientId) => {\n this.receivedRemoveMemberEvent(clientId);\n });\n\n // if we have a clientId from a previous container we need to wait for its leave message\n if (this.clientId !== undefined && protocol.quorum.getMember(this.clientId) !== undefined) {\n this.prevClientLeftTimer.restart();\n }\n }\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  import { IRequest, IResponse, IFluidRouter } from "@fluidframework/core-interfaces";
6
6
  import { IAudience, IContainer, IContainerEvents, IDeltaManager, ICriticalContainerError, AttachState, ReadOnlyInfo, IContainerLoadMode, IFluidCodeDetails } from "@fluidframework/container-definitions";
7
7
  import { IDocumentStorageService, IFluidResolvedUrl, IResolvedUrl } from "@fluidframework/driver-definitions";
8
- import { IClientConfiguration, IClientDetails, IDocumentMessage, IQuorumClients, ISequencedDocumentMessage, IVersion } from "@fluidframework/protocol-definitions";
8
+ import { IClientConfiguration, IClientDetails, IDocumentMessage, IProtocolState, IQuorumClients, ISequencedDocumentMessage, IVersion } from "@fluidframework/protocol-definitions";
9
9
  import { EventEmitterWithErrorHandling, TelemetryLogger } from "@fluidframework/telemetry-utils";
10
10
  import { ILoaderOptions, Loader } from "./loader";
11
11
  import { ConnectionState } from "./connectionState";
@@ -35,26 +35,41 @@ export interface IContainerConfig {
35
35
  * Client details provided in the override will be merged over the default client.
36
36
  */
37
37
  clientDetailsOverride?: IClientDetails;
38
+ /**
39
+ * Serialized state from a previous instance of this container
40
+ */
41
+ serializedContainerState?: IPendingContainerState;
38
42
  }
39
43
  /**
40
44
  * Waits until container connects to delta storage and gets up-to-date
41
45
  * Useful when resolving URIs and hitting 404, due to container being loaded from (stale) snapshot and not being
42
46
  * up to date. Host may chose to wait in such case and retry resolving URI.
43
47
  * Warning: Will wait infinitely for connection to establish if there is no connection.
44
- * May result in deadlock if Container.setAutoReconnect(false) is called and never switched back to auto-reconnect.
48
+ * May result in deadlock if Container.disconnect() is called and never followed by a call to Container.connect().
45
49
  * @returns true: container is up to date, it processed all the ops that were know at the time of first connection
46
50
  * false: storage does not provide indication of how far the client is. Container processed
47
51
  * all the ops known to it, but it maybe still behind.
48
52
  * @throws an error beginning with `"Container closed"` if the container is closed before it catches up.
49
53
  */
50
54
  export declare function waitContainerToCatchUp(container: IContainer): Promise<boolean>;
55
+ /**
56
+ * State saved by a container at close time, to be used to load a new instance
57
+ * of the container to the same state
58
+ */
59
+ export interface IPendingContainerState {
60
+ pendingRuntimeState: unknown;
61
+ url: string;
62
+ protocol: IProtocolState;
63
+ term: number;
64
+ clientId?: string;
65
+ }
51
66
  export declare class Container extends EventEmitterWithErrorHandling<IContainerEvents> implements IContainer {
52
67
  private readonly loader;
53
68
  static version: string;
54
69
  /**
55
70
  * Load an existing container.
56
71
  */
57
- static load(loader: Loader, loadOptions: IContainerLoadOptions, pendingLocalState?: unknown): Promise<Container>;
72
+ static load(loader: Loader, loadOptions: IContainerLoadOptions, pendingLocalState?: IPendingContainerState): Promise<Container>;
58
73
  /**
59
74
  * Create a new container in a detached state.
60
75
  */
@@ -163,27 +178,11 @@ export declare class Container extends EventEmitterWithErrorHandling<IContainerE
163
178
  serialize(): string;
164
179
  attach(request: IRequest): Promise<void>;
165
180
  request(path: IRequest): Promise<IResponse>;
166
- /**
167
- * Dictates whether or not the current container will automatically attempt to reconnect to the delta stream
168
- * after receiving a disconnect event
169
- * @param reconnect - Boolean indicating if reconnect should automatically occur
170
- * @deprecated - 0.58, This API will be removed in 1.0
171
- * Use `connect()` and `disconnect()` instead of `setAutoReconnect(true)` and `setAutoReconnect(false)` respectively
172
- * See https://github.com/microsoft/FluidFramework/issues/9167 for context
173
- */
174
- setAutoReconnect(reconnect: boolean): void;
175
181
  private setAutoReconnectInternal;
176
182
  connect(): void;
177
183
  private connectInternal;
178
184
  disconnect(): void;
179
185
  private disconnectInternal;
180
- /**
181
- * Have the container attempt to resume processing ops
182
- * @deprecated - 0.58, This API will be removed in 1.0
183
- * Use `connect()` instead
184
- * See https://github.com/microsoft/FluidFramework/issues/9167 for context
185
- */
186
- resume(): void;
187
186
  private resumeInternal;
188
187
  getAbsoluteUrl(relativeUrl: string): Promise<string | undefined>;
189
188
  proposeCodeDetails(codeDetails: IFluidCodeDetails): Promise<boolean>;
@@ -222,13 +221,6 @@ export declare class Container extends EventEmitterWithErrorHandling<IContainerE
222
221
  private submitContainerMessage;
223
222
  private submitMessage;
224
223
  private processRemoteMessage;
225
- /**
226
- * #260 (ADO)
227
- * back-compat: noopTimeFrequency & noopCountFrequency properties were added to
228
- * IClientConfiguration in 0.59.3000. During the integration, we must read the
229
- * available configuration from the loader options.
230
- */
231
- private getNoopConfig;
232
224
  private submitSignal;
233
225
  private processSignal;
234
226
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"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