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

C# IStoreTransactionScope类代码示例

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

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



IStoreTransactionScope类属于命名空间,在下文中一共展示了IStoreTransactionScope类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DoGlobalExecute

 /// <summary>
 /// Execute the operation against GSM in the current transaction scope.
 /// </summary>
 /// <param name="ts">Transaction scope.</param>
 /// <returns>
 /// Results of the operation.
 /// </returns>
 public override IStoreResults DoGlobalExecute(IStoreTransactionScope ts)
 {
     // If no ranges are specified, blindly mark everything for deletion.
     return ts.ExecuteOperation(
         StoreOperationRequestBuilder.SpFindShardMappingByIdGlobal,
         StoreOperationRequestBuilder.FindShardMappingByIdGlobal(_shardMap, _mapping));
 }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:14,代码来源:FindMappingByIdGlobalOperation.cs


示例2: DoGlobalPreLocalExecute

 /// <summary>
 /// Performs the initial GSM operation prior to LSM operations.
 /// </summary>
 /// <param name="ts">Transaction scope.</param>
 /// <returns>Pending operations on the target objects if any.</returns>
 public override IStoreResults DoGlobalPreLocalExecute(IStoreTransactionScope ts)
 {
     return ts.ExecuteOperation(
         StoreOperationRequestBuilder.SpBulkOperationShardsGlobalBegin,
         StoreOperationRequestBuilder.AddShardGlobal(
             this.Id,
             this.OperationCode,
             false, // undo
             _shardMap,
             _shard));
 }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:16,代码来源:AddShardOperation.cs


示例3: DoGlobalExecute

        /// <summary>
        /// Execute the operation against GSM in the current transaction scope.
        /// </summary>
        /// <param name="ts">Transaction scope.</param>
        /// <returns>
        /// Results of the operation.
        /// </returns>
        public override IStoreResults DoGlobalExecute(IStoreTransactionScope ts)
        {
            IEnumerable<IStoreMapping> mappingsToReplace = this.GetMappingsToPurge(ts);

            return ts.ExecuteOperation(
                StoreOperationRequestBuilder.SpReplaceShardMappingsGlobal,
                StoreOperationRequestBuilder.ReplaceShardMappingsGlobalWithoutLogging(
                    _shardMap,
                    mappingsToReplace.ToArray(),
                    _mappingsToAdd.ToArray()));
        }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:18,代码来源:ReplaceMappingsGlobalOperation.cs


示例4: DoLocalExecute

        /// <summary>
        /// Execute the operation against LSM in the current transaction scope.
        /// </summary>
        /// <param name="ts">Transaction scope.</param>
        /// <returns>
        /// Results of the operation.
        /// </returns>
        public override IStoreResults DoLocalExecute(IStoreTransactionScope ts)
        {
            IEnumerable<IStoreMapping> mappingsToRemove = this.GetMappingsToPurge(ts);

            return ts.ExecuteOperation(
                StoreOperationRequestBuilder.SpBulkOperationShardMappingsLocal,
                StoreOperationRequestBuilder.ReplaceShardMappingsLocal(
                    Guid.NewGuid(), // Create a new Guid so that this operation forces over-writes.
                    false,
                    _shardMap,
                    mappingsToRemove.ToArray(),
                    _mappingsToAdd.ToArray()));
        }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:20,代码来源:ReplaceMappingsLocalOperation.cs


示例5: DoLocalExecute

        /// <summary>
        /// Execute the operation against LSM in the current transaction scope.
        /// </summary>
        /// <param name="ts">Transaction scope.</param>
        /// <returns>
        /// Results of the operation.
        /// </returns>
        public override IStoreResults DoLocalExecute(IStoreTransactionScope ts)
        {
            TraceHelper.Tracer.TraceInfo(
                TraceSourceConstants.ComponentNames.ShardMapManagerFactory,
                this.OperationName,
                "Started upgrading Local Shard Map structures at location {0}", base.Location);

            Stopwatch stopwatch = Stopwatch.StartNew();

            IStoreResults checkResult = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsLocalScript.Single());
            if (checkResult.StoreVersion == null)
            {
                // DEVNOTE(apurvs): do we want to throw here if LSM is not already deployed?
                // deploy initial version of LSM, if not found.
                ts.ExecuteCommandBatch(SqlUtils.CreateLocalScript);
            }

            if (checkResult.StoreVersion == null || checkResult.StoreVersion.Version < _targetVersion)
            {
                if (checkResult.StoreVersion == null)
                    ts.ExecuteCommandBatch(SqlUtils.FilterUpgradeCommands(SqlUtils.UpgradeLocalScript, _targetVersion));
                else
                    ts.ExecuteCommandBatch(SqlUtils.FilterUpgradeCommands(SqlUtils.UpgradeLocalScript, _targetVersion, checkResult.StoreVersion.Version));

                // Read LSM version again after upgrade.
                checkResult = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsLocalScript.Single());

                stopwatch.Stop();

                TraceHelper.Tracer.TraceInfo(
                    TraceSourceConstants.ComponentNames.ShardMapManagerFactory,
                    this.OperationName,
                    "Finished upgrading store at location {0}. Duration: {1}",
                    base.Location,
                    stopwatch.Elapsed);
            }
            else
            {
                TraceHelper.Tracer.TraceInfo(
                    TraceSourceConstants.ComponentNames.ShardMapManagerFactory,
                    this.OperationName,
                    "Local Shard Map at location {0} has version {1} equal to or higher than Client library version {2}, skipping upgrade.",
                    base.Location,
                    checkResult.StoreVersion,
                    GlobalConstants.GsmVersionClient);
            }

            return checkResult;
        }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:56,代码来源:UpgradeStoreLocalOperation.cs


示例6: DoGlobalExecute

        /// <summary>
        /// Execute the operation against GSM in the current transaction scope.
        /// </summary>
        /// <param name="ts">Transaction scope.</param>
        /// <returns>
        /// Results of the operation.
        /// </returns>
        public override IStoreResults DoGlobalExecute(IStoreTransactionScope ts)
        {
            TraceHelper.Tracer.TraceInfo(
                TraceSourceConstants.ComponentNames.ShardMapManagerFactory,
                this.OperationName,
                "Started creating Global Shard Map structures.");

            Stopwatch stopwatch = Stopwatch.StartNew();

            IStoreResults checkResult = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsGlobalScript.Single());

            // If we did find some store deployed.
            if (checkResult.StoreVersion != null)
            {
                // DEVNOTE(wbasheer): We need to have a way of erroring out if versions do not match.
                if (_createMode == ShardMapManagerCreateMode.KeepExisting)
                {
                    throw new ShardManagementException(
                        ShardManagementErrorCategory.ShardMapManagerFactory,
                        ShardManagementErrorCode.ShardMapManagerStoreAlreadyExists,
                        Errors._Store_ShardMapManager_AlreadyExistsGlobal);
                }

                TraceHelper.Tracer.TraceVerbose(
                    TraceSourceConstants.ComponentNames.ShardMapManagerFactory,
                    this.OperationName,
                    "Dropping existing Global Shard Map structures.");

                ts.ExecuteCommandBatch(SqlUtils.DropGlobalScript);
            }

            // Deploy initial version and run upgrade script to bring it to the specified version.
            ts.ExecuteCommandBatch(SqlUtils.CreateGlobalScript);

            ts.ExecuteCommandBatch(SqlUtils.FilterUpgradeCommands(SqlUtils.UpgradeGlobalScript, _targetVersion));

            stopwatch.Stop();

            TraceHelper.Tracer.TraceInfo(
                TraceSourceConstants.ComponentNames.ShardMapManagerFactory,
                this.OperationName,
                "Finished creating Global Shard Map structures. Duration: {0}",
                stopwatch.Elapsed);

            return new SqlResults();
        }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:53,代码来源:CreateShardMapManagerGlobalOperation.cs


示例7: DoLocalExecute

        /// <summary>
        /// Execute the operation against LSM in the current transaction scope.
        /// </summary>
        /// <param name="ts">Transaction scope.</param>
        /// <returns>
        /// Results of the operation.
        /// </returns>
        public override IStoreResults DoLocalExecute(IStoreTransactionScope ts)
        {
            IStoreResults result = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsLocalScript.Single());

            if (result.StoreVersion == null)
            {
                // Shard not deployed, which is an error condition.
                throw new ShardManagementException(
                    ShardManagementErrorCategory.Recovery,
                    ShardManagementErrorCode.ShardNotValid,
                    Errors._Recovery_ShardNotValid,
                    this.Location,
                    this.OperationName);
            }

            Debug.Assert(result.Result == StoreResult.Success);

            return result;
        }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:26,代码来源:CheckShardLocalOperation.cs


示例8: DoLocalExecute

        /// <summary>
        /// Execute the operation against LSM in the current transaction scope.
        /// </summary>
        /// <param name="ts">Transaction scope.</param>
        /// <returns>
        /// Results of the operation.
        /// </returns>
        public override IStoreResults DoLocalExecute(IStoreTransactionScope ts)
        {
            IStoreResults result = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsLocalScript.Single());

            if (result.StoreVersion == null)
            {
                // Shard not deployed, which is an error condition.
                throw new ShardManagementException(
                    ShardManagementErrorCategory.Recovery,
                    ShardManagementErrorCode.ShardNotValid,
                    Errors._Recovery_ShardNotValid,
                    this.Location,
                    this.OperationName);
            }

            return ts.ExecuteOperation(
                StoreOperationRequestBuilder.SpGetAllShardsLocal,
                StoreOperationRequestBuilder.GetAllShardsLocal());
        }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:26,代码来源:GetShardsLocalOperation.cs


示例9: DoGlobalExecute

        /// <summary>
        /// Execute the operation against GSM in the current transaction scope.
        /// </summary>
        /// <param name="ts">Transaction scope.</param>
        /// <returns>
        /// Results of the operation.
        /// </returns>
        public override IStoreResults DoGlobalExecute(IStoreTransactionScope ts)
        {
            TraceHelper.Tracer.TraceInfo(
                TraceSourceConstants.ComponentNames.ShardMapManagerFactory,
                this.OperationName,
                "Started upgrading Global Shard Map structures.");

            IStoreResults checkResult = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsGlobalScript.Single());

            Debug.Assert(checkResult.StoreVersion != null, "GSM store structures not found.");

            if (checkResult.StoreVersion.Version < _targetVersion)
            {
                Stopwatch stopwatch = Stopwatch.StartNew();

                ts.ExecuteCommandBatch(SqlUtils.FilterUpgradeCommands(SqlUtils.UpgradeGlobalScript, _targetVersion, checkResult.StoreVersion.Version));

                // read GSM version after upgrade.
                checkResult = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsGlobalScript.Single());

                // DEVNOTE(apurvs): verify (checkResult.StoreVersion == GlobalConstants.GsmVersionClient) and throw on failure.

                stopwatch.Stop();

                TraceHelper.Tracer.TraceInfo(
                    TraceSourceConstants.ComponentNames.ShardMapManagerFactory,
                    this.OperationName,
                    "Finished upgrading Global Shard Map. Duration: {0}",
                    stopwatch.Elapsed);
            }
            else
            {
                TraceHelper.Tracer.TraceInfo(
                    TraceSourceConstants.ComponentNames.ShardMapManagerFactory,
                    this.OperationName,
                    "Global Shard Map is at a version {0} equal to or higher than Client library version {1}, skipping upgrade.",
                    (checkResult.StoreVersion == null) ? "" : checkResult.StoreVersion.Version.ToString(),
                    GlobalConstants.GsmVersionClient);
            }

            return checkResult;
        }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:49,代码来源:UpgradeStoreGlobalOperation.cs


示例10: DoGlobalExecute

        /// <summary>
        /// Execute the operation against GSM in the current transaction scope.
        /// </summary>
        /// <param name="ts">Transaction scope.</param>
        /// <returns>
        /// Results of the operation.
        /// </returns>
        public override IStoreResults DoGlobalExecute(IStoreTransactionScope ts)
        {
            IStoreResults result = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsGlobalScript.Single());

            SqlResults returnedResult = new SqlResults();

            // If we did not find some store deployed.
            if (result.StoreVersion == null)
            {
                returnedResult.Result = StoreResult.Failure;
            }
            else
            {
                // DEVNOTE(wbasheer): We need to have a way of erroring out if versions do not match.
                // we can potentially call upgrade here to get to latest version. Should this be exposed as a new parameter ?
                returnedResult.Result = StoreResult.Success;
            }

            return returnedResult;
        }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:27,代码来源:GetShardMapManagerGlobalOperation.cs


示例11: DoGlobalExecute

        /// <summary>
        /// Execute the operation against GSM in the current transaction scope.
        /// </summary>
        /// <param name="ts">Transaction scope.</param>
        /// <returns>
        /// Results of the operation.
        /// </returns>
        public override IStoreResults DoGlobalExecute(IStoreTransactionScope ts)
        {
            _loadResults.Clear();

            IStoreResults result = ts.ExecuteOperation(
                StoreOperationRequestBuilder.SpGetAllShardMapsGlobal,
                StoreOperationRequestBuilder.GetAllShardMapsGlobal());

            if (result.Result == StoreResult.Success)
            {
                foreach (IStoreShardMap ssm in result.StoreShardMaps)
                {
                    _ssmCurrent = ssm;

                    result = ts.ExecuteOperation(
                        StoreOperationRequestBuilder.SpGetAllShardMappingsGlobal,
                        StoreOperationRequestBuilder.GetAllShardMappingsGlobal(ssm, null, null));

                    if (result.Result == StoreResult.Success)
                    {
                        _loadResults.Add(
                            new LoadResult
                            {
                                ShardMap = ssm,
                                Mappings = result.StoreMappings
                            });
                    }
                    else
                    if (result.Result != StoreResult.ShardMapDoesNotExist)
                    {
                        // Ignore some possible failures for Load operation and skip failed
                        // shard map caching operations.
                        break;
                    }
                }
            }

            return result;
        }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:46,代码来源:LoadShardMapManagerGlobalOperation.cs


示例12: DoGlobalPostLocalExecute

 public override IStoreResults DoGlobalPostLocalExecute(IStoreTransactionScope ts)
 {
     if (_currentFailureCount < _failureCountMax)
     {
         _currentFailureCount++;
         throw new StoreException("", TransientSqlException);
     }
     else
     {
         return base.DoGlobalPostLocalExecute(ts);
     }
 }
开发者ID:jaredmoo,项目名称:elastic-db-tools,代码行数:12,代码来源:ShardMapFaultHandlingTests.cs


示例13: DoGlobalExecute

 /// <summary>
 /// Execute the operation against GSM in the current transaction scope.
 /// </summary>
 /// <param name="ts">Transaction scope.</param>
 /// <returns>
 /// Results of the operation.
 /// </returns>
 public override IStoreResults DoGlobalExecute(IStoreTransactionScope ts)
 {
     return ts.ExecuteOperation(
         StoreOperationRequestBuilder.SpLockOrUnLockShardMappingsGlobal,
         StoreOperationRequestBuilder.LockOrUnLockShardMappingsGlobal(
             _shardMap,
             _mapping,
             _lockOwnerId,
             _lockOpType));
 }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:17,代码来源:LockOrUnLockMappingsGlobalOperation.cs


示例14: UndoLocalSourceExecute

        /// <summary>
        /// Performs the undo of LSM operation on the source shard.
        /// </summary>
        /// <param name="ts">Transaction scope.</param>
        /// <returns>Result of the operation.</returns>
        public override IStoreResults UndoLocalSourceExecute(IStoreTransactionScope ts)
        {
            IStoreResults checkResult = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsLocalScript.Single());

            if (checkResult.StoreVersion != null)
            {
                // Remove the added shard entries.
                return ts.ExecuteOperation(
                    StoreOperationRequestBuilder.SpRemoveShardLocal,
                    StoreOperationRequestBuilder.RemoveShardLocal(this.Id, _shardMap, _shard));
            }
            else
            {
                // If version is < 0, then shard never got deployed, consider it a success.
                return new SqlResults();
            }
        }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:22,代码来源:AddShardOperation.cs


示例15: DoLocalSourceExecute

        /// <summary>
        /// Performs the LSM operation on the source shard.
        /// </summary>
        /// <param name="ts">Transaction scope.</param>
        /// <returns>Result of the operation.</returns>
        public override IStoreResults DoLocalSourceExecute(IStoreTransactionScope ts)
        {
            IStoreResults checkResult = ts.ExecuteCommandSingle(SqlUtils.CheckIfExistsLocalScript.Single());

            // Shard not already deployed, just need to add the proper entries.
            if (checkResult.StoreVersion == null)
            {
                // create initial version of LSM
                ts.ExecuteCommandBatch(SqlUtils.CreateLocalScript);

                // now upgrade LSM to latest version
                ts.ExecuteCommandBatch(SqlUtils.FilterUpgradeCommands(SqlUtils.UpgradeLocalScript, GlobalConstants.LsmVersionClient));
            }

            // Now actually add the shard entries.
            return ts.ExecuteOperation(
                StoreOperationRequestBuilder.SpAddShardLocal,
                StoreOperationRequestBuilder.AddShardLocal(this.Id, false, _shardMap, _shard));
        }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:24,代码来源:AddShardOperation.cs


示例16: UndoLocalTargetExecute

 /// <summary>
 /// Sets the stub of StoreOperation.UndoLocalTargetExecute(IStoreTransactionScope ts)
 /// </summary>
 public override IStoreResults UndoLocalTargetExecute(IStoreTransactionScope ts)
 {
     Func<IStoreTransactionScope, IStoreResults> func1 = this.UndoLocalTargetExecuteIStoreTransactionScope;
     if (func1 != null)
         return func1(ts);
     if (this.___callBase)
         return base.UndoLocalTargetExecute(ts);
     return this.InstanceBehavior.Result<StubReplaceMappingsOperation, IStoreResults>(this, "UndoLocalTargetExecute");
 }
开发者ID:jaredmoo,项目名称:elastic-db-tools,代码行数:12,代码来源:StubReplaceMappingsOperation.cs


示例17: DoGlobalExecute

 /// <summary>
 /// Execute the operation against GSM in the current transaction scope.
 /// </summary>
 /// <param name="ts">Transaction scope.</param>
 /// <returns>
 /// Results of the operation.
 /// </returns>
 public override IStoreResults DoGlobalExecute(IStoreTransactionScope ts)
 {
     return ts.ExecuteOperation(
         StoreOperationRequestBuilder.SpFindShardMapByNameGlobal,
         StoreOperationRequestBuilder.FindShardMapByNameGlobal(_shardMapName));
 }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:13,代码来源:FindShardMapByNameGlobalOperation.cs


示例18: DoGlobalExecuteAsync

 /// <summary>
 /// Asynchronously execute the operation against GSM in the current transaction scope.
 /// </summary>
 /// <param name="ts">Transaction scope.</param>
 /// <returns>
 /// Task encapsulating results of the operation.
 /// </returns>
 public override async Task<IStoreResults> DoGlobalExecuteAsync(IStoreTransactionScope ts)
 {
     // If no ranges are specified, blindly mark everything for deletion.
     return await ts.ExecuteOperationAsync(
         StoreOperationRequestBuilder.SpFindShardMappingByKeyGlobal,
         StoreOperationRequestBuilder.FindShardMappingByKeyGlobal(_shardMap, _key));
 }
开发者ID:xdansmith,项目名称:elastic-db-tools,代码行数:14,代码来源:FindMappingByKeyGlobalOperation.cs


示例19: UndoGlobalPostLocalExecute

 /// <summary>
 /// Performs the undo of GSM operation after LSM operations.
 /// </summary>
 /// <param name="ts">Transaction scope.</param>
 /// <returns>Pending operations on the target objects if any.</returns>
 public override IStoreResults UndoGlobalPostLocalExecute(IStoreTransactionScope ts)
 {
     return ts.ExecuteOperation(
         StoreOperationRequestBuilder.SpBulkOperationShardMappingsGlobalEnd,
         StoreOperationRequestBuilder.AddShardMappingGlobal(
             this.Id,
             this.OperationCode,
             true, // undo
             _shardMap,
             _mapping));
 }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:16,代码来源:AddMappingOperation.cs


示例20: DoLocalSourceExecute

 /// <summary>
 /// Performs the LSM operation on the source shard.
 /// </summary>
 /// <param name="ts">Transaction scope.</param>
 /// <returns>Result of the operation.</returns>
 public override IStoreResults DoLocalSourceExecute(IStoreTransactionScope ts)
 {
     return ts.ExecuteOperation(
         StoreOperationRequestBuilder.SpBulkOperationShardMappingsLocal,
         StoreOperationRequestBuilder.AddShardMappingLocal(
             this.Id,
             false,
             _shardMap,
             _mapping));
 }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:15,代码来源:AddMappingOperation.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IStrategy类代码示例发布时间:2022-05-24
下一篇:
C# IStoreShardMap类代码示例发布时间: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