Ignore:
Timestamp:
01/25/23 16:59:46 (17 months ago)
Author:
ymipsl
Message:

Merge XIOS_FILE_SERVICE dev branch into trunk

YM

Location:
XIOS3/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • XIOS3/trunk

  • XIOS3/trunk/src/manager/services_manager.cpp

    r2404 r2458  
    5454 
    5555    int leader ; 
    56     int poolSize ; 
     56    int poolSize, poolFreeSize ; 
    5757     
    5858    info(40)<<"CServicesManager : waiting for pool info : "<<poolId<<endl ; ; 
    59     bool ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, leader) ; 
     59    bool ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, poolFreeSize, leader) ; 
    6060    if (wait) 
    6161    { 
     
    6363      { 
    6464        CXios::getDaemonsManager()->eventLoop() ; 
    65         ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, leader) ; 
     65        ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, poolFreeSize, leader) ; 
    6666      } 
    6767    } 
     
    7070    { 
    7171      info(40)<<"CServicesManager : create service notification to leader "<<leader<<", serviceId : "<<serviceId<<", size : "<<size<<endl ; 
     72      CXios::getRessourcesManager()->decreasePoolFreeSize(poolId ,size) ; 
    7273      createServicesNotify(leader, serviceId, type, size, nbPartitions) ; 
    7374      return true ; 
     
    8182    int leader ; 
    8283    int poolSize ; 
     84    int poolFreeSize ; 
    8385     
    8486    info(40)<<"CServicesManager : waiting for pool info : "<<poolId<<endl ; ; 
    85     bool ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, leader) ; 
     87    bool ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, poolFreeSize, leader) ; 
    8688    if (wait) 
    8789    { 
     
    8991      { 
    9092        CXios::getDaemonsManager()->eventLoop() ; 
    91         ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, leader) ; 
     93        ok=CXios::getRessourcesManager()->getPoolInfo(poolId, poolSize, poolFreeSize, leader) ; 
    9294      } 
    9395    } 
     
    251253 
    252254  bool CServicesManager::getServiceInfo(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type,  
    253                                         int& size, int& nbPartitions, int& leader) 
     255                                        int& size, int& nbPartitions, int& leader, bool wait) 
    254256  { 
    255257     
     
    259261 
    260262    auto it=services_.find(std::tuple<std::string,std::string,int>(poolId,serviceId,partitionId)) ; 
    261     if ( it == services_.end()) return false ; 
     263    if ( it == services_.end() && !wait) return false ; 
    262264    else 
    263265    { 
     266      if (wait) waitServiceRegistration(poolId, serviceId, partitionId) ; 
    264267      type= std::get<0>(it->second);  
    265268      size= std::get<1>(it->second);  
     
    270273  } 
    271274 
    272   bool CServicesManager::getServiceLeader(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& leader) 
     275  bool CServicesManager::getServiceLeader(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& leader, bool wait) 
    273276  { 
    274277    int type; 
     
    278281  } 
    279282 
    280   bool CServicesManager::getServiceType(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type) 
     283  bool CServicesManager::getServiceType(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& type, bool wait) 
    281284  { 
    282285    int size ; 
     
    286289  } 
    287290 
    288   bool CServicesManager::getServiceNbPartitions(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& nbPartitions) 
     291  bool CServicesManager::getServiceNbPartitions(const std::string& poolId, const std::string& serviceId, const int& partitionId, int& nbPartitions, bool wait) 
    289292  { 
    290293    int size ; 
     
    303306    else return true ; 
    304307  } 
     308  
     309  void CServicesManager::waitServiceRegistration(const std::string& poolId, const std::string& serviceId, const int& partitionId) 
     310  { 
     311    while(!hasService(poolId,serviceId,partitionId)) CXios::getDaemonsManager()->servicesEventLoop() ; 
     312  } 
    305313 
    306314} 
Note: See TracChangeset for help on using the changeset viewer.