本文整理汇总了C#中IStoreShardMap类的典型用法代码示例。如果您正苦于以下问题:C# IStoreShardMap类的具体用法?C# IStoreShardMap怎么用?C# IStoreShardMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IStoreShardMap类属于命名空间,在下文中一共展示了IStoreShardMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例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: Remove
/// <summary>
/// Removes shard map from cache given the name.
/// </summary>
/// <param name="ssm">Storage representation of shard map.</param>
internal void Remove(IStoreShardMap ssm)
{
if (_shardMapsByName.ContainsKey(ssm.Name))
{
CacheShardMap csm = _shardMapsByName[ssm.Name];
_shardMapsByName.Remove(ssm.Name);
// Dispose off the cached map
if (csm != null)
{
csm.Dispose();
}
}
if (_shardMapsById.ContainsKey(ssm.Id))
{
CacheShardMap csm = _shardMapsById[ssm.Id];
_shardMapsById.Remove(ssm.Id);
// Dispose off the cached map
if (csm != null)
{
csm.Dispose();
}
}
}
示例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: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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));
}
示例10: MappingComparisonResult
/// <summary>
/// Instantiates a new instance of range mapping comparison result.
/// </summary>
/// <param name="ssm">Store representation of shard map.</param>
/// <param name="range">Range being considered.</param>
/// <param name="mappingLocation">Location of mapping.</param>
/// <param name="gsmMapping">Storage representation of GSM mapping.</param>
/// <param name="lsmMapping">Storange representation of LSM mapping.</param>
internal MappingComparisonResult(
IStoreShardMap ssm,
ShardRange range,
MappingLocation mappingLocation,
IStoreMapping gsmMapping,
IStoreMapping lsmMapping)
{
this.ShardMap = ssm;
this.Range = range;
this.MappingLocation = mappingLocation;
this.ShardMapManagerMapping = gsmMapping;
this.ShardMapping = lsmMapping;
}
示例11: DeleteShardMap
/// <summary>
/// Invoked for deleting shard map in cache becase it no longer exists in store.
/// </summary>
/// <param name="shardMap">Storage representation of shard map.</param>
public virtual void DeleteShardMap(IStoreShardMap shardMap)
{
using (WriteLockScope wls = _cacheRoot.GetWriteLockScope())
{
_cacheRoot.Remove(shardMap);
Tracer.TraceVerbose(
TraceSourceConstants.ComponentNames.ShardMapManager,
"OnDeleteShardMap",
"Cache delete complete. ShardMap: {0}",
shardMap.Name);
}
}
示例12: MappingDifference
internal MappingDifference(
MappingDifferenceType type,
MappingLocation location,
IStoreShardMap shardMap,
IStoreMapping mappingForShardMap,
IStoreMapping mappingForShard
)
{
this.Type = type;
this.Location = location;
this.ShardMap = shardMap;
this.MappingForShardMap = mappingForShardMap;
this.MappingForShard = mappingForShard;
}
示例13: 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;
}
示例14: AddMappingOperation
/// <summary>
/// Creates request to add shard to given shard map.
/// </summary>
/// <param name="shardMapManager">Shard map manager object.</param>
/// <param name="operationCode">Store operation code.</param>
/// <param name="shardMap">Shard map for which to add mapping.</param>
/// <param name="mapping">Mapping to add.</param>
protected internal AddMappingOperation(
ShardMapManager shardMapManager,
StoreOperationCode operationCode,
IStoreShardMap shardMap,
IStoreMapping mapping) :
this(
shardMapManager,
Guid.NewGuid(),
StoreOperationState.UndoBegin,
operationCode,
shardMap,
mapping,
default(Guid))
{
}
示例15: CacheShardMap
/// <summary>
/// Constructs the cached shard map.
/// </summary>
/// <param name="ssm">Storage representation of shard map.</param>
internal CacheShardMap(IStoreShardMap ssm)
: base()
{
this.StoreShardMap = ssm;
switch (ssm.MapType)
{
case ShardMapType.List:
this.Mapper = new CacheListMapper(ssm.KeyType);
break;
case ShardMapType.Range:
this.Mapper = new CacheRangeMapper(ssm.KeyType);
break;
}
}