Exemple #1
0
 /// <summary>Choose the target storage within same Datanode if possible.</summary>
 internal virtual bool ChooseTargetInSameNode(Dispatcher.DBlock db, Dispatcher.Source
                                              source, IList <StorageType> targetTypes)
 {
     foreach (StorageType t in targetTypes)
     {
         Dispatcher.DDatanode.StorageGroup target = this._enclosing.storages.GetTarget(source
                                                                                       .GetDatanodeInfo().GetDatanodeUuid(), t);
         if (target == null)
         {
             continue;
         }
         Dispatcher.PendingMove pm = source.AddPendingMove(db, target);
         if (pm != null)
         {
             this._enclosing.dispatcher.ExecutePendingMove(pm);
             return(true);
         }
     }
     return(false);
 }
Exemple #2
0
            internal virtual bool ChooseTarget(Dispatcher.DBlock db, Dispatcher.Source source
                                               , IList <StorageType> targetTypes, Matcher matcher)
            {
                NetworkTopology cluster = this._enclosing.dispatcher.GetCluster();

                foreach (StorageType t in targetTypes)
                {
                    foreach (Dispatcher.DDatanode.StorageGroup target in this._enclosing.storages.GetTargetStorages
                                 (t))
                    {
                        if (matcher.Match(cluster, source.GetDatanodeInfo(), target.GetDatanodeInfo()))
                        {
                            Dispatcher.PendingMove pm = source.AddPendingMove(db, target);
                            if (pm != null)
                            {
                                this._enclosing.dispatcher.ExecutePendingMove(pm);
                                return(true);
                            }
                        }
                    }
                }
                return(false);
            }