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.

203 lines
5.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1992.
  5. //
  6. // File: PARTLST.HXX
  7. //
  8. // Contents: Partition List
  9. //
  10. // Classes: CPartList
  11. //
  12. // History: 28-Mar-91 BartoszM Created.
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. //+---------------------------------------------------------------------------
  17. //
  18. // Class: CPartList (pl)
  19. //
  20. // Purpose: List of partitions in Content Index
  21. //
  22. // Interface: CPartition
  23. // ~CPartition
  24. //
  25. // History: 28-Mar-91 BartoszM Created.
  26. //
  27. // Notes:
  28. //
  29. //----------------------------------------------------------------------------
  30. #include <pidxtbl.hxx>
  31. #include <frmutils.hxx>
  32. #include "prtiflst.hxx"
  33. class CPartition;
  34. class PStorage;
  35. class CContentIndex;
  36. class CTransaction;
  37. class CMergeTrans;
  38. class CIndexId;
  39. class CKeyList;
  40. class CDiskIndex;
  41. class CResManager;
  42. typedef CDynArrayInPlace<INDEXID> CIndexIdList;
  43. const unsigned maxPartitions = 255;
  44. // const PARTITIONID partidDefault = 1;
  45. DECL_DYNARRAY( CPartArray, CPartition );
  46. class CIndexDesc
  47. {
  48. public:
  49. inline CIndexDesc( CIndexRecord & rec )
  50. : _iid( rec.Iid() ),
  51. _objectid( rec.ObjectId() )
  52. {
  53. }
  54. inline INDEXID const Iid() { return _iid; }
  55. inline WORKID const ObjectId() { return _objectid; }
  56. public:
  57. INDEXID _iid;
  58. WORKID _objectid;
  59. };
  60. DECL_DYNSTACK( CIidStack, CIndexDesc );
  61. const LONGLONG eSigPartList = 0x5453494c54524150i64; // "PARTLIST"
  62. class CPartList : INHERIT_UNWIND
  63. {
  64. DECLARE_UNWIND
  65. friend class CPartIter;
  66. friend class CPartIdIter;
  67. public:
  68. CPartList ( PStorage& storage, PIndexTable & idxTab,
  69. XPtr<CKeyList> & sKeylist, CTransaction& xact,
  70. CCiFrameworkParams & frmwrkParams );
  71. CPartition* LokGetPartition ( PARTITIONID partid );
  72. void LokSwapIndexes( CMergeTrans& xact,
  73. PARTITIONID partid,
  74. CDiskIndex * indexNew,
  75. CShadowMergeSwapInfo & info );
  76. void LokSwapIndexes( CMergeTrans& xact,
  77. PARTITIONID partid,
  78. CDiskIndex * indexNew,
  79. CMasterMergeSwapInfo & info,
  80. CKeyList const * pOldKeyList,
  81. CKeyList const * pNewKeyList
  82. );
  83. void LokRemoveIndex ( CIndexId iid );
  84. unsigned LokWlCount ();
  85. unsigned LokIndexCount ();
  86. unsigned LokIndexSize ();
  87. #ifdef KEYLIST_ENABLED
  88. void LokSwapKeyList( CKeyList const * pOldKeyList,
  89. CKeyList const * pNewKeyList );
  90. void LokRemoveKeyList( CKeyList const * pKeyList );
  91. #endif // KEYLIST_ENABLED
  92. WORKID GetChangeLogObjectId( PARTITIONID partid );
  93. void RestoreMMergeState( CResManager & resman, PStorage & storage );
  94. void LokAddIt( WORKID objectId, IndexType it, PARTITIONID partid );
  95. #ifdef CIEXTMODE
  96. void CiExtDump(void *ciExtSelf);
  97. #endif
  98. private:
  99. CIndex* RestoreIndex ( CIndexRecord & rec,
  100. CIndexIdList & iidsInUse,
  101. CIidStack & stkZombie);
  102. PARTITIONID MaxPartid () const
  103. {
  104. return (PARTITIONID)(_partArray.Size() - 1);
  105. }
  106. BOOL IsValid ( PARTITIONID partid ) const
  107. {
  108. return ( partid < _partArray.Size() &&
  109. _partArray.Get(partid) != 0 );
  110. }
  111. const LONGLONG _sigPartList;
  112. CCiFrameworkParams & _frmwrkParams;
  113. PIndexTable & _idxTab; // index table
  114. SPartInfoList _partInfoList;
  115. CPartArray _partArray; // a dynamic array of partition pointers
  116. };
  117. //+---------------------------------------------------------------------------
  118. //
  119. // Class: CPartIter
  120. //
  121. // Purpose: Partition Iterator
  122. //
  123. // History: 23-Jul-91 BartoszM Created.
  124. //
  125. //----------------------------------------------------------------------------
  126. class CPartIter
  127. {
  128. public:
  129. void LokInit( CPartList& partList );
  130. void LokAdvance ( CPartList& partLst );
  131. BOOL LokAtEnd() { return _curPartId == partidInvalid; }
  132. CPartition* LokGet() { return _pPart; }
  133. private:
  134. CPartition* _pPart;
  135. PARTITIONID _curPartId;
  136. };
  137. //+---------------------------------------------------------------------------
  138. //
  139. // Class: CPartIdIter
  140. //
  141. // Purpose: Partition ID Iterator
  142. //
  143. // History: 23-Jul-91 BartoszM Created.
  144. //
  145. //----------------------------------------------------------------------------
  146. class CPartIdIter
  147. {
  148. public:
  149. void LokInit( CPartList& partList );
  150. void LokAdvance ( CPartList& partList );
  151. BOOL LokAtEnd() { return _curPartId == partidInvalid; }
  152. PARTITIONID LokGetId () { return _curPartId; }
  153. private:
  154. PARTITIONID _curPartId;
  155. };