@fluidframework/datastore 2.0.0-internal.1.1.3 → 2.0.0-internal.1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/datastore",
3
- "version": "2.0.0-internal.1.1.3",
3
+ "version": "2.0.0-internal.1.2.0",
4
4
  "description": "Fluid data store implementation",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -63,28 +63,28 @@
63
63
  "dependencies": {
64
64
  "@fluidframework/common-definitions": "^0.20.1",
65
65
  "@fluidframework/common-utils": "^1.0.0",
66
- "@fluidframework/container-definitions": "^2.0.0-internal.1.1.3",
67
- "@fluidframework/container-utils": "^2.0.0-internal.1.1.3",
68
- "@fluidframework/core-interfaces": "^2.0.0-internal.1.1.3",
69
- "@fluidframework/datastore-definitions": "^2.0.0-internal.1.1.3",
70
- "@fluidframework/driver-definitions": "^2.0.0-internal.1.1.3",
71
- "@fluidframework/driver-utils": "^2.0.0-internal.1.1.3",
72
- "@fluidframework/garbage-collector": "^2.0.0-internal.1.1.3",
73
- "@fluidframework/protocol-base": "^0.1037.1000",
66
+ "@fluidframework/container-definitions": "^2.0.0-internal.1.2.0",
67
+ "@fluidframework/container-utils": "^2.0.0-internal.1.2.0",
68
+ "@fluidframework/core-interfaces": "^2.0.0-internal.1.2.0",
69
+ "@fluidframework/datastore-definitions": "^2.0.0-internal.1.2.0",
70
+ "@fluidframework/driver-definitions": "^2.0.0-internal.1.2.0",
71
+ "@fluidframework/driver-utils": "^2.0.0-internal.1.2.0",
72
+ "@fluidframework/garbage-collector": "^2.0.0-internal.1.2.0",
73
+ "@fluidframework/protocol-base": "^0.1038.1000",
74
74
  "@fluidframework/protocol-definitions": "^1.0.0",
75
- "@fluidframework/runtime-definitions": "^2.0.0-internal.1.1.3",
76
- "@fluidframework/runtime-utils": "^2.0.0-internal.1.1.3",
77
- "@fluidframework/telemetry-utils": "^2.0.0-internal.1.1.3",
75
+ "@fluidframework/runtime-definitions": "^2.0.0-internal.1.2.0",
76
+ "@fluidframework/runtime-utils": "^2.0.0-internal.1.2.0",
77
+ "@fluidframework/telemetry-utils": "^2.0.0-internal.1.2.0",
78
78
  "lodash": "^4.17.21",
79
79
  "uuid": "^8.3.1"
80
80
  },
81
81
  "devDependencies": {
82
- "@fluidframework/build-common": "^0.24.0",
83
- "@fluidframework/build-tools": "^0.3.1000",
82
+ "@fluidframework/build-common": "^1.0.0",
83
+ "@fluidframework/build-tools": "^0.4.4000",
84
84
  "@fluidframework/datastore-previous": "npm:@fluidframework/datastore@^1.0.0",
85
- "@fluidframework/eslint-config-fluid": "^0.28.2000",
86
- "@fluidframework/mocha-test-setup": "^2.0.0-internal.1.1.3",
87
- "@fluidframework/test-runtime-utils": "^2.0.0-internal.1.1.3",
85
+ "@fluidframework/eslint-config-fluid": "^1.0.0",
86
+ "@fluidframework/mocha-test-setup": "^2.0.0-internal.1.2.0",
87
+ "@fluidframework/test-runtime-utils": "^2.0.0-internal.1.2.0",
88
88
  "@microsoft/api-extractor": "^7.22.2",
89
89
  "@rushstack/eslint-config": "^2.5.1",
90
90
  "@types/mocha": "^9.1.1",
@@ -273,10 +273,12 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {
273
273
  /**
274
274
  * If existing flag is false, this is a new data store and is not visible. The existing flag can be true in two
275
275
  * conditions:
276
+ *
276
277
  * 1. It's a local data store that is created when a detached container is rehydrated. In this case, the data
277
- * store is locally visible because the snapshot it is loaded from contains locally visible data stores only.
278
+ * store is locally visible because the snapshot it is loaded from contains locally visible data stores only.
279
+ *
278
280
  * 2. It's a remote data store that is created when an attached container is loaded is loaded from snapshot or
279
- * when an attach op comes in. In both these cases, the data store is already globally visible.
281
+ * when an attach op comes in. In both these cases, the data store is already globally visible.
280
282
  */
281
283
  if (existing) {
282
284
  this.visibilityState = dataStoreContext.attachState === AttachState.Detached
@@ -422,11 +424,14 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {
422
424
 
423
425
  /**
424
426
  * This function is called when a data store becomes root. It does the following:
427
+ *
425
428
  * 1. Marks the data store locally visible in the container.
429
+ *
426
430
  * 2. Attaches the graph of all the handles bound to it.
431
+ *
427
432
  * 3. Calls into the data store context to mark it visible in the container too. If the container is globally
428
- * visible, it will mark us globally visible. Otherwise, it will mark us globally visible when it becomes
429
- * globally visible.
433
+ * visible, it will mark us globally visible. Otherwise, it will mark us globally visible when it becomes
434
+ * globally visible.
430
435
  */
431
436
  public makeVisibleAndAttachGraph() {
432
437
  if (this.visibilityState !== VisibilityState.NotVisible) {
@@ -619,11 +624,15 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {
619
624
  * Generates data used for garbage collection. This includes a list of GC nodes that represent this channel
620
625
  * including any of its child channel contexts. Each node has a set of outbound routes to other GC nodes in the
621
626
  * document. It does the following:
627
+ *
622
628
  * 1. Calls into each child context to get its GC data.
629
+ *
623
630
  * 2. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be
624
- * identified as belonging to the child.
631
+ * identified as belonging to the child.
632
+ *
625
633
  * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent
626
- * the GC data of this channel.
634
+ * the GC data of this channel.
635
+ *
627
636
  * @param fullGC - true to bypass optimizations and force full generation of GC data.
628
637
  */
629
638
  public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {
@@ -735,21 +744,21 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext {
735
744
  * back-compat 0.59.1000 - getAttachSummary() is called when making a data store globally visible (previously
736
745
  * attaching state). Ideally, attachGraph() should have already be called making it locally visible. However,
737
746
  * before visibility state was added, this may not have been the case and getAttachSummary() could be called:
738
- * 1) Before attaching the data store - When a detached container is attached.
739
- * 2) After attaching the data store - When a data store is created and bound in an attached container.
747
+ *
748
+ * 1. Before attaching the data store - When a detached container is attached.
749
+ *
750
+ * 2. After attaching the data store - When a data store is created and bound in an attached container.
740
751
  *
741
752
  * The basic idea is that all local object should become locally visible before they are globally visible.
742
753
  */
743
754
  this.attachGraph();
744
755
 
745
- /**
746
- * This assert cannot be added now due to back-compat. To be uncommented when the following issue is fixed -
747
- * https://github.com/microsoft/FluidFramework/issues/9688.
748
- *
749
- * assert(this.visibilityState === VisibilityState.LocallyVisible,
750
- * "The data store should be locally visible when generating attach summary",
751
- * );
752
- */
756
+ // This assert cannot be added now due to back-compat. To be uncommented when the following issue is fixed -
757
+ // https://github.com/microsoft/FluidFramework/issues/9688.
758
+ //
759
+ // assert(this.visibilityState === VisibilityState.LocallyVisible,
760
+ // "The data store should be locally visible when generating attach summary",
761
+ // );
753
762
 
754
763
  const summaryBuilder = new SummaryTreeBuilder();
755
764
 
@@ -29,15 +29,19 @@ export class FluidObjectHandle<T extends FluidObject = FluidObject> implements I
29
29
  * should be enough for a handle. However, there are scenarios where the object becomes locally visible but the
30
30
  * handle does not know this - This will happen is attachGraph is never called on the handle. Couple of examples
31
31
  * where this can happen:
32
+ *
32
33
  * 1. Handles to DDS other than the default handle won't know if the DDS becomes visible after the handle was
33
- * created.
34
+ * created.
35
+ *
34
36
  * 2. Handles to root data stores will never know that it was visible because the handle will not be stores in
35
- * another DDS and so, attachGraph will never be called on it.
37
+ * another DDS and so, attachGraph will never be called on it.
36
38
  */
37
39
  return this.isAttached || this.locallyVisible;
38
40
  }
39
41
 
40
- // Tracks whether this handle is locally visible in the container.
42
+ /**
43
+ * Tracks whether this handle is locally visible in the container.
44
+ */
41
45
  private locallyVisible: boolean = false;
42
46
 
43
47
  /**
@@ -47,7 +51,7 @@ export class FluidObjectHandle<T extends FluidObject = FluidObject> implements I
47
51
  * @param routeContext - The parent IFluidHandleContext that has a route to this handle.
48
52
  */
49
53
  constructor(
50
- protected readonly value: T,
54
+ protected readonly value: T | Promise<T>,
51
55
  public readonly path: string,
52
56
  public readonly routeContext: IFluidHandleContext,
53
57
  ) {
@@ -55,6 +59,7 @@ export class FluidObjectHandle<T extends FluidObject = FluidObject> implements I
55
59
  }
56
60
 
57
61
  public async get(): Promise<any> {
62
+ // Note that this return works whether we received a T or a Promise<T> for this.value in the constructor.
58
63
  return this.value;
59
64
  }
60
65
 
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/datastore";
9
- export const pkgVersion = "2.0.0-internal.1.1.3";
9
+ export const pkgVersion = "2.0.0-internal.1.2.0";