ShardMapManager Class
- java.
lang. Object - com.
microsoft. azure. elasticdb. shard. mapmanager. ShardMapManager
- com.
public class ShardMapManager
Serves as the entry point for creation, management and lookup operations over shard maps.
Field Summary
Modifier and Type | Field and Description |
---|---|
Event<EventHandler<Retrying |
shardMapManagerRetrying
Event to be raised on Shard Map Manager store retries. |
Constructor Summary
Constructor | Description |
---|---|
ShardMapManager(SqlShardMapManagerCredentials credentials, IStoreConnectionFactory storeConnectionFactory, IStoreOperationFactory storeOperationFactory, ICacheStore cacheStore, ShardMapManagerLoadPolicy loadPolicy, RetryPolicy retryPolicy, RetryBehavior retryBehavior) |
Given the connection string, opens up the corresponding data source and obtains the ShardMapManager. |
ShardMapManager(SqlShardMapManagerCredentials credentials, IStoreConnectionFactory storeConnectionFactory, IStoreOperationFactory storeOperationFactory, ICacheStore cacheStore, ShardMapManagerLoadPolicy loadPolicy, RetryPolicy retryPolicy, RetryBehavior retryBehavior, EventHandler<RetryingEventArgs> retryEventHandler) |
Given the connection string, opens up the corresponding data source and obtains the ShardMapManager. |
Method Summary
Modifier and Type | Method and Description |
---|---|
<KeyT> List |
createListShardMap(String shardMapName, ShardKeyType keyType)
Creates a list based ListShardMap<KeyT>. |
<KeyT> Range |
createRangeShardMap(String shardMapName, ShardKeyType keyType)
Create a range based RangeShardMap<KeyT>. |
void |
deleteShardMap(ShardMap shardMap)
Removes the specified shard map. |
ICacheStore | getCache() |
SqlShardMapManagerCredentials | getCredentials() |
List<Shard |
getDistinctShardLocations()
Obtains distinct shard locations from the shard map manager. |
<KeyT> List |
getListShardMap(String shardMapName, ShardKeyType keyType)
Obtains a ListShardMap<KeyT> given the name. |
<KeyT> Range |
getRangeShardMap(String shardMapName, ShardKeyType keyType)
Obtains a RangeShardMap<KeyT> given the name. |
Recovery |
getRecoveryManager()
Obtains the recovery manager for the current shard map manager instance. |
Retry |
getRetryPolicy() |
Schema |
getSchemaInfoCollection()
Obtains the schema info collection object for the current shard map manager instance. |
Shard |
getShardMap(String shardMapName)
Obtains a ShardMap given the name. |
List<Shard |
getShardMaps()
Obtains all shard maps associated with the shard map manager. |
IStore |
getStoreConnectionFactory() |
IStoreOperationFactory | getStoreOperationFactory() |
Shard |
lookupShardMapByName(String operationName, String shardMapName, boolean lookInCacheFirst)
Finds a shard map from cache if requested and if necessary from global shard map. |
void |
onShardMapManagerRetryingEvent(RetryingEventArgs arg)
Publisher for ShardMapManagerRetryingEvent event. |
void |
shardMapManagerRetryingEventHandler(Object sender, RetryingEventArgs arg)
Subscriber function to RetryPolicy.retrying event. |
<KeyT> boolean |
tryGetListShardMap(String shardMapName, ShardKeyType keyType, ReferenceObjectHelper<ListShardMap<KeyT>> shardMap)
Tries to obtains a ListShardMap<KeyT> given the name. |
<KeyT> boolean |
tryGetRangeShardMap(String shardMapName, ShardKeyType keyType, ReferenceObjectHelper<RangeShardMap<KeyT>> shardMap)
Tries to obtains a RangeShardMap<KeyT> given the name. |
boolean |
tryGetShardMap(String shardMapName, ShardKeyType keyType, ReferenceObjectHelper<ShardMap> shardMap)
Tries to obtains a ShardMap given the name. |
void |
upgradeGlobalStore()
Upgrades store hosting global shard map to the latest version supported by library. |
void |
upgradeGlobalStore(Version targetVersion)
Upgrades store hosting global shard map to specified version. This will be used for upgrade testing. |
void |
upgradeLocalStore(ShardLocation location)
Upgrades store location to the latest version supported by library. |
void |
upgradeLocalStore(ShardLocation location, Version targetVersion)
Upgrades store location to the specified version. This will be used for upgrade testing. |
Field Details
shardMapManagerRetrying
public Event
Event to be raised on Shard Map Manager store retries.
Constructor Details
ShardMapManager
public ShardMapManager(SqlShardMapManagerCredentials credentials, IStoreConnectionFactory storeConnectionFactory, IStoreOperationFactory storeOperationFactory, ICacheStore cacheStore, ShardMapManagerLoadPolicy loadPolicy, RetryPolicy retryPolicy, RetryBehavior retryBehavior)
Given the connection string, opens up the corresponding data source and obtains the ShardMapManager.
Parameters:
ShardMapManager
public ShardMapManager(SqlShardMapManagerCredentials credentials, IStoreConnectionFactory storeConnectionFactory, IStoreOperationFactory storeOperationFactory, ICacheStore cacheStore, ShardMapManagerLoadPolicy loadPolicy, RetryPolicy retryPolicy, RetryBehavior retryBehavior, EventHandler
Given the connection string, opens up the corresponding data source and obtains the ShardMapManager.
Parameters:
Method Details
createListShardMap
public
Creates a list based ListShardMap<KeyT>.
Parameters:
Returns:
createRangeShardMap
public
Create a range based RangeShardMap<KeyT>.
Parameters:
Returns:
deleteShardMap
public void deleteShardMap(ShardMap shardMap)
Removes the specified shard map.
Parameters:
getCache
public ICacheStore getCache()
getCredentials
public SqlShardMapManagerCredentials getCredentials()
getDistinctShardLocations
public List
Obtains distinct shard locations from the shard map manager.
Returns:
getListShardMap
public
Obtains a ListShardMap<KeyT> given the name.
Parameters:
Returns:
getRangeShardMap
public
Obtains a RangeShardMap<KeyT> given the name.
Parameters:
Returns:
getRecoveryManager
public RecoveryManager getRecoveryManager()
Obtains the recovery manager for the current shard map manager instance.
Returns:
getRetryPolicy
public RetryPolicy getRetryPolicy()
getSchemaInfoCollection
public SchemaInfoCollection getSchemaInfoCollection()
Obtains the schema info collection object for the current shard map manager instance.
Returns:
getShardMap
public ShardMap getShardMap(String shardMapName)
Obtains a ShardMap given the name.
Parameters:
Returns:
getShardMaps
public List
Obtains all shard maps associated with the shard map manager.
Returns:
getStoreConnectionFactory
public IStoreConnectionFactory getStoreConnectionFactory()
getStoreOperationFactory
public IStoreOperationFactory getStoreOperationFactory()
lookupShardMapByName
public ShardMap lookupShardMapByName(String operationName, String shardMapName, boolean lookInCacheFirst)
Finds a shard map from cache if requested and if necessary from global shard map.
Parameters:
Returns:
onShardMapManagerRetryingEvent
public void onShardMapManagerRetryingEvent(RetryingEventArgs arg)
Publisher for ShardMapManagerRetryingEvent event.
Parameters:
shardMapManagerRetryingEventHandler
public void shardMapManagerRetryingEventHandler(Object sender, RetryingEventArgs arg)
Subscriber function to RetryPolicy.retrying event.
Parameters:
tryGetListShardMap
public
Tries to obtains a ListShardMap<KeyT> given the name.
Parameters:
Returns:
tryGetRangeShardMap
public
Tries to obtains a RangeShardMap<KeyT> given the name.
Parameters:
Returns:
tryGetShardMap
public boolean tryGetShardMap(String shardMapName, ShardKeyType keyType, ReferenceObjectHelper
Tries to obtains a ShardMap given the name.
Parameters:
Returns:
true
if shard map with the specified name was found, false
otherwise.
upgradeGlobalStore
public void upgradeGlobalStore()
Upgrades store hosting global shard map to the latest version supported by library.
upgradeGlobalStore
public void upgradeGlobalStore(Version targetVersion)
Upgrades store hosting global shard map to specified version. This will be used for upgrade testing.
Parameters:
upgradeLocalStore
public void upgradeLocalStore(ShardLocation location)
Upgrades store location to the latest version supported by library.
Parameters:
upgradeLocalStore
public void upgradeLocalStore(ShardLocation location, Version targetVersion)
Upgrades store location to the specified version. This will be used for upgrade testing.
Parameters: