@fluidframework/datastore 2.0.0-internal.3.0.5 → 2.0.0-internal.3.1.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.
- package/.eslintrc.js +5 -7
- package/.mocharc.js +2 -2
- package/README.md +3 -0
- package/api-extractor.json +2 -2
- package/dist/channelContext.d.ts.map +1 -1
- package/dist/channelContext.js.map +1 -1
- package/dist/channelDeltaConnection.d.ts.map +1 -1
- package/dist/channelDeltaConnection.js.map +1 -1
- package/dist/channelStorageService.d.ts.map +1 -1
- package/dist/channelStorageService.js +1 -3
- package/dist/channelStorageService.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts +11 -24
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js +68 -86
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/fluidHandle.d.ts.map +1 -1
- package/dist/fluidHandle.js.map +1 -1
- package/dist/localChannelContext.d.ts.map +1 -1
- package/dist/localChannelContext.js +9 -5
- package/dist/localChannelContext.js.map +1 -1
- package/dist/localChannelStorageService.d.ts.map +1 -1
- package/dist/localChannelStorageService.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/remoteChannelContext.d.ts.map +1 -1
- package/dist/remoteChannelContext.js +2 -2
- package/dist/remoteChannelContext.js.map +1 -1
- package/lib/channelContext.d.ts.map +1 -1
- package/lib/channelContext.js.map +1 -1
- package/lib/channelDeltaConnection.d.ts.map +1 -1
- package/lib/channelDeltaConnection.js.map +1 -1
- package/lib/channelStorageService.d.ts.map +1 -1
- package/lib/channelStorageService.js +1 -3
- package/lib/channelStorageService.js.map +1 -1
- package/lib/dataStoreRuntime.d.ts +11 -24
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/dataStoreRuntime.js +71 -89
- package/lib/dataStoreRuntime.js.map +1 -1
- package/lib/fluidHandle.d.ts.map +1 -1
- package/lib/fluidHandle.js.map +1 -1
- package/lib/localChannelContext.d.ts.map +1 -1
- package/lib/localChannelContext.js +9 -5
- package/lib/localChannelContext.js.map +1 -1
- package/lib/localChannelStorageService.d.ts.map +1 -1
- package/lib/localChannelStorageService.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/remoteChannelContext.d.ts.map +1 -1
- package/lib/remoteChannelContext.js +2 -2
- package/lib/remoteChannelContext.js.map +1 -1
- package/package.json +111 -110
- package/prettier.config.cjs +1 -1
- package/src/channelContext.ts +66 -65
- package/src/channelDeltaConnection.ts +50 -44
- package/src/channelStorageService.ts +58 -54
- package/src/dataStoreRuntime.ts +1122 -1086
- package/src/fluidHandle.ts +87 -91
- package/src/localChannelContext.ts +302 -255
- package/src/localChannelStorageService.ts +47 -45
- package/src/packageVersion.ts +1 -1
- package/src/remoteChannelContext.ts +300 -291
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +9 -13
package/src/fluidHandle.ts
CHANGED
|
@@ -3,111 +3,107 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
IFluidHandle,
|
|
8
|
-
IFluidHandleContext,
|
|
9
|
-
FluidObject,
|
|
10
|
-
} from "@fluidframework/core-interfaces";
|
|
6
|
+
import { IFluidHandle, IFluidHandleContext, FluidObject } from "@fluidframework/core-interfaces";
|
|
11
7
|
import { generateHandleContextPath } from "@fluidframework/runtime-utils";
|
|
12
8
|
|
|
13
9
|
/**
|
|
14
10
|
* Handle for a shared {@link @fluidframework/core-interfaces#FluidObject}.
|
|
15
11
|
*/
|
|
16
12
|
export class FluidObjectHandle<T extends FluidObject = FluidObject> implements IFluidHandle {
|
|
17
|
-
|
|
13
|
+
private readonly pendingHandlesToMakeVisible: Set<IFluidHandle> = new Set();
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
/**
|
|
16
|
+
* {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.absolutePath}
|
|
17
|
+
*/
|
|
18
|
+
public readonly absolutePath: string;
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
/**
|
|
21
|
+
* {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}
|
|
22
|
+
*/
|
|
23
|
+
public get IFluidHandle(): IFluidHandle {
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
/**
|
|
28
|
+
* {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.isAttached}
|
|
29
|
+
*/
|
|
30
|
+
public get isAttached(): boolean {
|
|
31
|
+
return this.routeContext.isAttached;
|
|
32
|
+
}
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Tells whether the object of this handle is visible in the container locally or globally.
|
|
36
|
+
*/
|
|
37
|
+
private get visible(): boolean {
|
|
38
|
+
/**
|
|
39
|
+
* If the object of this handle is attached, it is visible in the container. Ideally, checking local visibility
|
|
40
|
+
* should be enough for a handle. However, there are scenarios where the object becomes locally visible but the
|
|
41
|
+
* handle does not know this - This will happen is attachGraph is never called on the handle. Couple of examples
|
|
42
|
+
* where this can happen:
|
|
43
|
+
*
|
|
44
|
+
* 1. Handles to DDS other than the default handle won't know if the DDS becomes visible after the handle was
|
|
45
|
+
* created.
|
|
46
|
+
*
|
|
47
|
+
* 2. Handles to root data stores will never know that it was visible because the handle will not be stores in
|
|
48
|
+
* another DDS and so, attachGraph will never be called on it.
|
|
49
|
+
*/
|
|
50
|
+
return this.isAttached || this.locallyVisible;
|
|
51
|
+
}
|
|
56
52
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Tracks whether this handle is locally visible in the container.
|
|
55
|
+
*/
|
|
56
|
+
private locallyVisible: boolean = false;
|
|
61
57
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new `FluidObjectHandle`.
|
|
60
|
+
*
|
|
61
|
+
* @param value - The {@link @fluidframework/core-interfaces#FluidObject} object this handle is for.
|
|
62
|
+
* @param path - The path to this handle relative to the `routeContext`.
|
|
63
|
+
* @param routeContext - The parent {@link @fluidframework/core-interfaces#IFluidHandleContext} that has a route
|
|
64
|
+
* to this handle.
|
|
65
|
+
*/
|
|
66
|
+
constructor(
|
|
67
|
+
protected readonly value: T | Promise<T>,
|
|
68
|
+
public readonly path: string,
|
|
69
|
+
public readonly routeContext: IFluidHandleContext,
|
|
70
|
+
) {
|
|
71
|
+
this.absolutePath = generateHandleContextPath(path, this.routeContext);
|
|
72
|
+
}
|
|
77
73
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
74
|
+
/**
|
|
75
|
+
* {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.get}
|
|
76
|
+
*/
|
|
77
|
+
public async get(): Promise<any> {
|
|
78
|
+
// Note that this return works whether we received a T or a Promise<T> for this.value in the constructor.
|
|
79
|
+
return this.value;
|
|
80
|
+
}
|
|
85
81
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
/**
|
|
83
|
+
* {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.attachGraph }
|
|
84
|
+
*/
|
|
85
|
+
public attachGraph(): void {
|
|
86
|
+
if (this.visible) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
93
89
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
this.locallyVisible = true;
|
|
91
|
+
this.pendingHandlesToMakeVisible.forEach((handle) => {
|
|
92
|
+
handle.attachGraph();
|
|
93
|
+
});
|
|
94
|
+
this.pendingHandlesToMakeVisible.clear();
|
|
95
|
+
this.routeContext.attachGraph();
|
|
96
|
+
}
|
|
101
97
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
98
|
+
/**
|
|
99
|
+
* {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.bind}
|
|
100
|
+
*/
|
|
101
|
+
public bind(handle: IFluidHandle) {
|
|
102
|
+
// If this handle is visible, attach the graph of the incoming handle as well.
|
|
103
|
+
if (this.visible) {
|
|
104
|
+
handle.attachGraph();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
this.pendingHandlesToMakeVisible.add(handle);
|
|
108
|
+
}
|
|
113
109
|
}
|