コード例 #1
0
        //public void RenameRootFolder(RecoveryFileState state)
        //{
        //    string path = Path.Combine(ActiveConfig.RecoveryPath, RootFolderName);
        //    if (Directory.Exists(path))
        //    {
        //        switch (state)
        //        {
        //            case RecoveryFileState.Cancelled:
        //                string destination = string.Empty;
        //                if (path.EndsWith(RecoveryFolderStructure.INPROGRESS))
        //                {
        //                    string[] name = path.Split(RecoveryFolderStructure.INDELIMETER, StringSplitOptions.RemoveEmptyEntries);
        //                    destination = name[0] + RecoveryFolderStructure.COMPLETED;
        //                    Directory.Move(path, destination);
        //                }
        //                break;
        //            case RecoveryFileState.Completed:
        //                string[] folderName = path.Split(RecoveryFolderStructure.INDELIMETER, StringSplitOptions.RemoveEmptyEntries);
        //                destination = folderName[0] + RecoveryFolderStructure.COMPLETED;
        //                Directory.Move(path, destination);

        //                break;

        //            case RecoveryFileState.Failed:
        //                string[] rootName = path.Split(RecoveryFolderStructure.INDELIMETER, StringSplitOptions.RemoveEmptyEntries);
        //                destination = rootName[0] + RecoveryFolderStructure.FAILED;
        //                Directory.Move(path, destination);
        //                break;
        //        }
        //    }


        //}

        public void AddShardResponse(string shard, ShardDifState received)
        {
            lock (_mutex)
            {
                if (_shardResponseMap.ContainsKey(shard))
                {
                    _shardResponseMap[shard] = received;

                    _latestResponseTime = DateTime.UtcNow;
                    if (LoggerManager.Instance.RecoveryLogger != null && LoggerManager.Instance.RecoveryLogger.IsErrorEnabled)
                    {
                        LoggerManager.Instance.RecoveryLogger.Info("ClusterJobInfo.AddSharState", shard + " : " + received);
                    }
                }
            }
        }
コード例 #2
0
        public ShardDifState ShardReceivedState()
        {
            ShardDifState state = ShardDifState.success;

            foreach (ShardDifState val in _shardResponseMap.Values)
            {
                if (val != ShardDifState.failure)
                {
                    if (val == ShardDifState.none)
                    {
                        state = val;
                    }
                }
                else
                {
                    state = ShardDifState.failure;
                    break;
                }
            }
            return(state);
        }