Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

191 lines
5.2 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CClusDBJoin.h
  7. //
  8. // Description:
  9. // Header file for CClusDBJoin class.
  10. // The CClusDBJoin class is an action that creates the cluster database
  11. // during a cluster join.
  12. //
  13. // Implementation Files:
  14. // CClusDBJoin.cpp
  15. //
  16. // Maintained By:
  17. // Vij Vasu (Vvasu) 03-MAR-2000
  18. //
  19. //////////////////////////////////////////////////////////////////////////////
  20. // Make sure that this file is included only once per compile path.
  21. #pragma once
  22. //////////////////////////////////////////////////////////////////////////
  23. // Include Files
  24. //////////////////////////////////////////////////////////////////////////
  25. // For the CClusDB base class
  26. #include "CClusDB.h"
  27. // For HNODE
  28. #include <ClusAPI.h>
  29. // For BYTE_PIPE, JoinAddNode3() and DmSyncDatabase()
  30. #include "ClusRPC.h"
  31. //////////////////////////////////////////////////////////////////////////
  32. // Forward declaration
  33. //////////////////////////////////////////////////////////////////////////
  34. class CBaseClusterJoin;
  35. //////////////////////////////////////////////////////////////////////////////
  36. //++
  37. //
  38. // class CClusDBJoin
  39. //
  40. // Description:
  41. // The CClusDBJoin class is an action that creates the cluster database
  42. // during a cluster join.
  43. //
  44. //--
  45. //////////////////////////////////////////////////////////////////////////////
  46. class CClusDBJoin : public CClusDB
  47. {
  48. public:
  49. //////////////////////////////////////////////////////////////////////////
  50. // Constructors and destructors
  51. //////////////////////////////////////////////////////////////////////////
  52. // Constructor.
  53. CClusDBJoin( CBaseClusterJoin * pcjClusterJoinIn );
  54. // Default destructor.
  55. ~CClusDBJoin();
  56. //////////////////////////////////////////////////////////////////////////
  57. // Public methods
  58. //////////////////////////////////////////////////////////////////////////
  59. //
  60. // Create the ClusDB.
  61. //
  62. void Commit();
  63. //
  64. // Rollback this creation.
  65. //
  66. void Rollback();
  67. // Returns the number of progress messages that this action will send.
  68. UINT
  69. UiGetMaxProgressTicks() const throw()
  70. {
  71. //
  72. // The three notifications are:
  73. // 1. Cleaning up any old cluster database files that may exist.
  74. // 2. Creating cluster database.
  75. // 3. Synchronizing cluster database.
  76. //
  77. return 3;
  78. }
  79. private:
  80. //////////////////////////////////////////////////////////////////////////
  81. // Private types
  82. //////////////////////////////////////////////////////////////////////////
  83. // The base class of this class.
  84. typedef CClusDB BaseClass;
  85. // Smart handle to a cluster node.
  86. typedef CSmartResource<
  87. CHandleTrait<
  88. HNODE
  89. , BOOL
  90. , CloseClusterNode
  91. , reinterpret_cast< HNODE >( NULL )
  92. >
  93. >
  94. SmartNodeHandle;
  95. // Smart file handle
  96. typedef CSmartResource< CHandleTrait< HANDLE, BOOL, CloseHandle, INVALID_HANDLE_VALUE > > SmartFileHandle;
  97. //////////////////////////////////////////////////////////////////////////
  98. // Private methods
  99. //////////////////////////////////////////////////////////////////////////
  100. // Create the cluster database
  101. void
  102. Create();
  103. // Cleanup the cluster database
  104. void
  105. Cleanup();
  106. // Synchronize the cluster database with the sponsor cluster.
  107. void Synchronize();
  108. // Callback function used by RPC to push data.
  109. static void
  110. S_BytePipePush(
  111. char * pchStateIn
  112. , unsigned char * pchBufferIn
  113. , unsigned long ulBufferSizeIn
  114. );
  115. // Callback function used by RPC to pull data.
  116. static void
  117. S_BytePipePull(
  118. char * pchStateIn
  119. , unsigned char * pchBufferIn
  120. , unsigned long ulBufferSizeIn
  121. , unsigned long * pulWrittenOut
  122. );
  123. // Callback function used by RPC to allocate a buffer.
  124. static void
  125. S_BytePipeAlloc(
  126. char * pchStateIn
  127. , unsigned long ulRequestedSizeIn
  128. , unsigned char ** ppchBufferOut
  129. , unsigned long * pulActualSizeOut
  130. );
  131. //////////////////////////////////////////////////////////////////////////
  132. // Private data
  133. //////////////////////////////////////////////////////////////////////////
  134. // Size of the byte pipe buffer
  135. static const int ms_nFILE_PIPE_BUFFER_SIZE = 4096;
  136. // Handle to the local cluster DB file.
  137. HANDLE m_hClusDBFile;
  138. // Indicates if this node has been added to the sponsor database or not.
  139. bool m_fHasNodeBeenAddedToSponsorDB;
  140. // Pointer to the parent of this action.
  141. CBaseClusterJoin * m_pcjClusterJoin;
  142. // Pipe used by RPC to get the sponsor cluster database across.
  143. BYTE_PIPE m_bpBytePipe;
  144. // Buffer used by the byte pipe.
  145. BYTE m_rgbBytePipeBuffer[ ms_nFILE_PIPE_BUFFER_SIZE ];
  146. }; //*** class CClusDBJoin