• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IStoreShardMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IStoreShardMap的典型用法代码示例。如果您正苦于以下问题:C# IStoreShardMap类的具体用法?C# IStoreShardMap怎么用?C# IStoreShardMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IStoreShardMap类属于命名空间,在下文中一共展示了IStoreShardMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
            }
        }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:34,代码来源:ShardMapUtils.cs


示例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)
 {
 }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:13,代码来源:AddShardOperation.cs


示例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();
                }
            }
        }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:30,代码来源:CacheRoot.cs


示例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;
 }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:14,代码来源:FindShardByLocationGlobalOperation.cs


示例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;
 }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:16,代码来源:FindMappingByIdGlobalOperation.cs


示例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;
 }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:17,代码来源:ReplaceMappingsGlobalOperation.cs


示例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;
 }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:15,代码来源:GetShardsGlobalOperation.cs


示例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;
 }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:22,代码来源:GetMappingsByRangeGlobalOperation.cs


示例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));
        }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:22,代码来源:LockOrUnLockMappingsGlobalOperation.cs


示例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;
 }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:21,代码来源:MappingComparisonResult.cs


示例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);
            }
        }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:17,代码来源:CacheStore.cs


示例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;
 }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:14,代码来源:MappingDifference.cs


示例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;
 }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:25,代码来源:ReplaceMappingsLocalOperation.cs


示例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))
 {
 }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:22,代码来源:AddMappingOperation.cs


示例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;
            }
        }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:19,代码来源:CacheShardMap.cs


示例16: WriteIStoreShardMap

 /// <summary>
 /// Serializes shard map to xml.
 /// </summary>
 /// <param name="name">Element name for shard map.</param>
 /// <param name="shardMap">Shard Map to serialize.</param>
 /// <returns>XElement representing Shard Map.</returns>
 internal static XElement WriteIStoreShardMap(string name, IStoreShardMap shardMap)
 {
     if (shardMap == null)
     {
         return new XElement(name, new XAttribute("Null", 1));
     }
     else
     {
         return new XElement(name,
             new XAttribute("Null", 0),
             new XElement("Id", shardMap.Id),
             new XElement("Name", shardMap.Name),
             new XElement("Kind", (int)shardMap.MapType),
             new XElement("KeyKind", (int)shardMap.KeyType));
     }
 }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:22,代码来源:StoreObjectFormatterXml.cs


示例17: GetMappingsByRangeLocalOperation

        /// <summary>
        /// Constructs request for obtaining all the shard maps and shards from an LSM.
        /// </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="range">Optional range to get mappings from.</param>
        /// <param name="ignoreFailure">Ignore shard map not found error.</param>
        internal GetMappingsByRangeLocalOperation(
            ShardMapManager shardMapManager,
            ShardLocation location,
            string operationName,
            IStoreShardMap shardMap,
            IStoreShard shard,
            ShardRange range,
            bool ignoreFailure) :
            base(shardMapManager.Credentials, shardMapManager.RetryPolicy, location, operationName)
        {
            Debug.Assert(shard != null);

            _shardMap = shardMap;
            _shard = shard;
            _range = range;
            _ignoreFailure = ignoreFailure;
        }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:27,代码来源:GetMappingsByRangeLocalOperation.cs


示例18: ReplaceMappingsOperation

 /// <summary>
 /// Creates request to replace mappings within 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 update mapping.</param>
 /// <param name="mappingsSource">Original mappings.</param>
 /// <param name="mappingsTarget">Target mappings mapping.</param>
 protected internal ReplaceMappingsOperation(
     ShardMapManager shardMapManager,
     StoreOperationCode operationCode,
     IStoreShardMap shardMap,
     Tuple<IStoreMapping, Guid>[] mappingsSource,
     Tuple<IStoreMapping, Guid>[] mappingsTarget) :
     this(
     shardMapManager,
     Guid.NewGuid(),
     StoreOperationState.UndoBegin,
     operationCode,
     shardMap,
     mappingsSource,
     mappingsTarget,
     default(Guid))
 {
 }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:25,代码来源:ReplaceMappingsOperation.cs


示例19: 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;
            }

            this._perfCounters = new PerfCounterInstance(ssm.Name);
        }
开发者ID:jaredmoo,项目名称:elastic-db-tools,代码行数:21,代码来源:CacheShardMap.cs


示例20: UpdateShardOperation

 /// <summary>
 /// Creates request to update shard in given shard map.
 /// </summary>
 /// <param name="shardMapManager">Shard map manager object.</param>
 /// <param name="operationId">Operation id.</param>
 /// <param name="undoStartState">State from which Undo operation starts.</param>
 /// <param name="shardMap">Shard map for which to remove shard.</param>
 /// <param name="shardOld">Shard to update.</param>
 /// <param name="shardNew">Updated shard.</param>
 internal UpdateShardOperation(
     ShardMapManager shardMapManager,
     Guid operationId,
     StoreOperationState undoStartState,
     IStoreShardMap shardMap,
     IStoreShard shardOld,
     IStoreShard shardNew) :
     base(
     shardMapManager,
     operationId,
     undoStartState,
     StoreOperationCode.UpdateShard,
     default(Guid),
     default(Guid))
 {
     _shardMap = shardMap;
     _shardOld = shardOld;
     _shardNew = shardNew;
 }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:28,代码来源:UpdateShardOperation.cs



注:本文中的IStoreShardMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IStoreTransactionScope类代码示例发布时间:2022-05-24
下一篇:
C# IStoreService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap