public void Deserialize(Common.Serialization.IO.CompactReader reader) { _parent = reader.ReadObject() as NonShardedDistribution; }
public void Initialize(ICollection map, StateTransferType transferType, bool forLocal = false) { _isLocal = forLocal; TransferType = transferType; IDictionary <String, IDistribution> collectionMap = map as IDictionary <String, IDistribution>; if (collectionMap != null && collectionMap.Count > 0) { if (LoggerManager.Instance.StateXferLogger != null && LoggerManager.Instance.StateXferLogger.IsDebugEnabled) { LoggerManager.Instance.StateXferLogger.Debug("DatabaseStateTransferManager.Start()", "State Transfer Started for " + this.dbName); } //lock (_stateTxfrMutex) //{ foreach (KeyValuePair <String, IDistribution> colInfo in collectionMap) { try { //NTD: [Normal] Kindly perform state transfer for attachment collection //if (colInfo.Key.Equals(AttachmentAttributes.ATTACHMENT_COLLECTION, StringComparison.OrdinalIgnoreCase)) continue; if (TransferType == StateTransferType.INTER_SHARD && colInfo.Value.Type == Alachisoft.NosDB.Common.Toplogies.Impl.Distribution.DistributionMethod.NonShardedDistribution) { NonShardedDistribution nonShardedDist = colInfo.Value as NonShardedDistribution; if (!nonShardedDist.Bucket.FinalShard.Equals(context.LocalShardName, StringComparison.OrdinalIgnoreCase)) { continue; } } IStateTransferTask task = null; ICollection bucketList = GetBucketsForStateTransfer((IDistribution)colInfo.Value); lock (collectionTasksMap) { if (!collectionTasksMap.ContainsKey((String)colInfo.Key)) { if (TransferType == StateTransferType.INTER_SHARD) { collectionTasksMap[(String)colInfo.Key] = new StateTransferTask(context, dbName, (String)colInfo.Key, this, colInfo.Value.Type); } //else // collectionTasksMap[(String)colInfo.Key] = new StateTrxfrOnReplicaTask(context, dbName, (String)colInfo.Key, this, colInfo.Value.Type); } task = collectionTasksMap[(String)colInfo.Key]; } if (task != null) { task.Initialize(bucketList, transferType, IsLocal); //KeyValuePair<String, IStateTransferTask> pair = new KeyValuePair<string, IStateTransferTask>(colInfo.Key, task); lock (_schMutex) { waitingColTasks.AddLast(colInfo.Key); } } } catch (Exception ex) { if (LoggerManager.Instance.StateXferLogger.IsErrorEnabled) { LoggerManager.Instance.StateXferLogger.Error("DatabaseStateTransferManager.Start()", ex.Message); } } } } }
public NonShardedDistributionRouter(NonShardedDistribution parent) { _parent = parent; }