Skip to main content

ServiceClient Interface

A connection to a Fluid storage service.

This API is provided as an alpha preview and may change without notice.

To use, import via fluid-framework/alpha.

For more information about our API support guarantees, see here.

Sealed

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

MethodAlertsReturn TypeDescription
createAttachedContainer(root)AlphaPromise<FluidContainerAttached<T>>A shorthand for createContainer(root) followed by attach().
createAttachedContainer(root, registry)AlphaPromise<FluidContainerAttached<T>>A shorthand for createContainer(root, registry) followed by attach().
createContainer(root)AlphaPromise<FluidContainerWithService<T>>Creates a detached container associated with this service client.
createContainer(root, registry)AlphaPromise<FluidContainerWithService<T>>Creates a detached container associated with this service client.
loadContainer(id, root)AlphaPromise<FluidContainerAttached<T>>Loads an existing container from the service.

Method Details

createAttachedContainer

A shorthand for createContainer(root) followed by attach().

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

createAttachedContainer<T>(root: DataStoreKind<T>): Promise<FluidContainerAttached<T>>;
Type Parameters
ParameterDescription
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

ParameterTypeDescription
rootDataStoreKind<T>

Returns

Return type: Promise<FluidContainerAttached<T>>

createAttachedContainer

A shorthand for createContainer(root, registry) followed by attach().

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

createAttachedContainer<T>(root: DataStoreKey<T>, registry: DataStoreRegistry): Promise<FluidContainerAttached<T>>;
Type Parameters
ParameterDescription
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

ParameterTypeDescription
rootDataStoreKey<T>
registryDataStoreRegistry

Returns

Return type: Promise<FluidContainerAttached<T>>

createContainer

Creates a detached container associated with this service client.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

createContainer<T>(root: DataStoreKind<T>): Promise<FluidContainerWithService<T>>;
Type Parameters
ParameterDescription
TThe 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

ParameterTypeDescription
rootDataStoreKind<T>A DataStoreKind to use for the root.

Returns

Return type: Promise<FluidContainerWithService<T>>

createContainer

Creates a detached container associated with this service client.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

createContainer<T>(root: DataStoreKey<T>, registry: DataStoreRegistry): Promise<FluidContainerWithService<T>>;
Type Parameters
ParameterDescription
TThe 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

ParameterTypeDescription
rootDataStoreKey<T>A DataStoreKey used to look up the root's DataStoreKind from registry.
registryDataStoreRegistryThe 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.

This API is provided as an alpha preview and may change without notice.

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
ParameterDescription
TThe type of the container's root data store.

Parameters

ParameterTypeDescription
idstringThe unique identifier of the container to load.
rootDataStoreKind<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.