Leaked source code of windows server 2003
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.

113 lines
3.2 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2001 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CAction.cpp
  7. //
  8. // Description:
  9. // Contains the definition of the CAction class.
  10. //
  11. // Maintained By:
  12. // David Potter (DavidP) 14-JUN-2001
  13. // Vij Vasu (Vvasu) 25-APR-2000
  14. //
  15. //////////////////////////////////////////////////////////////////////////////
  16. //////////////////////////////////////////////////////////////////////////////
  17. // Include Files
  18. //////////////////////////////////////////////////////////////////////////////
  19. // The precompiled header.
  20. #include "Pch.h"
  21. // For the CAction class
  22. #include "CAction.h"
  23. //////////////////////////////////////////////////////////////////////////////
  24. //++
  25. //
  26. // CAction::Commit
  27. //
  28. // Description:
  29. // This function just checks to make sure that this action has not already
  30. // been commmitted.
  31. //
  32. // Arguments:
  33. // None.
  34. //
  35. // Return Value:
  36. // None.
  37. //
  38. // Exceptions Thrown:
  39. // CAssert
  40. // If the action has already been committed.
  41. //
  42. //--
  43. //////////////////////////////////////////////////////////////////////////////
  44. void
  45. CAction::Commit( void )
  46. {
  47. TraceFunc( "" );
  48. // Has this action already been committed?
  49. if ( FIsCommitComplete() )
  50. {
  51. LogMsg( "[BC] This action has already been committed. Throwing exception." );
  52. THROW_ASSERT( HRESULT_FROM_WIN32( TW32( ERROR_CLUSCFG_ALREADY_COMMITTED ) ), "This action has already been committed." );
  53. } // if: already committed.
  54. TraceFuncExit();
  55. } //*** CAction::Commit
  56. //////////////////////////////////////////////////////////////////////////////
  57. //++
  58. //
  59. // CAction::Rollback
  60. //
  61. // Description:
  62. // Since the Commit() of this class does nothing, rollback does nothing
  63. // too. However, it checks to make sure that this action can indeed be
  64. // rolled back.
  65. //
  66. // Arguments:
  67. // None.
  68. //
  69. // Return Value:
  70. // None.
  71. //
  72. // Exceptions Thrown:
  73. // CAssert
  74. // If this action has not been committed yet or if rollback is not
  75. // possible.
  76. //
  77. //--
  78. //////////////////////////////////////////////////////////////////////////////
  79. void
  80. CAction::Rollback( void )
  81. {
  82. TraceFunc( "" );
  83. // Check if this action list has completed successfully.
  84. if ( ! FIsCommitComplete() )
  85. {
  86. // Cannot rollback an incomplete action.
  87. LogMsg( "[BC] Cannot rollback - this action has not been committed. Throwing exception." );
  88. THROW_ASSERT( HRESULT_FROM_WIN32( TW32( ERROR_CLUSCFG_ROLLBACK_FAILED ) ), "Cannot rollback - this action has been committed." );
  89. } // if: this action was not completed successfully
  90. // Check if this list can be rolled back.
  91. if ( ! FIsRollbackPossible() )
  92. {
  93. // Cannot rollback an incompleted action.
  94. LogMsg( "[BC] This action list cannot be rolled back." );
  95. THROW_ASSERT( HRESULT_FROM_WIN32( TW32( ERROR_CLUSCFG_ROLLBACK_FAILED ) ), "This action does not allow rollbacks." );
  96. } // if: this action was not completed successfully
  97. TraceFuncExit();
  98. } //*** CAction::Rollback