CheckNodeGroups.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 CHECKNODEGROUPS_H
  14. #define CHECKNODEGROUPS_H
  15. #include <string.h>
  16. #include <NodeBitmask.hpp>
  17. #include "SignalData.hpp"
  18. #include "SignalDataPrint.hpp"
  19. /**
  20.  * Ask DIH to check if a node set can survive i.e. if it
  21.  * has at least one node in every node group.  Returns one
  22.  * of Win, Lose, Partitioning.
  23.  *
  24.  * Same class is used for REQ and CONF.  The REQ can also
  25.  * be executed as a direct signal.
  26.  */
  27. class CheckNodeGroups {
  28. public:
  29.   Uint32 blockRef;              // sender's node id
  30.   union {
  31.     Uint32 requestType;           // direct flag, output code
  32.     Uint32 output;
  33.   };
  34.   Uint32 nodeId;             // nodeId input for GetNodeGroupMembers
  35.   NodeBitmask mask;             /* set of NDB nodes, input for ArbitCheck,
  36.             * output for GetNodeGroupMembers
  37.    */
  38.   enum RequestType {
  39.     Direct              = 0x1,
  40.     ArbitCheck          = 0x2,
  41.     GetNodeGroup        = 0x4,
  42.     GetNodeGroupMembers = 0x8
  43.   };
  44.   enum Output {
  45.     Lose = 1,                   // we cannot survive
  46.     Win = 2,                    // we and only we can survive
  47.     Partitioning = 3            // possible network partitioning
  48.   };
  49.   STATIC_CONST( SignalLength = 3 + NodeBitmask::Size );
  50. };
  51. #endif