Edit

Share via


ShardedStorageProvider Class

Definition

Simple storage provider for writing grain state data shared across a number of other storage providers.

public class ShardedStorageProvider : Orleans.Storage.IStorageProvider
type ShardedStorageProvider = class
    interface IStorageProvider
    interface IProvider
Public Class ShardedStorageProvider
Implements IStorageProvider
Inheritance
ShardedStorageProvider
Implements

Examples

Example configuration for this storage provider in OrleansConfiguration.xml file:

<OrleansConfiguration xmlns="urn:orleans">
  <Globals>
    <StorageProviders>
      <Provider Type="Orleans.Storage.AzureTableStorage" Name="AzureStore1" DataConnectionString="..." />
      <Provider Type="Orleans.Storage.AzureTableStorage" Name="AzureStore2" DataConnectionString="..." />
      <Provider Type="Orleans.Storage.ShardedStorageProvider" Name="ShardedAzureStore">
        <Provider Name="AzureStore1"/>
        <Provider Name="AzureStore2"/>
      </Provider>
    </StorageProviders>

Remarks

Required nested configuration elements: Provider -- References by-name to other provider instances defined elsewheer in thios configuration file.

A consistent hash functions (default is Jenkins Hash) is used to decide which shard (in the order they are defined in the config file) is responsible for storing state data for a specified grain, then the Read / Write / Clear request is bridged over to the appropriate underlying provider for execution.

See http://en.wikipedia.org/wiki/Jenkins_hash for more information about the Jenkins Hash function.

Constructors

ShardedStorageProvider()

Default constructor.

Properties

Log

Logger used by this storage provider instance.

Name

Name of this storage provider instance.

Methods

ClearStateAsync(String, GrainReference, IGrainState)

Deleet / Clear state data function for this storage provider.

Close()

Shutdown function for this storage provider.

HashFunction(String, GrainReference)

Return a hash value derived from the input grain type and id values.

Init(String, IProviderRuntime, IProviderConfiguration)

Initialization function for this storage provider.

ReadStateAsync(String, GrainReference, IGrainState)

Read state data function for this storage provider.

WriteStateAsync(String, GrainReference, IGrainState)

Write state data function for this storage provider.

Applies to