本文整理汇总了C#中ShardMapManager类的典型用法代码示例。如果您正苦于以下问题:C# ShardMapManager类的具体用法?C# ShardMapManager怎么用?C# ShardMapManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ShardMapManager类属于命名空间,在下文中一共展示了ShardMapManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckShardLocalOperation
/// <summary>
/// Constructs request for obtaining all the shard maps and shards from an LSM.
/// </summary>
/// <param name="operationName">Operation name.</param>
/// <param name="shardMapManager">Shard map manager.</param>
/// <param name="location">Location of the LSM.</param>
internal CheckShardLocalOperation(
string operationName,
ShardMapManager shardMapManager,
ShardLocation location) :
base(shardMapManager.Credentials, shardMapManager.RetryPolicy, location, operationName)
{
}
示例2: AddShardOperation
/// <summary>
/// Creates request to add shard to given shard map.
/// </summary>
/// <param name="shardMapManager">Shard map manager object.</param>
/// <param name="shardMap">Shard map for which to add shard.</param>
/// <param name="shard">Shard to add.</param>
protected internal AddShardOperation(
ShardMapManager shardMapManager,
IStoreShardMap shardMap,
IStoreShard shard) :
this(shardMapManager, Guid.NewGuid(), StoreOperationState.UndoBegin, shardMap, shard)
{
}
示例3: CreateShardMapFromStoreShardMap
/// <summary>
/// Converts IStoreShardMap to ShardMap.
/// </summary>
/// <param name="manager">Reference to shard map manager.</param>
/// <param name="ssm">Storage representation for ShardMap.</param>
/// <returns>ShardMap object corresponding to storange representation.</returns>
internal static ShardMap CreateShardMapFromStoreShardMap(
ShardMapManager manager,
IStoreShardMap ssm)
{
switch (ssm.MapType)
{
case ShardMapType.List:
// Create ListShardMap<TKey>
return (ShardMap)Activator.CreateInstance(
typeof(ListShardMap<>).MakeGenericType(
ShardKey.TypeFromShardKeyType(ssm.KeyType)),
BindingFlags.NonPublic | BindingFlags.Instance,
null,
new object[] { manager, ssm },
CultureInfo.InvariantCulture);
default:
Debug.Assert(ssm.MapType == ShardMapType.Range);
// Create RangeShardMap<TKey>
return (ShardMap)Activator.CreateInstance(
typeof(RangeShardMap<>).MakeGenericType(
ShardKey.TypeFromShardKeyType(ssm.KeyType)),
BindingFlags.NonPublic | BindingFlags.Instance,
null,
new object[] { manager, ssm },
CultureInfo.InvariantCulture);
}
}
示例4: FindShardByLocationGlobalOperation
/// <summary>
/// Constructs request to get shard with specific location for given shard map from GSM.
/// </summary>
/// <param name="shardMapManager">Shard map manager object.</param>
/// <param name="operationName">Operation name, useful for diagnostics.</param>
/// <param name="shardMap">Shard map for which shard is being requested.</param>
/// <param name="location">Location of shard being searched.</param>
internal FindShardByLocationGlobalOperation(ShardMapManager shardMapManager, string operationName, IStoreShardMap shardMap, ShardLocation location) :
base(shardMapManager.Credentials, shardMapManager.RetryPolicy, operationName)
{
_shardMapManager = shardMapManager;
_shardMap = shardMap;
_location = location;
}
示例5: ReplaceMappingsGlobalOperation
/// <summary>
/// Constructs request for replacing the GSM mappings for given shard map with the input mappings.
/// </summary>
/// <param name="shardMapManager">Shard map manager.</param>
/// <param name="operationName">Operation name.</param>
/// <param name="shardMap">GSM Shard map.</param>
/// <param name="shard">GSM Shard.</param>
/// <param name="mappingsToRemove">Optional list of mappings to remove.</param>
/// <param name="mappingsToAdd">List of mappings to add.</param>
internal ReplaceMappingsGlobalOperation(ShardMapManager shardMapManager, string operationName, IStoreShardMap shardMap, IStoreShard shard, IEnumerable<IStoreMapping> mappingsToRemove, IEnumerable<IStoreMapping> mappingsToAdd) :
base(shardMapManager.Credentials, shardMapManager.RetryPolicy, operationName)
{
_shardMap = shardMap;
_shard = shard;
_mappingsToRemove = mappingsToRemove;
_mappingsToAdd = mappingsToAdd;
}
示例6: RecoveryManager
/// <summary>
/// Constructs an instance of the recovery manager for given shard map manager.
/// </summary>
/// <param name="shardMapManager">Shard map manager being recovered.</param>
internal RecoveryManager(ShardMapManager shardMapManager)
{
Debug.Assert(shardMapManager != null);
this.Manager = shardMapManager;
this.Inconsistencies = new Dictionary<RecoveryToken, IDictionary<ShardRange, MappingDifference>>();
this.StoreShardMaps = new Dictionary<RecoveryToken, Tuple<IStoreShardMap, IStoreShard>>();
this.Locations = new Dictionary<RecoveryToken, ShardLocation>();
}
示例7: FindMappingByIdGlobalOperation
/// <summary>
/// Constructs request for obtaining mapping from GSM based on given key.
/// </summary>
/// <param name="shardMapManager">Shard map manager.</param>
/// <param name="operationName">Operation being executed.</param>
/// <param name="shardMap">Local shard map.</param>
/// <param name="mapping">Mapping whose Id will be used.</param>
/// <param name="errorCategory">Error category.</param>
internal FindMappingByIdGlobalOperation(ShardMapManager shardMapManager, string operationName, IStoreShardMap shardMap, IStoreMapping mapping, ShardManagementErrorCategory errorCategory) :
base(shardMapManager.Credentials, shardMapManager.RetryPolicy, operationName)
{
_manager = shardMapManager;
_shardMap = shardMap;
_mapping = mapping;
_errorCategory = errorCategory;
}
示例8: UpgradeStoreGlobalOperation
/// <summary>
/// Constructs request to upgrade store hosting GSM.
/// </summary>
/// <param name="shardMapManager">Shard map manager object.</param>
/// <param name="operationName">Operation name, useful for diagnostics.</param>
/// <param name="targetVersion">Target version to upgrade.</param>
internal UpgradeStoreGlobalOperation(
ShardMapManager shardMapManager,
string operationName,
Version targetVersion) :
base(shardMapManager.Credentials, shardMapManager.RetryPolicy, operationName)
{
_targetVersion = targetVersion;
}
示例9: GetShardsGlobalOperation
/// <summary>
/// Constructs request to get all shards for given shard map from GSM.
/// </summary>
/// <param name="operationName">Operation name, useful for diagnostics.</param>
/// <param name="shardMapManager">Shard map manager object.</param>
/// <param name="shardMap">Shard map for which shards are being requested.</param>
internal GetShardsGlobalOperation(
string operationName,
ShardMapManager shardMapManager,
IStoreShardMap shardMap) :
base(shardMapManager.Credentials, shardMapManager.RetryPolicy, operationName)
{
_shardMapManager = shardMapManager;
_shardMap = shardMap;
}
示例10: CreateShardMapManager
private bool CreateShardMapManager()
{
try
{
ShardMapManager = ShardMapManagerFactory.CreateSqlShardMapManager(connectionString);
return true;
}
catch { ShardMapManager = null; return false; }
}
示例11: HorizontalShard
public HorizontalShard(string _mapManagerServer, string _userID, string _password, string _mapManagerName, string _secondaryDR)
{
connectionString = string.Format("Data Source={0};Initial Catalog={3};Integrated Security=False;User ID={1};Password={2};Encrypt=True",
_mapManagerServer, _userID, _password, _mapManagerName);
shardConnectionString = string.Format("Integrated Security=False;User ID={0};Password={1};Encrypt=True", _userID, _password);
mapManagerName = _mapManagerName;
if (!ShardMapManagerFactory.TryGetSqlShardMapManager(connectionString, ShardMapManagerLoadPolicy.Lazy, out ShardMapManager))
ShardMapManager = null;
}
示例12: GetMappingsByRangeGlobalOperation
/// <summary>
/// Constructs request for obtaining all the mappings from GSM based on given shard and mappings.
/// </summary>
/// <param name="shardMapManager">Shard map manager.</param>
/// <param name="operationName">Operation being executed.</param>
/// <param name="shardMap">Local shard map.</param>
/// <param name="shard">Local shard.</param>
/// <param name="range">Optional range to get mappings from.</param>
/// <param name="errorCategory">Error category.</param>
/// <param name="cacheResults">Whether to cache the results of the operation.</param>
/// <param name="ignoreFailure">Ignore shard map not found error.</param>
internal GetMappingsByRangeGlobalOperation(ShardMapManager shardMapManager, string operationName, IStoreShardMap shardMap, IStoreShard shard, ShardRange range, ShardManagementErrorCategory errorCategory, bool cacheResults, bool ignoreFailure) :
base(shardMapManager.Credentials, shardMapManager.RetryPolicy, operationName)
{
_manager = shardMapManager;
_shardMap = shardMap;
_shard = shard;
_range = range;
_errorCategory = errorCategory;
_cacheResults = cacheResults;
_ignoreFailure = ignoreFailure;
}
示例13: CreateDetachShardGlobalOperation
/// <summary>
/// Constructs request for Detaching the given shard and mapping information to the GSM database.
/// </summary>
/// <param name="shardMapManager">Shard map manager object.</param>
/// <param name="operationName">Operation name.</param>
/// <param name="location">Location to be detached.</param>
/// <param name="shardMapName">Shard map from which shard is being detached.</param>
/// <returns>The store operation.</returns>
public virtual IStoreOperationGlobal CreateDetachShardGlobalOperation(
ShardMapManager shardMapManager,
string operationName,
ShardLocation location,
string shardMapName)
{
return new DetachShardGlobalOperation(
shardMapManager,
operationName,
location,
shardMapName);
}
示例14: LockOrUnLockMappingsGlobalOperation
/// <summary>
/// Constructs request to lock or unlock given mappings in GSM.
/// </summary>
/// <param name="shardMapManager">Shard map manager object.</param>
/// <param name="operationName">Operation name, useful for diagnostics.</param>
/// <param name="shardMap">Shard map to add.</param>
/// <param name="mapping">Mapping to lock or unlock. Null means all mappings.</param>
/// <param name="lockOwnerId">Lock owner.</param>
/// <param name="lockOpType">Lock operation type.</param>
/// <param name="errorCategory">Error category.</param>
internal LockOrUnLockMappingsGlobalOperation(ShardMapManager shardMapManager, string operationName, IStoreShardMap shardMap, IStoreMapping mapping, Guid lockOwnerId, LockOwnerIdOpType lockOpType, ShardManagementErrorCategory errorCategory) :
base(shardMapManager.Credentials, shardMapManager.RetryPolicy, operationName)
{
_shardMapManager = shardMapManager;
_shardMap = shardMap;
_mapping = mapping;
_lockOwnerId = lockOwnerId;
_lockOpType = lockOpType;
_errorCategory = errorCategory;
Debug.Assert(mapping != null || (lockOpType == LockOwnerIdOpType.UnlockAllMappingsForId || lockOpType == LockOwnerIdOpType.UnlockAllMappings));
}
示例15: ReplaceMappingsLocalOperation
/// <summary>
/// Constructs request for replacing the LSM mappings for given shard map with the input mappings.
/// </summary>
/// <param name="shardMapManager">Shard map manager.</param>
/// <param name="location">Location of the LSM.</param>
/// <param name="operationName">Operation name.</param>
/// <param name="shardMap">Local shard map.</param>
/// <param name="shard">Local shard.</param>
/// <param name="rangesToRemove">Optional list of ranges to minimize amount of deletions.</param>
/// <param name="mappingsToAdd">List of mappings to add.</param>
internal ReplaceMappingsLocalOperation(
ShardMapManager shardMapManager,
ShardLocation location,
string operationName,
IStoreShardMap shardMap,
IStoreShard shard,
IEnumerable<ShardRange> rangesToRemove,
IEnumerable<IStoreMapping> mappingsToAdd) :
base(shardMapManager.Credentials, shardMapManager.RetryPolicy, location, operationName)
{
_shardMap = shardMap;
_shard = shard;
_rangesToRemove = rangesToRemove;
_mappingsToAdd = mappingsToAdd;
}