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.

250 lines
6.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1998.
  5. //
  6. // File: CI.HXX
  7. //
  8. // Contents: Main Content Index external interface
  9. //
  10. // Classes: CContentIndex - Main content index class
  11. //
  12. // History: 26-Feb-91 KyleP Created Interface.
  13. // 25-Mar-91 BartoszM Implemented.
  14. // 03-Nov-93 w-PatG Added KeyList methods
  15. //
  16. //----------------------------------------------------------------------------
  17. #pragma once
  18. #include <lang.hxx>
  19. #include "partlst.hxx"
  20. #include "resman.hxx"
  21. #include "filtman.hxx"
  22. class CCursor;
  23. class CRestriction;
  24. class CRWStore;
  25. //+---------------------------------------------------------------------------
  26. //
  27. // Class: CContentIndex (ci)
  28. //
  29. // Purpose: External interface to the content index
  30. //
  31. // Interface:
  32. //
  33. // History: 21-Aug-91 KyleP Removed unused path member
  34. // 26-Feb-91 KyleP Created.
  35. // 03-Jan-95 BartoszM Separated Filter Manager
  36. //
  37. //----------------------------------------------------------------------------
  38. class CContentIndex
  39. {
  40. friend class CPartition;
  41. friend class CResManager;
  42. public:
  43. //
  44. // Constructors and Destructors
  45. //
  46. CContentIndex ( PStorage & storage,
  47. CCiFrameworkParams & params,
  48. ICiCDocStore * pICiCDocStore,
  49. CI_STARTUP_INFO const & startupInfo,
  50. IPropertyMapper * pIPropertyMapper,
  51. CTransaction& xact,
  52. XInterface<CIndexNotificationTable> & xIndexNotifTable );
  53. ~CContentIndex();
  54. //
  55. // Document Update
  56. //
  57. unsigned ReserveUpdate( WORKID wid );
  58. SCODE Update ( unsigned iHint,
  59. WORKID wid,
  60. PARTITIONID partid,
  61. USN usn,
  62. VOLUMEID volumeId,
  63. ULONG action );
  64. void FlushUpdates()
  65. {
  66. _resman.FlushUpdates();
  67. }
  68. //
  69. // Scan support
  70. //
  71. inline void MarkOutOfDate() { _resman.MarkOutOfDate(); }
  72. inline void MarkUpToDate() { _resman.MarkUpToDate(); }
  73. //
  74. // Queries
  75. //
  76. CCursor* Query( CRestriction const* pRst,
  77. ULONG* pFlags,
  78. UINT cPartitions,
  79. PARTITIONID aPartID[],
  80. ULONG cPendingChanges,
  81. ULONG cMaxNodes );
  82. //
  83. // Relevant words
  84. //
  85. CRWStore * ComputeRelevantWords(ULONG cRows,ULONG cRW,
  86. WORKID *pwid,PARTITIONID partid)
  87. { return _resman.ComputeRelevantWords(cRows,cRW,pwid,partid); }
  88. CRWStore * RetrieveRelevantWords(BOOL fAcquire,PARTITIONID partid)
  89. { return _resman.RetrieveRelevantWords(fAcquire,partid); }
  90. //
  91. // Filter proxy
  92. //
  93. SCODE FilterReady ( BYTE * docBuffer, ULONG & cb, ULONG cMaxDocs );
  94. SCODE FilterDataReady ( const BYTE * pEntryBuf, ULONG cb );
  95. SCODE FilterMore ( const STATUS * aStatus, ULONG count );
  96. SCODE FilterStoreValue( WORKID wid,
  97. CFullPropSpec const & ps,
  98. CStorageVariant const & var,
  99. BOOL & fStored );
  100. SCODE FilterStoreSecurity( WORKID widFake,
  101. PSECURITY_DESCRIPTOR pSD,
  102. ULONG cbSD,
  103. BOOL & fStored );
  104. SCODE FilterDone ( const STATUS * aStatus, ULONG count );
  105. SCODE FPSToPROPID( CFullPropSpec const & fps, PROPID & pid );
  106. CiProxy & GetFilterProxy()
  107. {
  108. return _filterMan;
  109. }
  110. //
  111. // Partition Maintenance
  112. //
  113. void CreatePartition(PARTITIONID partID);
  114. void DestroyPartition(PARTITIONID partID);
  115. void MergePartitions(PARTITIONID partDest,
  116. PARTITIONID partSrc);
  117. NTSTATUS ForceMerge ( PARTITIONID partid, CI_MERGE_TYPE mt )
  118. {
  119. return _resman.ForceMerge ( partid, mt );
  120. }
  121. NTSTATUS AbortMerge ( PARTITIONID partid )
  122. {
  123. return _resman.StopCurrentMerge();
  124. }
  125. unsigned CountPendingUpdates() { return _resman.CountPendingUpdates() ; }
  126. #if CIDBG == 1
  127. // Debugging support (debug version only)
  128. void DebugStats(/* CIDEBSTATS *pciDebStats */);
  129. void DumpIndexes( FILE * pf, INDEXID iid, ULONG fSummaryOnly );
  130. void DumpWorkId( BYTE * pb, ULONG cb );
  131. #endif // CIDBG == 1
  132. //KeyList Specific Methods
  133. ULONG KeyToId( CKey const * pkey );
  134. void IdToKey( ULONG ulKid, CKey & rkey );
  135. NTSTATUS Dismount();
  136. void SetPartition( PARTITIONID PartId );
  137. PARTITIONID GetPartition() const;
  138. void Empty() { _resman.Empty(); }
  139. ULONG GetQueryCount() { return _resman.GetQueryCount(); }
  140. BOOL IsEmpty() const { return _resman.IsEmpty(); }
  141. SCODE BackupCiData( PStorage & storage,
  142. BOOL & fFull,
  143. XInterface<ICiEnumWorkids> & xEnumWorkids,
  144. PSaveProgressTracker & progressTracker )
  145. {
  146. return _resman.BackupCIData( storage, fFull, xEnumWorkids, progressTracker );
  147. }
  148. NTSTATUS CiState(CIF_STATE & state)
  149. {
  150. return _resman.CiState( state );
  151. }
  152. void IndexSize( ULONG & mbIndex ) // size of indexes in MB
  153. {
  154. _resman.IndexSize( mbIndex );
  155. }
  156. BOOL IsLowOnDiskSpace()
  157. {
  158. return _resman.IsLowOnDiskSpace();
  159. }
  160. BOOL VerifyIfLowOnDiskSpace()
  161. {
  162. return _resman.VerifyIfLowOnDiskSpace();
  163. }
  164. NTSTATUS MarkCorruptIndex()
  165. {
  166. return _resman.MarkCorruptIndex();
  167. }
  168. BOOL IsCiCorrupt() { return _resman.IsCiCorrupt(); }
  169. private:
  170. PStorage& _storage;
  171. CResManager _resman; // resource manager
  172. CFilterManager _filterMan;
  173. };
  174. //+---------------------------------------------------------------------------
  175. //
  176. // Member: CContentIndex::~CContentIndex, public
  177. //
  178. // Synopsis: Destructor for the content index
  179. //
  180. // Effects: Shuts down content index and destroys global state.
  181. //
  182. // History: 26-Feb-91 KyleP Created.
  183. //
  184. //----------------------------------------------------------------------------
  185. inline CContentIndex::~CContentIndex()
  186. {
  187. }