IPCConfig.hpp
上传用户:romrleung
上传日期:2022-05-23
资源大小:18897k
文件大小:2k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /* Copyright (C) 2003 MySQL AB
  2.    This program is free software; you can redistribute it and/or modify
  3.    it under the terms of the GNU General Public License as published by
  4.    the Free Software Foundation; either version 2 of the License, or
  5.    (at your option) any later version.
  6.    This program is distributed in the hope that it will be useful,
  7.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  8.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  9.    GNU General Public License for more details.
  10.    You should have received a copy of the GNU General Public License
  11.    along with this program; if not, write to the Free Software
  12.    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
  13. #ifndef IPCConfig_H
  14. #define IPCConfig_H
  15. #include <ndb_types.h>
  16. #include <ndb_limits.h>
  17. #include <kernel_types.h>
  18. #include <Properties.hpp>
  19. /**
  20.  * @class IPCConfig
  21.  * @brief Config transporters in TransporterRegistry using Properties config
  22.  */
  23. class IPCConfig 
  24. {
  25. public:
  26.   IPCConfig(Properties * props);
  27.   ~IPCConfig();
  28.   /** @return 0 for OK */
  29.   int init(); 
  30.   
  31.   NodeId ownId() const;
  32.   
  33.   /** @return No of transporters configured */
  34.   int configureTransporters(class TransporterRegistry * theTransporterRegistry);
  35.   /**
  36.    * Supply a nodeId,
  37.    *  and get next higher node id
  38.    * @return false if none found, true otherwise
  39.    *
  40.    * getREPHBFrequency and getNodeType uses the last Id supplied to 
  41.    * getNextRemoteNodeId.
  42.    */
  43.   bool getNextRemoteNodeId(NodeId & nodeId) const;
  44.   Uint32 getREPHBFrequency(NodeId id) const;
  45.   const char* getNodeType(NodeId id) const;
  46.   
  47.   NodeId getNoOfRemoteNodes() const {
  48.     return theNoOfRemoteNodes;
  49.   }
  50.   void print() const { props->print(); }
  51.   static Uint32 configureTransporters(Uint32 nodeId,
  52.       const struct ndb_mgm_configuration &,
  53.       class TransporterRegistry &);
  54.   
  55. private:
  56.   NodeId        the_ownId;
  57.   Properties *  props;
  58.   
  59.   bool    addRemoteNodeId(NodeId nodeId);
  60.   NodeId  theNoOfRemoteNodes;
  61.   NodeId  theRemoteNodeIds[MAX_NODES];
  62. };
  63. inline 
  64. NodeId 
  65. IPCConfig::ownId() const
  66. {
  67.   return the_ownId;
  68. }
  69. #endif // IPCConfig_H