⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simulatedblock.hpp

📁 mysql-5.0.22.tar.gz源码包
💻 HPP
📖 第 1 页 / 共 2 页
字号:
/* Copyright (C) 2003 MySQL AB   This program is free software; you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation; either version 2 of the License, or   (at your option) any later version.   This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.   You should have received a copy of the GNU General Public License   along with this program; if not, write to the Free Software   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */#ifndef SIMULATEDBLOCK_H#define SIMULATEDBLOCK_H#include <NdbTick.h>#include <kernel_types.h>#include <ndb_version.h>#include <ndb_limits.h>#include "VMSignal.hpp"#include <RefConvert.hpp>#include <BlockNumbers.h>#include <GlobalSignalNumbers.h>#include "pc.hpp"#include <NodeInfo.hpp>#include <NodeState.hpp>#include "GlobalData.hpp"#include "LongSignal.hpp"#include <SignalLoggerManager.hpp>#include <ErrorReporter.hpp>#include <ErrorHandlingMacros.hpp>#include "DLList.hpp"#include "ArrayPool.hpp"#include "DLHashTable.hpp"#include "Callback.hpp"#include "SafeCounter.hpp"#include "MetaData.hpp"#include <mgmapi.h>#include <mgmapi_config_parameters.h>#include <mgmapi_config_parameters_debug.h>#include <kernel_config_parameters.h>#include <Configuration.hpp>#include <signaldata/ReadConfig.hpp>#include <signaldata/UpgradeStartup.hpp>/** * Something for filesystem access */struct  NewBaseAddrBits              /* 32 bits */{  unsigned int     q               : 4;    /* Highest index - 2log */  /* Strings are treated as 16 bit indexed        */  /* variables with the number of characters in   */  /* index 0, byte 0                              */  unsigned int     v               : 3;    /* Size in bits - 2log */  unsigned int     unused : 25 ;};typedef struct NewVar{  Uint32 *              WA;  Uint32                nrr;  Uint32                ClusterSize;    /* Real Cluster size    */  NewBaseAddrBits       bits;} NewVARIABLE;  /* 128 bits */class SimulatedBlock {  friend class SafeCounter;  friend class SafeCounterManager;  friend struct UpgradeStartup;public:  friend class BlockComponent;  virtual ~SimulatedBlock();  protected:  /**   * Constructor   */  SimulatedBlock(BlockNumber blockNumber,                 const class Configuration & theConfiguration);   /**********************************************************   * Handling of execFunctions   */  typedef void (SimulatedBlock::* ExecFunction)(Signal* signal);  void addRecSignalImpl(GlobalSignalNumber g, ExecFunction fun, bool f =false);  void installSimulatedBlockFunctions();  ExecFunction theExecArray[MAX_GSN+1];public:  /**   *    */  inline void executeFunction(GlobalSignalNumber gsn, Signal* signal);public:  typedef void (SimulatedBlock::* CallbackFunction)(class Signal*, 						    Uint32 callbackData,						    Uint32 returnCode);  struct Callback {    CallbackFunction m_callbackFunction;    Uint32 m_callbackData;  };protected:  static Callback TheEmptyCallback;  void execute(Signal* signal, Callback & c, Uint32 returnCode);      /**********************************************************   * Send signal - dialects   */  void sendSignal(BlockReference ref, 		  GlobalSignalNumber gsn,                   Signal* signal, 		  Uint32 length, 		  JobBufferLevel jbuf ) const ;  void sendSignal(NodeReceiverGroup rg,		  GlobalSignalNumber gsn,                   Signal* signal, 		  Uint32 length, 		  JobBufferLevel jbuf ) const ;  void sendSignal(BlockReference ref, 		  GlobalSignalNumber gsn,                   Signal* signal, 		  Uint32 length, 		  JobBufferLevel jbuf,		  LinearSectionPtr ptr[3],		  Uint32 noOfSections) const ;    void sendSignal(NodeReceiverGroup rg, 		  GlobalSignalNumber gsn,                   Signal* signal, 		  Uint32 length, 		  JobBufferLevel jbuf,		  LinearSectionPtr ptr[3],		  Uint32 noOfSections) const ;  // Send multiple signal with delay. In this VM the jobbufffer level has   // no effect on on delayed signals  //  void sendSignalWithDelay(BlockReference ref, 			   GlobalSignalNumber gsn,                            Signal* signal,                           Uint32 delayInMilliSeconds, 			   Uint32 length) const ;  void EXECUTE_DIRECT(Uint32 block, 		      Uint32 gsn, 		      Signal* signal, 		      Uint32 len);    class SectionSegmentPool& getSectionSegmentPool();  void releaseSections(Signal* signal);  /**********************************************************   * Fragmented signals   */    /**   * Assemble fragments   *   * @return true if all fragments has arrived   *         false otherwise   */  bool assembleFragments(Signal * signal);    void sendFragmentedSignal(BlockReference ref, 			    GlobalSignalNumber gsn, 			    Signal* signal, 			    Uint32 length, 			    JobBufferLevel jbuf,			    Callback & = TheEmptyCallback,			    Uint32 messageSize = 240);  void sendFragmentedSignal(NodeReceiverGroup rg, 			    GlobalSignalNumber gsn, 			    Signal* signal, 			    Uint32 length, 			    JobBufferLevel jbuf,			    Callback & = TheEmptyCallback,			    Uint32 messageSize = 240);  void sendFragmentedSignal(BlockReference ref, 			    GlobalSignalNumber gsn, 			    Signal* signal, 			    Uint32 length, 			    JobBufferLevel jbuf,			    LinearSectionPtr ptr[3],			    Uint32 noOfSections,			    Callback &,			    Uint32 messageSize = 240);  void sendFragmentedSignal(NodeReceiverGroup rg, 			    GlobalSignalNumber gsn, 			    Signal* signal, 			    Uint32 length, 			    JobBufferLevel jbuf,			    LinearSectionPtr ptr[3],			    Uint32 noOfSections,			    Callback &,			    Uint32 messageSize = 240);  /**********************************************************   * Fragmented signals structures   */  /**   * Struct used when assembling fragmented long signals at receiver side   */  struct FragmentInfo {    FragmentInfo(Uint32 fragId, Uint32 sender);        Uint32 m_senderRef;    Uint32 m_fragmentId;    Uint32 m_sectionPtrI[3];    union {      Uint32 nextPool;      Uint32 nextHash;    };    Uint32 prevHash;        inline bool equal(FragmentInfo & p) const {      return m_senderRef == p.m_senderRef && m_fragmentId == p.m_fragmentId;    }        inline Uint32 hashValue() const {      return m_senderRef + m_fragmentId ;    }  }; // sizeof() = 32 bytes    /**   * Struct used when sending fragmented signals   */  struct FragmentSendInfo {    FragmentSendInfo();        enum Status {      SendNotComplete = 0,      SendComplete    = 1    };    Uint8  m_status;    Uint8  m_prio;    Uint16  m_fragInfo;    Uint16 m_gsn;    Uint16 m_messageSize; // Size of each fragment    Uint32 m_fragmentId;    union {      Ptr<struct SectionSegment> m_segmented;      LinearSectionPtr m_linear;    } m_sectionPtr[3];    LinearSectionPtr m_theDataSection;    NodeReceiverGroup m_nodeReceiverGroup; // 3    Callback m_callback;    union  {      Uint32 nextPool;      Uint32 nextList;    };    Uint32 prevList;  };    /**   * setupFragmentSendInfo   *   Setup a struct to be used with sendSignalFragment   *   Used by sendFragmentedSignal   */  bool sendFirstFragment(FragmentSendInfo & info,			 NodeReceiverGroup rg, 			 GlobalSignalNumber gsn, 			 Signal* signal, 			 Uint32 length, 			 JobBufferLevel jbuf,			 LinearSectionPtr ptr[3],			 Uint32 noOfSections,			 Uint32 messageSize = 240);    bool sendFirstFragment(FragmentSendInfo & info,			 NodeReceiverGroup rg, 			 GlobalSignalNumber gsn, 			 Signal* signal, 			 Uint32 length, 			 JobBufferLevel jbuf,			 Uint32 messageSize = 240);    /**   * Send signal fragment   *   * @see sendFragmentedSignal   */  void sendNextSegmentedFragment(Signal* signal, FragmentSendInfo & info);  /**   * Send signal fragment   *   * @see sendFragmentedSignal   */  void sendNextLinearFragment(Signal* signal, FragmentSendInfo & info);    BlockNumber    number() const;  BlockReference reference() const;  NodeId         getOwnNodeId() const;  /**   * Refresh Watch Dog in initialising code   *   */  void refresh_watch_dog();  /**   * Prog error   * This function should be called when this node should be shutdown   * If the cause of the shutdown is known use extradata to add an    * errormessage describing the problem   */  void progError(int line, int err_code, const char* extradata=NULL) const ;private:  void  signal_error(Uint32, Uint32, Uint32, const char*, int) const ;  const NodeId         theNodeId;  const BlockNumber    theNumber;  const BlockReference theReference;  protected:  NewVARIABLE* allocateBat(int batSize);  void freeBat();  static const NewVARIABLE* getBat    (BlockNumber blockNo);  static Uint16             getBatSize(BlockNumber blockNo);    static BlockReference calcTcBlockRef   (NodeId aNode);  static BlockReference calcLqhBlockRef  (NodeId aNode);  static BlockReference calcAccBlockRef  (NodeId aNode);  static BlockReference calcTupBlockRef  (NodeId aNode);  static BlockReference calcTuxBlockRef  (NodeId aNode);  static BlockReference calcDihBlockRef  (NodeId aNode);  static BlockReference calcQmgrBlockRef (NodeId aNode);  static BlockReference calcDictBlockRef (NodeId aNode);  static BlockReference calcNdbCntrBlockRef (NodeId aNode);  static BlockReference calcTrixBlockRef (NodeId aNode);  static BlockReference calcBackupBlockRef (NodeId aNode);  static BlockReference calcSumaBlockRef (NodeId aNode);  static BlockReference calcApiClusterMgrBlockRef (NodeId aNode);  /**    * allocRecord   * Allocates memory for the datastructures where ndb keeps the data   *   */  void* allocRecord(const char * type, size_t s, size_t n, bool clear = true);    /**   * Deallocate record   *   * NOTE: Also resets pointer   */  void deallocRecord(void **, const char * type, size_t s, size_t n);    /**   * General info event (sent to cluster log)   */  void infoEvent(const char * msg, ...) const ;  void warningEvent(const char * msg, ...) const ;    /**   * The configuration object   */  const class Configuration & theConfiguration;  /**   * Get node state   */  const NodeState & getNodeState() const;  /**   * Get node info   */  const NodeInfo & getNodeInfo(NodeId nodeId) const;  NodeInfo & setNodeInfo(NodeId);  /**********************   * Xfrm stuff   */    /**

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -