ServiceClient Interface
A connection to a Fluid storage service.
To use, import via fluid-framework/alpha.
For more information about our API support guarantees, see here.
This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.
Signature
/** @sealed */
export interface ServiceClient
Methods
| Method | Alerts | Return Type | Description |
|---|---|---|---|
| createAttachedContainer(root) | Alpha | Promise<FluidContainerAttached<T>> | A shorthand for createContainer(root) followed by attach(). |
| createAttachedContainer(root, registry) | Alpha | Promise<FluidContainerAttached<T>> | A shorthand for createContainer(root, registry) followed by attach(). |
| createContainer(root) | Alpha | Promise<FluidContainerWithService<T>> | Creates a detached container associated with this service client. |
| createContainer(root, registry) | Alpha | Promise<FluidContainerWithService<T>> | Creates a detached container associated with this service client. |
| loadContainer(id, root) | Alpha | Promise<FluidContainerAttached<T>> | Loads an existing container from the service. |
Method Details
createAttachedContainer
A shorthand for createContainer(root) followed by attach().
For more information about our API support guarantees, see here.
Signature
createAttachedContainer<T>(root: DataStoreKind<T>): Promise<FluidContainerAttached<T>>;
Type Parameters
| Parameter | Description |
|---|---|
| T |
Remarks
Due to current implementation limitations making container creation async and service specific, creating then attaching one is a bit verbose with two awaits that are messy to include inline. This provides a convenient way to create and attach a container in a single step.
Parameters
| Parameter | Type | Description |
|---|---|---|
| root | DataStoreKind<T> |
Returns
Return type: Promise<FluidContainerAttached<T>>
createAttachedContainer
A shorthand for createContainer(root, registry) followed by attach().
For more information about our API support guarantees, see here.
Signature
createAttachedContainer<T>(root: DataStoreKey<T>, registry: DataStoreRegistry): Promise<FluidContainerAttached<T>>;
Type Parameters
| Parameter | Description |
|---|---|
| T |
Remarks
Due to current implementation limitations making container creation async and service specific, creating then attaching one is a bit verbose with two awaits that are messy to include inline. This provides a convenient way to create and attach a container in a single step.
Parameters
| Parameter | Type | Description |
|---|---|---|
| root | DataStoreKey<T> | |
| registry | DataStoreRegistry |
Returns
Return type: Promise<FluidContainerAttached<T>>
createContainer
Creates a detached container associated with this service client.
For more information about our API support guarantees, see here.
Signature
createContainer<T>(root: DataStoreKind<T>): Promise<FluidContainerWithService<T>>;
Type Parameters
| Parameter | Description |
|---|---|
| T | The type of the container's root data store, as defined by root. |
Remarks
This overload is a shorthand for a simple case of createContainer(root, registry) where a single item registry is produced which contains only the root. This is usable only when the root DataStoreKind is available eagerly (e.g. not lazy loaded), and when the container does not need a registry for creating additional data stores beyond the root.
Parameters
| Parameter | Type | Description |
|---|---|---|
| root | DataStoreKind<T> | A DataStoreKind to use for the root. |
Returns
Return type: Promise<FluidContainerWithService<T>>
createContainer
Creates a detached container associated with this service client.
For more information about our API support guarantees, see here.
Signature
createContainer<T>(root: DataStoreKey<T>, registry: DataStoreRegistry): Promise<FluidContainerWithService<T>>;
Type Parameters
| Parameter | Description |
|---|---|
| T | The type of the container's root data store, as defined by root. |
Remarks
Use this overload when the root DataStoreKind is not available eagerly (e.g. for lazy loading), or when the container needs a registry for creating additional data stores beyond the root.
Parameters
| Parameter | Type | Description |
|---|---|---|
| root | DataStoreKey<T> | A DataStoreKey used to look up the root's DataStoreKind from registry. |
| registry | DataStoreRegistry | The DataStoreRegistry supplying the DataStoreKind for the root and any other data stores the container may need to create. |
Returns
Return type: Promise<FluidContainerWithService<T>>
loadContainer
Loads an existing container from the service.
For more information about our API support guarantees, see here.
Signature
loadContainer<T>(id: string, root: DataStoreKind<T> | DataStoreRegistry<T>): Promise<FluidContainerAttached<T>>;
Type Parameters
| Parameter | Description |
|---|---|
| T | The type of the container's root data store. |
Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | The unique identifier of the container to load. |
| root | DataStoreKind<T> | DataStoreRegistry<T> | The DataStoreKind for the root, or a registry which will be used to look up the root based on its type. |
Returns
Return type: Promise<FluidContainerAttached<T>>
Error Handling
a @fluidframework/telemetry-utils#UsageError if the DataStoreKind's type (either the root directly or looked up from the registry) does not match the type of the root data store in the container.