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.

233 lines
5.6 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1998.
  5. //
  6. // File: CCI.Hxx
  7. //
  8. // Contents: CI wrapper for export
  9. //
  10. // Classes: CCI
  11. //
  12. // History: 19-Aug-91 KyleP Created.
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include <pfilter.hxx>
  17. #include <ciintf.h>
  18. class CIndexNotificationTable;
  19. //
  20. // Status flags for CCI - returned in flags from Query
  21. //
  22. ULONG const CI_NOT_UP_TO_DATE = 0x1;
  23. ULONG const CI_NOISE_PHRASE = 0x2;
  24. ULONG const CI_NOISE_IN_PHRASE = 0x4;
  25. ULONG const CI_TOO_MANY_NODES = 0x8;
  26. class CContentIndex;
  27. class CCursor;
  28. class CRestriction;
  29. class CDocList;
  30. class CEntryBuffer;
  31. class CRWStore;
  32. class CCiFrameworkParams;
  33. class PStorage;
  34. class CiProxy;
  35. class PSaveProgressTracker;
  36. #if CIDBG == 1
  37. void SetGlobalInfoLevel ( ULONG level );
  38. #endif // CIDBG == 1
  39. //+---------------------------------------------------------------------------
  40. //
  41. // Class: CCI (ci)
  42. //
  43. // Purpose: External interface to the content index
  44. //
  45. // Interface:
  46. //
  47. // History: 20-Aug-91 KyleP Created.
  48. // 03-Nov-93 w-PatG Added stubs for Keylist methods.
  49. //
  50. // Notes: This class is a wrapper for the 'real' content index
  51. // object. It is very difficult to export the real content
  52. // index because it contains embedded, private objects.
  53. //
  54. //----------------------------------------------------------------------------
  55. class CCI
  56. {
  57. public:
  58. //
  59. // Constructors and Destructors
  60. //
  61. CCI( PStorage & storage,
  62. CCiFrameworkParams & params,
  63. ICiCDocStore * pIDocStore,
  64. CI_STARTUP_INFO const & startupInfo,
  65. IPropertyMapper * pPropertyMapper,
  66. XInterface<CIndexNotificationTable> & xNotifTable );
  67. ~CCI();
  68. //
  69. // Document Update
  70. //
  71. unsigned ReserveUpdate( WORKID wid );
  72. SCODE Update ( unsigned iHint,
  73. WORKID wid,
  74. PARTITIONID partid,
  75. USN usn,
  76. VOLUMEID volumeId,
  77. ULONG action );
  78. void FlushUpdates();
  79. //
  80. // Scan support
  81. //
  82. void MarkOutOfDate();
  83. void MarkUpToDate();
  84. //
  85. // Queries
  86. //
  87. CCursor* Query( CRestriction const * pRst,
  88. ULONG* pFlags,
  89. UINT cPartitions,
  90. PARTITIONID aPartID[],
  91. ULONG cPendingChanges,
  92. ULONG cMaxNodes );
  93. //
  94. // Relevant words
  95. //
  96. CRWStore * ComputeRelevantWords(ULONG cRows,ULONG cRW,WORKID *pwid,
  97. PARTITIONID partid);
  98. CRWStore * RetrieveRelevantWords(BOOL fAcquire,PARTITIONID partid);
  99. //
  100. // Merging
  101. //
  102. NTSTATUS ForceMerge ( PARTITIONID partid, CI_MERGE_TYPE mt );
  103. NTSTATUS AbortMerge ( PARTITIONID partid );
  104. //
  105. // Filtering
  106. //
  107. SCODE FilterReady ( BYTE * docBuffer, ULONG & cb, ULONG cMaxDocs );
  108. SCODE FilterDataReady ( const BYTE * pEntryBuf, ULONG cb );
  109. SCODE FilterMore ( const STATUS * aStatus, ULONG count );
  110. SCODE FilterDone ( const STATUS * aStatus, ULONG count );
  111. SCODE FilterStoreValue( WORKID widFake,
  112. CFullPropSpec const & ps,
  113. CStorageVariant const & var,
  114. BOOL & fStored );
  115. SCODE FilterStoreSecurity( WORKID widFake,
  116. PSECURITY_DESCRIPTOR pSD,
  117. ULONG cbSD,
  118. BOOL & fStored );
  119. //
  120. // Pid-Remapping.
  121. //
  122. SCODE FPSToPROPID( CFullPropSpec const & fps, PROPID & pid );
  123. CiProxy * GetFilterProxy();
  124. //
  125. // Partition Maintenance
  126. //
  127. void CreatePartition(PARTITIONID partID);
  128. void DestroyPartition(PARTITIONID partID);
  129. void MergePartitions(PARTITIONID partDest, PARTITIONID partSrc);
  130. void BackDoor ( int cb, BYTE* buf );
  131. #if CIDBG == 1
  132. ULONG SetInfoLevel ( ULONG level );
  133. #endif // CIDBG == 1
  134. //
  135. // KeyList Specific
  136. //
  137. ULONG KeyToId( CKey const * pkey );
  138. void IdToKey( ULONG ulKid, CKey & rkey );
  139. //
  140. // Startup, Shutdown, Resource & Corruption tracking.
  141. //
  142. NTSTATUS Dismount();
  143. void SetPartition( PARTITIONID PartId );
  144. PARTITIONID GetPartition() const;
  145. SCODE Create( ICiCDocStore * pICiCDocStore,
  146. CI_STARTUP_INFO const & startupInfo,
  147. CCiFrameworkParams & params,
  148. XInterface<CIndexNotificationTable> & xIndexNotifTable );
  149. void Empty();
  150. SCODE GetCreateStatus() const
  151. {
  152. if ( 0 == _pci )
  153. return _createStatus;
  154. else
  155. return STATUS_SUCCESS;
  156. }
  157. SCODE BackupCiData( PStorage & storage,
  158. BOOL & fFull,
  159. XInterface<ICiEnumWorkids> & xEnumWorkids,
  160. PSaveProgressTracker & progressTracker );
  161. NTSTATUS CiState(CIF_STATE & state);
  162. NTSTATUS IndexSize( ULONG & mbIndex ); // size of indexes in MBs
  163. NTSTATUS IsLowOnDiskSpace( BOOL & fLow );
  164. NTSTATUS VerifyIfLowOnDiskSpace( BOOL & fLow );
  165. NTSTATUS MarkCorruptIndex();
  166. BOOL IsCiCorrupt();
  167. private:
  168. CContentIndex * _pci; // Active content index
  169. PStorage& _storage; // Storage
  170. CMutexSem _mutex;
  171. SCODE _createStatus; // Status from creation
  172. XInterface<IPropertyMapper> _xPropMapper;
  173. // Property to Propid mapper
  174. };