@fluidframework/datastore-definitions 2.0.0-internal.3.0.1 → 2.0.0-internal.3.1.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/.eslintrc.js +5 -7
- package/README.md +7 -7
- package/api-extractor.json +2 -2
- package/dist/channel.d.ts.map +1 -1
- package/dist/channel.js.map +1 -1
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/dataStoreRuntime.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jsonable.d.ts.map +1 -1
- package/dist/jsonable.js.map +1 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js.map +1 -1
- package/package.json +64 -67
- package/prettier.config.cjs +1 -1
- package/src/channel.ts +179 -179
- package/src/dataStoreRuntime.ts +118 -114
- package/src/index.ts +5 -5
- package/src/jsonable.ts +14 -11
- package/src/storage.ts +13 -13
- package/tsconfig.json +8 -12
package/.eslintrc.js
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
]
|
|
13
|
-
}
|
|
7
|
+
parserOptions: {
|
|
8
|
+
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
9
|
+
},
|
|
10
|
+
extends: ["@fluidframework/eslint-config-fluid/minimal", "prettier"],
|
|
11
|
+
};
|
package/README.md
CHANGED
|
@@ -6,13 +6,13 @@ Interface `IFluidDataStoreRuntime` specifies the data store developer API.
|
|
|
6
6
|
|
|
7
7
|
_TODO: The full set of functionality is under review_
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
9
|
+
- DDS creation and management APIs
|
|
10
|
+
- Container info and states (connection state, documentId, quorum, audience, etc.)
|
|
11
|
+
- Loader
|
|
12
|
+
- Op/Signal submission
|
|
13
|
+
- Snapshotting
|
|
14
|
+
- DeltaManager
|
|
15
|
+
- Blob Management API.
|
|
16
16
|
|
|
17
17
|
### Signals
|
|
18
18
|
|
package/api-extractor.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "@fluidframework/build-common/api-extractor-common-report.json"
|
|
4
4
|
}
|
package/dist/channel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"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"}
|
package/dist/channel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n IGarbageCollectionData,\n ISummaryTreeWithStats,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { IChannelAttributes } from \"./storage\";\nimport { IFluidDataStoreRuntime } from \"./dataStoreRuntime\";\n\nexport interface IChannel extends IFluidLoadable {\n /**\n * A readonly identifier for the channel\n */\n readonly id: string;\n\n readonly owner?: string;\n\n readonly attributes: IChannelAttributes;\n\n /**\n * Generates summary of the channel synchronously. It is called when an `attach message`\n * for a local channel is generated. In other words, when the channel is being attached\n * to make it visible to other clients.\n * Note: Since Attach Summary is generated for local channels when making them visible to\n * remote clients, they don't have any previous summaries to compare against. For this reason,\n * The attach summary cannot contain summary handles (paths to sub-trees or blobs).\n * It can, however, contain ISummaryAttachment (handles to blobs uploaded async via the blob manager).\n * @param fullTree - flag indicating whether the attempt should generate a full\n * summary tree without any handles for unchanged subtrees.\n * @param trackState - optimization for tracking state of objects across summaries. If the state\n * of an object did not change since last successful summary, an ISummaryHandle can be used\n * instead of re-summarizing it. If this is false, the expectation is that you should never\n * send an ISummaryHandle since you are not expected to track state.\n * Note: The goal is to remove the trackState and automatically decided whether the\n * handles will be used or not: https://github.com/microsoft/FluidFramework/issues/10455\n * @returns A summary capturing the current state of the channel.\n */\n getAttachSummary(\n fullTree?: boolean,\n trackState?: boolean,\n telemetryContext?: ITelemetryContext,\n ): ISummaryTreeWithStats;\n\n /**\n * Generates summary of the channel asynchronously.\n * This should not be called where the channel can be modified while summarization is in progress.\n * @param fullTree - flag indicating whether the attempt should generate a full\n * summary tree without any handles for unchanged subtrees. It is only set to true when generating\n * a summary from the entire container.\n * @param trackState - This tells whether we should track state from this summary.\n * @returns A summary capturing the current state of the channel.\n */\n summarize(\n fullTree?: boolean,\n trackState?: boolean,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummaryTreeWithStats>;\n\n /**\n * Checks if the channel is attached to storage.\n * @returns True iff the channel is attached.\n */\n isAttached(): boolean;\n\n /**\n * Enables the channel to send and receive ops.\n * @param services - Services to connect to\n */\n connect(services: IChannelServices): void;\n\n /**\n * Returns the GC data for this channel. It contains a list of GC nodes that contains references to\n * other GC nodes.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n getGCData(fullGC?: boolean): IGarbageCollectionData;\n}\n\n/**\n * Handler provided by shared data structure to process requests from the runtime.\n */\nexport interface IDeltaHandler {\n /**\n * Processes the op.\n * @param message - The message to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n process: (message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) => void;\n\n /**\n * State change events to indicate changes to the delta connection\n * @param connected - true if connected, false otherwise\n */\n setConnectionState(connected: boolean): void;\n\n /**\n * Called when the runtime asks the client to resubmit an op. This may be because the Container reconnected and\n * this op was not acked.\n * The client can choose to resubmit the same message, submit different / multiple messages or not submit anything\n * at all.\n * @param message - The original message that was submitted.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n reSubmit(message: any, localOpMetadata: unknown): void;\n\n /**\n * Apply changes from an op. Used when rehydrating an attached container\n * with pending changes. This prepares the SharedObject for seeing an ACK\n * for the op or resubmitting the op upon reconnection.\n * @param message - Contents of a stashed op.\n * @returns localMetadata of the op, to be passed to process() or resubmit()\n * when the op is ACKed or resubmitted, respectively\n */\n applyStashedOp(message: any): unknown;\n\n /**\n * Revert a local op.\n * @param message - The original message that was submitted.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n rollback?(message: any, localOpMetadata: unknown): void;\n}\n\n/**\n * Interface to represent a connection to a delta notification stream.\n */\nexport interface IDeltaConnection {\n connected: boolean;\n\n /**\n * Send new messages to the server.\n * @param messageContent - The content of the message to be sent.\n * @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime\n * and not sent to the server. It will be provided back when this message is acknowledged by the server. It will\n * also be provided back when asked to resubmit the message.\n */\n submit(messageContent: any, localOpMetadata: unknown): void;\n\n /**\n * Attaches a message handler to the delta connection\n */\n attach(handler: IDeltaHandler): void;\n\n /**\n * Indicates that the channel is dirty and needs to be part of the summary. It is called by a SharedSummaryBlock\n * that needs to be part of the summary but does not generate ops.\n */\n dirty(): void;\n\n /**\n * Called when a new outbound reference is added to another node. This is used by garbage collection to identify\n * all references added in the system.\n * @param srcHandle - The handle of the node that added the reference.\n * @param outboundHandle - The handle of the outbound node that is referenced.\n */\n addedGCOutboundReference?(srcHandle: IFluidHandle, outboundHandle: IFluidHandle): void;\n}\n\n/**\n * Storage services to read the objects at a given path.\n */\nexport interface IChannelStorageService {\n /**\n * Reads the object contained at the given path. Returns a buffer representation for the object.\n */\n readBlob(path: string): Promise<ArrayBufferLike>;\n\n /**\n * Determines if there is an object contained at the given path.\n */\n contains(path: string): Promise<boolean>;\n\n /**\n * Lists the blobs that exist at a specific path.\n */\n list(path: string): Promise<string[]>;\n}\n\n/**\n * Storage services to read the objects at a given path using the given delta connection.\n */\nexport interface IChannelServices {\n deltaConnection: IDeltaConnection;\n\n objectStorage: IChannelStorageService;\n}\n\n/**\n * Definitions of a channel factory.\n *\n * The runtime must be able to produce \"channels\" of the correct in-memory object type for the collaborative session.\n * Here \"channels\" are typically distributed data structures (DDSs).\n *\n * The runtime will consult with a registry of such factories during\n * {@link https://fluidframework.com/docs/build/containers/ | Container} load and when receiving \"attach\" operations\n * (ops), which indicate a new instance of a channel being introduced to the collaboration session, to produce the\n * appropriate in-memory object.\n *\n * @example If a collaboration includes a {@link https://fluidframework.com/docs/data-structures/map/ | SharedMap},\n * the collaborating clients will need to have access to a factory that can produce the `SharedMap` obect.\n *\n * @remarks Factories follow a common model but enable custom behavior.\n */\nexport interface IChannelFactory {\n /**\n * String representing the type of the factory.\n */\n readonly type: string;\n\n /**\n * Attributes of the channel.\n */\n readonly attributes: IChannelAttributes;\n\n /**\n * Loads the given channel. This call is only ever invoked internally as the only thing\n * that is ever directly loaded is the document itself. Load will then only be called on documents that\n * were created and added to a channel.\n * @param runtime - Data store runtime containing state/info/helper methods about the data store.\n * @param id - ID of the channel.\n * @param services - Services to read objects at a given path using the delta connection.\n * @param channelAttributes - The attributes for the the channel to be loaded.\n * @returns The loaded object\n *\n * @privateRemarks\n * Thought: should the storage object include the version information and limit access to just files\n * for the given object? The latter seems good in general. But both are probably good things. We then just\n * need a way to allow the document to provide later storage for the object.\n */\n load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n channelAttributes: Readonly<IChannelAttributes>,\n ): Promise<IChannel>;\n\n /**\n * Creates a local version of the channel.\n * Calling attach on the object later will insert it into the object stream.\n * @param runtime - The runtime the new object will be associated with\n * @param id - The unique ID of the new object\n * @returns The newly created object.\n *\n * @privateRemarks\n * NOTE here - When we attach we need to submit all the pending ops prior to actually doing the attach\n * for consistency.\n */\n create(runtime: IFluidDataStoreRuntime, id: string): IChannel;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { IChannelAttributes } from \"./storage\";\nimport { IFluidDataStoreRuntime } from \"./dataStoreRuntime\";\n\nexport interface IChannel extends IFluidLoadable {\n\t/**\n\t * A readonly identifier for the channel\n\t */\n\treadonly id: string;\n\n\treadonly owner?: string;\n\n\treadonly attributes: IChannelAttributes;\n\n\t/**\n\t * Generates summary of the channel synchronously. It is called when an `attach message`\n\t * for a local channel is generated. In other words, when the channel is being attached\n\t * to make it visible to other clients.\n\t * Note: Since Attach Summary is generated for local channels when making them visible to\n\t * remote clients, they don't have any previous summaries to compare against. For this reason,\n\t * The attach summary cannot contain summary handles (paths to sub-trees or blobs).\n\t * It can, however, contain ISummaryAttachment (handles to blobs uploaded async via the blob manager).\n\t * @param fullTree - flag indicating whether the attempt should generate a full\n\t * summary tree without any handles for unchanged subtrees.\n\t * @param trackState - optimization for tracking state of objects across summaries. If the state\n\t * of an object did not change since last successful summary, an ISummaryHandle can be used\n\t * instead of re-summarizing it. If this is false, the expectation is that you should never\n\t * send an ISummaryHandle since you are not expected to track state.\n\t * Note: The goal is to remove the trackState and automatically decided whether the\n\t * handles will be used or not: https://github.com/microsoft/FluidFramework/issues/10455\n\t * @returns A summary capturing the current state of the channel.\n\t */\n\tgetAttachSummary(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats;\n\n\t/**\n\t * Generates summary of the channel asynchronously.\n\t * This should not be called where the channel can be modified while summarization is in progress.\n\t * @param fullTree - flag indicating whether the attempt should generate a full\n\t * summary tree without any handles for unchanged subtrees. It is only set to true when generating\n\t * a summary from the entire container.\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @returns A summary capturing the current state of the channel.\n\t */\n\tsummarize(\n\t\tfullTree?: boolean,\n\t\ttrackState?: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats>;\n\n\t/**\n\t * Checks if the channel is attached to storage.\n\t * @returns True iff the channel is attached.\n\t */\n\tisAttached(): boolean;\n\n\t/**\n\t * Enables the channel to send and receive ops.\n\t * @param services - Services to connect to\n\t */\n\tconnect(services: IChannelServices): void;\n\n\t/**\n\t * Returns the GC data for this channel. It contains a list of GC nodes that contains references to\n\t * other GC nodes.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tgetGCData(fullGC?: boolean): IGarbageCollectionData;\n}\n\n/**\n * Handler provided by shared data structure to process requests from the runtime.\n */\nexport interface IDeltaHandler {\n\t/**\n\t * Processes the op.\n\t * @param message - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprocess: (message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) => void;\n\n\t/**\n\t * State change events to indicate changes to the delta connection\n\t * @param connected - true if connected, false otherwise\n\t */\n\tsetConnectionState(connected: boolean): void;\n\n\t/**\n\t * Called when the runtime asks the client to resubmit an op. This may be because the Container reconnected and\n\t * this op was not acked.\n\t * The client can choose to resubmit the same message, submit different / multiple messages or not submit anything\n\t * at all.\n\t * @param message - The original message that was submitted.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\treSubmit(message: any, localOpMetadata: unknown): void;\n\n\t/**\n\t * Apply changes from an op. Used when rehydrating an attached container\n\t * with pending changes. This prepares the SharedObject for seeing an ACK\n\t * for the op or resubmitting the op upon reconnection.\n\t * @param message - Contents of a stashed op.\n\t * @returns localMetadata of the op, to be passed to process() or resubmit()\n\t * when the op is ACKed or resubmitted, respectively\n\t */\n\tapplyStashedOp(message: any): unknown;\n\n\t/**\n\t * Revert a local op.\n\t * @param message - The original message that was submitted.\n\t * @param localOpMetadata - The local metadata associated with the original message.\n\t */\n\trollback?(message: any, localOpMetadata: unknown): void;\n}\n\n/**\n * Interface to represent a connection to a delta notification stream.\n */\nexport interface IDeltaConnection {\n\tconnected: boolean;\n\n\t/**\n\t * Send new messages to the server.\n\t * @param messageContent - The content of the message to be sent.\n\t * @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime\n\t * and not sent to the server. It will be provided back when this message is acknowledged by the server. It will\n\t * also be provided back when asked to resubmit the message.\n\t */\n\tsubmit(messageContent: any, localOpMetadata: unknown): void;\n\n\t/**\n\t * Attaches a message handler to the delta connection\n\t */\n\tattach(handler: IDeltaHandler): void;\n\n\t/**\n\t * Indicates that the channel is dirty and needs to be part of the summary. It is called by a SharedSummaryBlock\n\t * that needs to be part of the summary but does not generate ops.\n\t */\n\tdirty(): void;\n\n\t/**\n\t * Called when a new outbound reference is added to another node. This is used by garbage collection to identify\n\t * all references added in the system.\n\t * @param srcHandle - The handle of the node that added the reference.\n\t * @param outboundHandle - The handle of the outbound node that is referenced.\n\t */\n\taddedGCOutboundReference?(srcHandle: IFluidHandle, outboundHandle: IFluidHandle): void;\n}\n\n/**\n * Storage services to read the objects at a given path.\n */\nexport interface IChannelStorageService {\n\t/**\n\t * Reads the object contained at the given path. Returns a buffer representation for the object.\n\t */\n\treadBlob(path: string): Promise<ArrayBufferLike>;\n\n\t/**\n\t * Determines if there is an object contained at the given path.\n\t */\n\tcontains(path: string): Promise<boolean>;\n\n\t/**\n\t * Lists the blobs that exist at a specific path.\n\t */\n\tlist(path: string): Promise<string[]>;\n}\n\n/**\n * Storage services to read the objects at a given path using the given delta connection.\n */\nexport interface IChannelServices {\n\tdeltaConnection: IDeltaConnection;\n\n\tobjectStorage: IChannelStorageService;\n}\n\n/**\n * Definitions of a channel factory.\n *\n * The runtime must be able to produce \"channels\" of the correct in-memory object type for the collaborative session.\n * Here \"channels\" are typically distributed data structures (DDSs).\n *\n * The runtime will consult with a registry of such factories during\n * {@link https://fluidframework.com/docs/build/containers/ | Container} load and when receiving \"attach\" operations\n * (ops), which indicate a new instance of a channel being introduced to the collaboration session, to produce the\n * appropriate in-memory object.\n *\n * @example If a collaboration includes a {@link https://fluidframework.com/docs/data-structures/map/ | SharedMap},\n * the collaborating clients will need to have access to a factory that can produce the `SharedMap` obect.\n *\n * @remarks Factories follow a common model but enable custom behavior.\n */\nexport interface IChannelFactory {\n\t/**\n\t * String representing the type of the factory.\n\t */\n\treadonly type: string;\n\n\t/**\n\t * Attributes of the channel.\n\t */\n\treadonly attributes: IChannelAttributes;\n\n\t/**\n\t * Loads the given channel. This call is only ever invoked internally as the only thing\n\t * that is ever directly loaded is the document itself. Load will then only be called on documents that\n\t * were created and added to a channel.\n\t * @param runtime - Data store runtime containing state/info/helper methods about the data store.\n\t * @param id - ID of the channel.\n\t * @param services - Services to read objects at a given path using the delta connection.\n\t * @param channelAttributes - The attributes for the the channel to be loaded.\n\t * @returns The loaded object\n\t *\n\t * @privateRemarks\n\t * Thought: should the storage object include the version information and limit access to just files\n\t * for the given object? The latter seems good in general. But both are probably good things. We then just\n\t * need a way to allow the document to provide later storage for the object.\n\t */\n\tload(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tchannelAttributes: Readonly<IChannelAttributes>,\n\t): Promise<IChannel>;\n\n\t/**\n\t * Creates a local version of the channel.\n\t * Calling attach on the object later will insert it into the object stream.\n\t * @param runtime - The runtime the new object will be associated with\n\t * @param id - The unique ID of the new object\n\t * @returns The newly created object.\n\t *\n\t * @privateRemarks\n\t * NOTE here - When we attach we need to submit all the pending ops prior to actually doing the attach\n\t * for consistency.\n\t */\n\tcreate(runtime: IFluidDataStoreRuntime, id: string): IChannel;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"dataStoreRuntime.d.ts","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreRuntime.js","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"dataStoreRuntime.js","sourceRoot":"","sources":["../src/dataStoreRuntime.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDisposable,\n\tIEvent,\n\tIEventProvider,\n\tITelemetryLogger,\n} from \"@fluidframework/common-definitions\";\nimport {\n\tIFluidHandleContext,\n\tIFluidRouter,\n\tIFluidHandle,\n\tFluidObject,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tIAudience,\n\tIDeltaManager,\n\tAttachState,\n\tILoaderOptions,\n} from \"@fluidframework/container-definitions\";\nimport {\n\tIDocumentMessage,\n\tIQuorumClients,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tIInboundSignalMessage,\n\tIProvideFluidDataStoreRegistry,\n} from \"@fluidframework/runtime-definitions\";\nimport { IChannel } from \".\";\n\nexport interface IFluidDataStoreRuntimeEvents extends IEvent {\n\t(event: \"disconnected\" | \"dispose\" | \"attaching\" | \"attached\", listener: () => void);\n\t(event: \"op\", listener: (message: ISequencedDocumentMessage) => void);\n\t(event: \"signal\", listener: (message: IInboundSignalMessage, local: boolean) => void);\n\t(event: \"connected\", listener: (clientId: string) => void);\n}\n\n/**\n * Represents the runtime for the data store. Contains helper functions/state of the data store.\n */\nexport interface IFluidDataStoreRuntime\n\textends IFluidRouter,\n\t\tIEventProvider<IFluidDataStoreRuntimeEvents>,\n\t\tIDisposable,\n\t\tPartial<IProvideFluidDataStoreRegistry> {\n\treadonly id: string;\n\n\treadonly IFluidHandleContext: IFluidHandleContext;\n\n\treadonly rootRoutingContext: IFluidHandleContext;\n\treadonly channelsRoutingContext: IFluidHandleContext;\n\treadonly objectsRoutingContext: IFluidHandleContext;\n\n\treadonly options: ILoaderOptions;\n\n\treadonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n\n\treadonly clientId: string | undefined;\n\n\treadonly connected: boolean;\n\n\treadonly logger: ITelemetryLogger;\n\n\t/**\n\t * Indicates the attachment state of the data store to a host service.\n\t */\n\treadonly attachState: AttachState;\n\n\t/**\n\t * Returns the channel with the given id\n\t */\n\tgetChannel(id: string): Promise<IChannel>;\n\n\t/**\n\t * Invokes the given callback and expects that no ops are submitted\n\t * until execution finishes. If an op is submitted, an error will be raised.\n\t *\n\t * Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`\n\t *\n\t * @param callback - the callback to be invoked\n\t */\n\tensureNoDataModelChanges<T>(callback: () => T): T;\n\n\t/**\n\t * Creates a new channel of the given type.\n\t * @param id - ID of the channel to be created. A unique ID will be generated if left undefined.\n\t * @param type - Type of the channel.\n\t */\n\tcreateChannel(id: string | undefined, type: string): IChannel;\n\n\t/**\n\t * Bind the channel with the data store runtime. If the runtime\n\t * is attached then we attach the channel to make it live.\n\t */\n\tbindChannel(channel: IChannel): void;\n\n\t// Blob related calls\n\t/**\n\t * Api to upload a blob of data.\n\t * @param blob - blob to be uploaded.\n\t */\n\tuploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;\n\n\t/**\n\t * Submits the signal to be sent to other clients.\n\t * @param type - Type of the signal.\n\t * @param content - Content of the signal.\n\t */\n\tsubmitSignal(type: string, content: any): void;\n\n\t/**\n\t * Returns the current quorum.\n\t */\n\tgetQuorum(): IQuorumClients;\n\n\t/**\n\t * Returns the current audience.\n\t */\n\tgetAudience(): IAudience;\n\n\t/**\n\t * Resolves when a local data store is attached.\n\t */\n\twaitAttached(): Promise<void>;\n\n\t/**\n\t * Exposes a handle to the root object / entryPoint of the data store. Use this as the primary way of interacting\n\t * with it. If this property is undefined (meaning that exposing the entryPoint hasn't been implemented in a\n\t * particular scenario) fall back to the current approach of requesting the root object through the request pattern.\n\t *\n\t * @remarks The plan is that eventually the data store will stop providing IFluidRouter functionality, this property\n\t * will become non-optional and return an IFluidHandle (no undefined) and will become the only way to access\n\t * the data store's entryPoint.\n\t */\n\treadonly entryPoint?: IFluidHandle<FluidObject>;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
* This library defines the interfaces required to implement and/or communicate
|
|
7
|
-
* with a data store.
|
|
8
|
-
*
|
|
9
|
-
* @packageDocumentation
|
|
10
|
-
*/
|
|
6
|
+
* This library defines the interfaces required to implement and/or communicate
|
|
7
|
+
* with a data store.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
11
|
export { IChannel, IChannelFactory, IChannelServices, IChannelStorageService, IDeltaConnection, IDeltaHandler, } from "./channel";
|
|
12
12
|
export { IFluidDataStoreRuntime, IFluidDataStoreRuntimeEvents } from "./dataStoreRuntime";
|
|
13
13
|
export { Jsonable } from "./jsonable";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EACN,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n* This library defines the interfaces required to implement and/or communicate\n* with a data store.\n*\n* @packageDocumentation\n*/\n\nexport {\n\tIChannel,\n\tIChannelFactory,\n\tIChannelServices,\n\tIChannelStorageService,\n\tIDeltaConnection,\n\tIDeltaHandler,\n} from \"./channel\";\nexport { IFluidDataStoreRuntime, IFluidDataStoreRuntimeEvents } from \"./dataStoreRuntime\";\nexport { Jsonable } from \"./jsonable\";\nexport { Serializable } from \"./serializable\";\nexport { IChannelAttributes } from \"./storage\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This library defines the interfaces required to implement and/or communicate\n * with a data store.\n *\n * @packageDocumentation\n */\n\nexport {\n\tIChannel,\n\tIChannelFactory,\n\tIChannelServices,\n\tIChannelStorageService,\n\tIDeltaConnection,\n\tIDeltaHandler,\n} from \"./channel\";\nexport { IFluidDataStoreRuntime, IFluidDataStoreRuntimeEvents } from \"./dataStoreRuntime\";\nexport { Jsonable } from \"./jsonable\";\nexport { Serializable } from \"./serializable\";\nexport { IChannelAttributes } from \"./storage\";\n"]}
|
package/dist/jsonable.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonable.d.ts","sourceRoot":"","sources":["../src/jsonable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,oBAAY,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"jsonable.d.ts","sourceRoot":"","sources":["../src/jsonable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,oBAAY,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,SAAS,GAAG,IAAI,IAAI,CAAC,SAChD,SAAS,GACT,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,SAAS,GACT,CAAC,GAEH,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,SAAS,KAAK,GAChC;KACC,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,SAAS,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK;CACnF,GACD,KAAK,CAAC"}
|
package/dist/jsonable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonable.js","sourceRoot":"","sources":["../src/jsonable.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Used to constrain a type `T` to types that are serializable as JSON.\n * Produces a compile-time error if `T` contains non-Jsonable members.\n *\n * @remarks\n * Note that this does NOT prevent using of values with non-json compatible data,\n * it only prevents using values with types that include non-json compatible data.\n * This means that one can, for example, pass an a value typed with json compatible\n * interface into this function,\n * that could actually be a class with lots on non-json compatible fields and methods.\n *\n * Important: `T extends Jsonable<T>` is incorrect (does not even compile).\n * `T extends Jsonable` is also incorrect since `Jsonable` is just `any` and thus applies no constraint at all.\n *\n * The optional 'TReplaced' parameter may be used to permit additional leaf types to support\n * situations where a `replacer` is used to handle special values (e.g., `Jsonable<{ x: IFluidHandle }, IFluidHandle>`).\n *\n * Note that `Jsonable<T>` does not protect against the following pitfalls when serializing with JSON.stringify():\n *\n * - `undefined` properties on objects are omitted (i.e., properties become undefined instead of equal to undefined).\n *\n * - When `undefined` appears as the root object or as an array element it is coerced to `null`.\n *\n * - Non-finite numbers (`NaN`, `+/-Infinity`) are also coerced to `null`.\n *\n * - prototypes and non-enumerable properties are lost.\n *\n * Also, `Jsonable<T>` does not prevent the construction of circular references.\n *\n * Using `Jsonable` (with no type parameters) or `Jsonable<any>` is just a type alias for `any`\n * and should not be used if type safety is desired.\n *\n * @example\n * Typical usage:\n * ```ts\n * function foo<T>(value: Jsonable<T>) { ... }\n * ```\n */\nexport type Jsonable<T = any, TReplaced = void>
|
|
1
|
+
{"version":3,"file":"jsonable.js","sourceRoot":"","sources":["../src/jsonable.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Used to constrain a type `T` to types that are serializable as JSON.\n * Produces a compile-time error if `T` contains non-Jsonable members.\n *\n * @remarks\n * Note that this does NOT prevent using of values with non-json compatible data,\n * it only prevents using values with types that include non-json compatible data.\n * This means that one can, for example, pass an a value typed with json compatible\n * interface into this function,\n * that could actually be a class with lots on non-json compatible fields and methods.\n *\n * Important: `T extends Jsonable<T>` is incorrect (does not even compile).\n * `T extends Jsonable` is also incorrect since `Jsonable` is just `any` and thus applies no constraint at all.\n *\n * The optional 'TReplaced' parameter may be used to permit additional leaf types to support\n * situations where a `replacer` is used to handle special values (e.g., `Jsonable<{ x: IFluidHandle }, IFluidHandle>`).\n *\n * Note that `Jsonable<T>` does not protect against the following pitfalls when serializing with JSON.stringify():\n *\n * - `undefined` properties on objects are omitted (i.e., properties become undefined instead of equal to undefined).\n *\n * - When `undefined` appears as the root object or as an array element it is coerced to `null`.\n *\n * - Non-finite numbers (`NaN`, `+/-Infinity`) are also coerced to `null`.\n *\n * - prototypes and non-enumerable properties are lost.\n *\n * Also, `Jsonable<T>` does not prevent the construction of circular references.\n *\n * Using `Jsonable` (with no type parameters) or `Jsonable<any>` is just a type alias for `any`\n * and should not be used if type safety is desired.\n *\n * @example\n * Typical usage:\n * ```ts\n * function foo<T>(value: Jsonable<T>) { ... }\n * ```\n */\nexport type Jsonable<T = any, TReplaced = void> = T extends\n\t| undefined\n\t| null\n\t| boolean\n\t| number\n\t| string\n\t| TReplaced\n\t? T\n\t: // eslint-disable-next-line @typescript-eslint/ban-types\n\tExtract<T, Function> extends never\n\t? {\n\t\t\t[K in keyof T]: Extract<K, symbol> extends never ? Jsonable<T[K], TReplaced> : never;\n\t }\n\t: never;\n"]}
|
package/dist/storage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IAEvC;;OAEG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CACjC"}
|
package/dist/storage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Represents the attributes of a channel/DDS.\n */\nexport interface IChannelAttributes {\n
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Represents the attributes of a channel/DDS.\n */\nexport interface IChannelAttributes {\n\t/**\n\t * Type name of the DDS for factory look up with ISharedObjectRegistry\n\t */\n\treadonly type: string;\n\n\t/**\n\t * Format version of the snapshot\n\t * Currently, only use to display a debug message if the version is incompatible\n\t */\n\treadonly snapshotFormatVersion: string;\n\n\t/**\n\t * The package version of the code of the DDS, for debug only\n\t */\n\treadonly packageVersion?: string;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,69 +1,66 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
}
|
|
2
|
+
"name": "@fluidframework/datastore-definitions",
|
|
3
|
+
"version": "2.0.0-internal.3.1.0",
|
|
4
|
+
"description": "Fluid data store definitions",
|
|
5
|
+
"homepage": "https://fluidframework.com",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/microsoft/FluidFramework.git",
|
|
9
|
+
"directory": "packages/runtime/datastore-definitions"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "Microsoft and contributors",
|
|
13
|
+
"sideEffects": false,
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"types": "dist/index.d.ts",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "concurrently npm:build:compile npm:lint && npm run build:docs",
|
|
18
|
+
"build:compile": "npm run tsc && npm run typetests:gen && npm run build:test",
|
|
19
|
+
"build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
|
|
20
|
+
"build:full": "npm run build",
|
|
21
|
+
"build:full:compile": "npm run build:compile",
|
|
22
|
+
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
23
|
+
"ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
|
|
24
|
+
"clean": "rimraf dist *.tsbuildinfo *.build.log",
|
|
25
|
+
"eslint": "eslint --format stylish src",
|
|
26
|
+
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
27
|
+
"format": "npm run prettier:fix",
|
|
28
|
+
"lint": "npm run prettier && npm run eslint",
|
|
29
|
+
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
30
|
+
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
31
|
+
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
32
|
+
"tsc": "tsc",
|
|
33
|
+
"typetests:gen": "flub generate typetests --generate --dir .",
|
|
34
|
+
"typetests:prepare": "flub generate typetests --prepare --dir . --pin"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@fluidframework/common-definitions": "^0.20.1",
|
|
38
|
+
"@fluidframework/common-utils": "^1.0.0",
|
|
39
|
+
"@fluidframework/container-definitions": ">=2.0.0-internal.3.1.0 <2.0.0-internal.4.0.0",
|
|
40
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.3.1.0 <2.0.0-internal.4.0.0",
|
|
41
|
+
"@fluidframework/protocol-definitions": "^1.1.0",
|
|
42
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-internal.3.1.0 <2.0.0-internal.4.0.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@fluid-tools/build-cli": "^0.9.0",
|
|
46
|
+
"@fluidframework/build-common": "^1.1.0",
|
|
47
|
+
"@fluidframework/build-tools": "^0.9.0",
|
|
48
|
+
"@fluidframework/datastore-definitions-previous": "npm:@fluidframework/datastore-definitions@2.0.0-internal.3.0.0",
|
|
49
|
+
"@fluidframework/eslint-config-fluid": "^2.0.0",
|
|
50
|
+
"@microsoft/api-extractor": "^7.22.2",
|
|
51
|
+
"@rushstack/eslint-config": "^2.5.1",
|
|
52
|
+
"concurrently": "^6.2.0",
|
|
53
|
+
"copyfiles": "^2.4.1",
|
|
54
|
+
"eslint": "~8.6.0",
|
|
55
|
+
"prettier": "~2.6.2",
|
|
56
|
+
"rimraf": "^2.6.2",
|
|
57
|
+
"typescript": "~4.5.5"
|
|
58
|
+
},
|
|
59
|
+
"typeValidation": {
|
|
60
|
+
"version": "2.0.0-internal.3.1.0",
|
|
61
|
+
"previousVersionStyle": "~previousMinor",
|
|
62
|
+
"baselineRange": ">=2.0.0-internal.3.0.0 <2.0.0-internal.3.1.0",
|
|
63
|
+
"baselineVersion": "2.0.0-internal.3.0.0",
|
|
64
|
+
"broken": {}
|
|
65
|
+
}
|
|
69
66
|
}
|
package/prettier.config.cjs
CHANGED
package/src/channel.ts
CHANGED
|
@@ -6,191 +6,191 @@
|
|
|
6
6
|
import { IFluidHandle, IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
7
7
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
8
8
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
IGarbageCollectionData,
|
|
10
|
+
ISummaryTreeWithStats,
|
|
11
|
+
ITelemetryContext,
|
|
12
12
|
} from "@fluidframework/runtime-definitions";
|
|
13
13
|
import { IChannelAttributes } from "./storage";
|
|
14
14
|
import { IFluidDataStoreRuntime } from "./dataStoreRuntime";
|
|
15
15
|
|
|
16
16
|
export interface IChannel extends IFluidLoadable {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
/**
|
|
18
|
+
* A readonly identifier for the channel
|
|
19
|
+
*/
|
|
20
|
+
readonly id: string;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
readonly owner?: string;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
readonly attributes: IChannelAttributes;
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Generates summary of the channel synchronously. It is called when an `attach message`
|
|
28
|
+
* for a local channel is generated. In other words, when the channel is being attached
|
|
29
|
+
* to make it visible to other clients.
|
|
30
|
+
* Note: Since Attach Summary is generated for local channels when making them visible to
|
|
31
|
+
* remote clients, they don't have any previous summaries to compare against. For this reason,
|
|
32
|
+
* The attach summary cannot contain summary handles (paths to sub-trees or blobs).
|
|
33
|
+
* It can, however, contain ISummaryAttachment (handles to blobs uploaded async via the blob manager).
|
|
34
|
+
* @param fullTree - flag indicating whether the attempt should generate a full
|
|
35
|
+
* summary tree without any handles for unchanged subtrees.
|
|
36
|
+
* @param trackState - optimization for tracking state of objects across summaries. If the state
|
|
37
|
+
* of an object did not change since last successful summary, an ISummaryHandle can be used
|
|
38
|
+
* instead of re-summarizing it. If this is false, the expectation is that you should never
|
|
39
|
+
* send an ISummaryHandle since you are not expected to track state.
|
|
40
|
+
* Note: The goal is to remove the trackState and automatically decided whether the
|
|
41
|
+
* handles will be used or not: https://github.com/microsoft/FluidFramework/issues/10455
|
|
42
|
+
* @returns A summary capturing the current state of the channel.
|
|
43
|
+
*/
|
|
44
|
+
getAttachSummary(
|
|
45
|
+
fullTree?: boolean,
|
|
46
|
+
trackState?: boolean,
|
|
47
|
+
telemetryContext?: ITelemetryContext,
|
|
48
|
+
): ISummaryTreeWithStats;
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Generates summary of the channel asynchronously.
|
|
52
|
+
* This should not be called where the channel can be modified while summarization is in progress.
|
|
53
|
+
* @param fullTree - flag indicating whether the attempt should generate a full
|
|
54
|
+
* summary tree without any handles for unchanged subtrees. It is only set to true when generating
|
|
55
|
+
* a summary from the entire container.
|
|
56
|
+
* @param trackState - This tells whether we should track state from this summary.
|
|
57
|
+
* @returns A summary capturing the current state of the channel.
|
|
58
|
+
*/
|
|
59
|
+
summarize(
|
|
60
|
+
fullTree?: boolean,
|
|
61
|
+
trackState?: boolean,
|
|
62
|
+
telemetryContext?: ITelemetryContext,
|
|
63
|
+
): Promise<ISummaryTreeWithStats>;
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Checks if the channel is attached to storage.
|
|
67
|
+
* @returns True iff the channel is attached.
|
|
68
|
+
*/
|
|
69
|
+
isAttached(): boolean;
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Enables the channel to send and receive ops.
|
|
73
|
+
* @param services - Services to connect to
|
|
74
|
+
*/
|
|
75
|
+
connect(services: IChannelServices): void;
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Returns the GC data for this channel. It contains a list of GC nodes that contains references to
|
|
79
|
+
* other GC nodes.
|
|
80
|
+
* @param fullGC - true to bypass optimizations and force full generation of GC data.
|
|
81
|
+
*/
|
|
82
|
+
getGCData(fullGC?: boolean): IGarbageCollectionData;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
86
|
* Handler provided by shared data structure to process requests from the runtime.
|
|
87
87
|
*/
|
|
88
88
|
export interface IDeltaHandler {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Processes the op.
|
|
91
|
+
* @param message - The message to process
|
|
92
|
+
* @param local - Whether the message originated from the local client
|
|
93
|
+
* @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
|
|
94
|
+
* For messages from a remote client, this will be undefined.
|
|
95
|
+
*/
|
|
96
|
+
process: (message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) => void;
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
/**
|
|
99
|
+
* State change events to indicate changes to the delta connection
|
|
100
|
+
* @param connected - true if connected, false otherwise
|
|
101
|
+
*/
|
|
102
|
+
setConnectionState(connected: boolean): void;
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Called when the runtime asks the client to resubmit an op. This may be because the Container reconnected and
|
|
106
|
+
* this op was not acked.
|
|
107
|
+
* The client can choose to resubmit the same message, submit different / multiple messages or not submit anything
|
|
108
|
+
* at all.
|
|
109
|
+
* @param message - The original message that was submitted.
|
|
110
|
+
* @param localOpMetadata - The local metadata associated with the original message.
|
|
111
|
+
*/
|
|
112
|
+
reSubmit(message: any, localOpMetadata: unknown): void;
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Apply changes from an op. Used when rehydrating an attached container
|
|
116
|
+
* with pending changes. This prepares the SharedObject for seeing an ACK
|
|
117
|
+
* for the op or resubmitting the op upon reconnection.
|
|
118
|
+
* @param message - Contents of a stashed op.
|
|
119
|
+
* @returns localMetadata of the op, to be passed to process() or resubmit()
|
|
120
|
+
* when the op is ACKed or resubmitted, respectively
|
|
121
|
+
*/
|
|
122
|
+
applyStashedOp(message: any): unknown;
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Revert a local op.
|
|
126
|
+
* @param message - The original message that was submitted.
|
|
127
|
+
* @param localOpMetadata - The local metadata associated with the original message.
|
|
128
|
+
*/
|
|
129
|
+
rollback?(message: any, localOpMetadata: unknown): void;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* Interface to represent a connection to a delta notification stream.
|
|
134
134
|
*/
|
|
135
135
|
export interface IDeltaConnection {
|
|
136
|
-
|
|
136
|
+
connected: boolean;
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Send new messages to the server.
|
|
140
|
+
* @param messageContent - The content of the message to be sent.
|
|
141
|
+
* @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime
|
|
142
|
+
* and not sent to the server. It will be provided back when this message is acknowledged by the server. It will
|
|
143
|
+
* also be provided back when asked to resubmit the message.
|
|
144
|
+
*/
|
|
145
|
+
submit(messageContent: any, localOpMetadata: unknown): void;
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Attaches a message handler to the delta connection
|
|
149
|
+
*/
|
|
150
|
+
attach(handler: IDeltaHandler): void;
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Indicates that the channel is dirty and needs to be part of the summary. It is called by a SharedSummaryBlock
|
|
154
|
+
* that needs to be part of the summary but does not generate ops.
|
|
155
|
+
*/
|
|
156
|
+
dirty(): void;
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
160
|
+
* all references added in the system.
|
|
161
|
+
* @param srcHandle - The handle of the node that added the reference.
|
|
162
|
+
* @param outboundHandle - The handle of the outbound node that is referenced.
|
|
163
|
+
*/
|
|
164
|
+
addedGCOutboundReference?(srcHandle: IFluidHandle, outboundHandle: IFluidHandle): void;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* Storage services to read the objects at a given path.
|
|
169
169
|
*/
|
|
170
170
|
export interface IChannelStorageService {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
/**
|
|
172
|
+
* Reads the object contained at the given path. Returns a buffer representation for the object.
|
|
173
|
+
*/
|
|
174
|
+
readBlob(path: string): Promise<ArrayBufferLike>;
|
|
175
175
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Determines if there is an object contained at the given path.
|
|
178
|
+
*/
|
|
179
|
+
contains(path: string): Promise<boolean>;
|
|
180
180
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
/**
|
|
182
|
+
* Lists the blobs that exist at a specific path.
|
|
183
|
+
*/
|
|
184
|
+
list(path: string): Promise<string[]>;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
188
|
* Storage services to read the objects at a given path using the given delta connection.
|
|
189
189
|
*/
|
|
190
190
|
export interface IChannelServices {
|
|
191
|
-
|
|
191
|
+
deltaConnection: IDeltaConnection;
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
objectStorage: IChannelStorageService;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
/**
|
|
@@ -210,48 +210,48 @@ export interface IChannelServices {
|
|
|
210
210
|
* @remarks Factories follow a common model but enable custom behavior.
|
|
211
211
|
*/
|
|
212
212
|
export interface IChannelFactory {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
/**
|
|
214
|
+
* String representing the type of the factory.
|
|
215
|
+
*/
|
|
216
|
+
readonly type: string;
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
218
|
+
/**
|
|
219
|
+
* Attributes of the channel.
|
|
220
|
+
*/
|
|
221
|
+
readonly attributes: IChannelAttributes;
|
|
222
222
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
223
|
+
/**
|
|
224
|
+
* Loads the given channel. This call is only ever invoked internally as the only thing
|
|
225
|
+
* that is ever directly loaded is the document itself. Load will then only be called on documents that
|
|
226
|
+
* were created and added to a channel.
|
|
227
|
+
* @param runtime - Data store runtime containing state/info/helper methods about the data store.
|
|
228
|
+
* @param id - ID of the channel.
|
|
229
|
+
* @param services - Services to read objects at a given path using the delta connection.
|
|
230
|
+
* @param channelAttributes - The attributes for the the channel to be loaded.
|
|
231
|
+
* @returns The loaded object
|
|
232
|
+
*
|
|
233
|
+
* @privateRemarks
|
|
234
|
+
* Thought: should the storage object include the version information and limit access to just files
|
|
235
|
+
* for the given object? The latter seems good in general. But both are probably good things. We then just
|
|
236
|
+
* need a way to allow the document to provide later storage for the object.
|
|
237
|
+
*/
|
|
238
|
+
load(
|
|
239
|
+
runtime: IFluidDataStoreRuntime,
|
|
240
|
+
id: string,
|
|
241
|
+
services: IChannelServices,
|
|
242
|
+
channelAttributes: Readonly<IChannelAttributes>,
|
|
243
|
+
): Promise<IChannel>;
|
|
244
244
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
245
|
+
/**
|
|
246
|
+
* Creates a local version of the channel.
|
|
247
|
+
* Calling attach on the object later will insert it into the object stream.
|
|
248
|
+
* @param runtime - The runtime the new object will be associated with
|
|
249
|
+
* @param id - The unique ID of the new object
|
|
250
|
+
* @returns The newly created object.
|
|
251
|
+
*
|
|
252
|
+
* @privateRemarks
|
|
253
|
+
* NOTE here - When we attach we need to submit all the pending ops prior to actually doing the attach
|
|
254
|
+
* for consistency.
|
|
255
|
+
*/
|
|
256
|
+
create(runtime: IFluidDataStoreRuntime, id: string): IChannel;
|
|
257
257
|
}
|
package/src/dataStoreRuntime.ts
CHANGED
|
@@ -3,134 +3,138 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IDisposable, IEvent, IEventProvider, ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
7
6
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
IDisposable,
|
|
8
|
+
IEvent,
|
|
9
|
+
IEventProvider,
|
|
10
|
+
ITelemetryLogger,
|
|
11
|
+
} from "@fluidframework/common-definitions";
|
|
12
|
+
import {
|
|
13
|
+
IFluidHandleContext,
|
|
14
|
+
IFluidRouter,
|
|
15
|
+
IFluidHandle,
|
|
16
|
+
FluidObject,
|
|
12
17
|
} from "@fluidframework/core-interfaces";
|
|
13
18
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
IAudience,
|
|
20
|
+
IDeltaManager,
|
|
21
|
+
AttachState,
|
|
22
|
+
ILoaderOptions,
|
|
18
23
|
} from "@fluidframework/container-definitions";
|
|
19
24
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
IDocumentMessage,
|
|
26
|
+
IQuorumClients,
|
|
27
|
+
ISequencedDocumentMessage,
|
|
23
28
|
} from "@fluidframework/protocol-definitions";
|
|
24
29
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
IInboundSignalMessage,
|
|
31
|
+
IProvideFluidDataStoreRegistry,
|
|
27
32
|
} from "@fluidframework/runtime-definitions";
|
|
28
33
|
import { IChannel } from ".";
|
|
29
34
|
|
|
30
35
|
export interface IFluidDataStoreRuntimeEvents extends IEvent {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
(event: "disconnected" | "dispose" | "attaching" | "attached", listener: () => void);
|
|
37
|
+
(event: "op", listener: (message: ISequencedDocumentMessage) => void);
|
|
38
|
+
(event: "signal", listener: (message: IInboundSignalMessage, local: boolean) => void);
|
|
39
|
+
(event: "connected", listener: (clientId: string) => void);
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
/**
|
|
38
43
|
* Represents the runtime for the data store. Contains helper functions/state of the data store.
|
|
39
44
|
*/
|
|
40
|
-
export interface IFluidDataStoreRuntime
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
readonly entryPoint?: IFluidHandle<FluidObject>;
|
|
45
|
+
export interface IFluidDataStoreRuntime
|
|
46
|
+
extends IFluidRouter,
|
|
47
|
+
IEventProvider<IFluidDataStoreRuntimeEvents>,
|
|
48
|
+
IDisposable,
|
|
49
|
+
Partial<IProvideFluidDataStoreRegistry> {
|
|
50
|
+
readonly id: string;
|
|
51
|
+
|
|
52
|
+
readonly IFluidHandleContext: IFluidHandleContext;
|
|
53
|
+
|
|
54
|
+
readonly rootRoutingContext: IFluidHandleContext;
|
|
55
|
+
readonly channelsRoutingContext: IFluidHandleContext;
|
|
56
|
+
readonly objectsRoutingContext: IFluidHandleContext;
|
|
57
|
+
|
|
58
|
+
readonly options: ILoaderOptions;
|
|
59
|
+
|
|
60
|
+
readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
|
|
61
|
+
|
|
62
|
+
readonly clientId: string | undefined;
|
|
63
|
+
|
|
64
|
+
readonly connected: boolean;
|
|
65
|
+
|
|
66
|
+
readonly logger: ITelemetryLogger;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Indicates the attachment state of the data store to a host service.
|
|
70
|
+
*/
|
|
71
|
+
readonly attachState: AttachState;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Returns the channel with the given id
|
|
75
|
+
*/
|
|
76
|
+
getChannel(id: string): Promise<IChannel>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Invokes the given callback and expects that no ops are submitted
|
|
80
|
+
* until execution finishes. If an op is submitted, an error will be raised.
|
|
81
|
+
*
|
|
82
|
+
* Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`
|
|
83
|
+
*
|
|
84
|
+
* @param callback - the callback to be invoked
|
|
85
|
+
*/
|
|
86
|
+
ensureNoDataModelChanges<T>(callback: () => T): T;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Creates a new channel of the given type.
|
|
90
|
+
* @param id - ID of the channel to be created. A unique ID will be generated if left undefined.
|
|
91
|
+
* @param type - Type of the channel.
|
|
92
|
+
*/
|
|
93
|
+
createChannel(id: string | undefined, type: string): IChannel;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Bind the channel with the data store runtime. If the runtime
|
|
97
|
+
* is attached then we attach the channel to make it live.
|
|
98
|
+
*/
|
|
99
|
+
bindChannel(channel: IChannel): void;
|
|
100
|
+
|
|
101
|
+
// Blob related calls
|
|
102
|
+
/**
|
|
103
|
+
* Api to upload a blob of data.
|
|
104
|
+
* @param blob - blob to be uploaded.
|
|
105
|
+
*/
|
|
106
|
+
uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Submits the signal to be sent to other clients.
|
|
110
|
+
* @param type - Type of the signal.
|
|
111
|
+
* @param content - Content of the signal.
|
|
112
|
+
*/
|
|
113
|
+
submitSignal(type: string, content: any): void;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Returns the current quorum.
|
|
117
|
+
*/
|
|
118
|
+
getQuorum(): IQuorumClients;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Returns the current audience.
|
|
122
|
+
*/
|
|
123
|
+
getAudience(): IAudience;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Resolves when a local data store is attached.
|
|
127
|
+
*/
|
|
128
|
+
waitAttached(): Promise<void>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Exposes a handle to the root object / entryPoint of the data store. Use this as the primary way of interacting
|
|
132
|
+
* with it. If this property is undefined (meaning that exposing the entryPoint hasn't been implemented in a
|
|
133
|
+
* particular scenario) fall back to the current approach of requesting the root object through the request pattern.
|
|
134
|
+
*
|
|
135
|
+
* @remarks The plan is that eventually the data store will stop providing IFluidRouter functionality, this property
|
|
136
|
+
* will become non-optional and return an IFluidHandle (no undefined) and will become the only way to access
|
|
137
|
+
* the data store's entryPoint.
|
|
138
|
+
*/
|
|
139
|
+
readonly entryPoint?: IFluidHandle<FluidObject>;
|
|
136
140
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* This library defines the interfaces required to implement and/or communicate
|
|
8
|
-
* with a data store.
|
|
9
|
-
*
|
|
10
|
-
* @packageDocumentation
|
|
11
|
-
*/
|
|
7
|
+
* This library defines the interfaces required to implement and/or communicate
|
|
8
|
+
* with a data store.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
12
|
|
|
13
13
|
export {
|
|
14
14
|
IChannel,
|
package/src/jsonable.ts
CHANGED
|
@@ -41,14 +41,17 @@
|
|
|
41
41
|
* function foo<T>(value: Jsonable<T>) { ... }
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
|
-
export type Jsonable<T = any, TReplaced = void> =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
export type Jsonable<T = any, TReplaced = void> = T extends
|
|
45
|
+
| undefined
|
|
46
|
+
| null
|
|
47
|
+
| boolean
|
|
48
|
+
| number
|
|
49
|
+
| string
|
|
50
|
+
| TReplaced
|
|
51
|
+
? T
|
|
52
|
+
: // eslint-disable-next-line @typescript-eslint/ban-types
|
|
53
|
+
Extract<T, Function> extends never
|
|
54
|
+
? {
|
|
55
|
+
[K in keyof T]: Extract<K, symbol> extends never ? Jsonable<T[K], TReplaced> : never;
|
|
56
|
+
}
|
|
57
|
+
: never;
|
package/src/storage.ts
CHANGED
|
@@ -7,19 +7,19 @@
|
|
|
7
7
|
* Represents the attributes of a channel/DDS.
|
|
8
8
|
*/
|
|
9
9
|
export interface IChannelAttributes {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Type name of the DDS for factory look up with ISharedObjectRegistry
|
|
12
|
+
*/
|
|
13
|
+
readonly type: string;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Format version of the snapshot
|
|
17
|
+
* Currently, only use to display a debug message if the version is incompatible
|
|
18
|
+
*/
|
|
19
|
+
readonly snapshotFormatVersion: string;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The package version of the code of the DDS, for debug only
|
|
23
|
+
*/
|
|
24
|
+
readonly packageVersion?: string;
|
|
25
25
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"src/**/*"
|
|
13
|
-
]
|
|
2
|
+
"extends": "@fluidframework/build-common/ts-common-config.json",
|
|
3
|
+
"exclude": ["src/test/**/*"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"composite": true,
|
|
8
|
+
},
|
|
9
|
+
"include": ["src/**/*"],
|
|
14
10
|
}
|