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.

231 lines
5.8 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. #if CIDBG == 1
  131. ULONG SetInfoLevel ( ULONG level );
  132. #endif // CIDBG == 1
  133. //
  134. // KeyList Specific
  135. //
  136. ULONG KeyToId( CKey const * pkey );
  137. void IdToKey( ULONG ulKid, CKey & rkey );
  138. //
  139. // Startup, Shutdown, Resource & Corruption tracking.
  140. //
  141. NTSTATUS Dismount();
  142. void SetPartition( PARTITIONID PartId );
  143. PARTITIONID GetPartition() const;
  144. SCODE Create( ICiCDocStore * pICiCDocStore,
  145. CI_STARTUP_INFO const & startupInfo,
  146. CCiFrameworkParams & params,
  147. XInterface<CIndexNotificationTable> & xIndexNotifTable );
  148. void Empty();
  149. SCODE GetCreateStatus() const
  150. {
  151. if ( 0 == _pci )
  152. return _createStatus;
  153. else
  154. return STATUS_SUCCESS;
  155. }
  156. SCODE BackupCiData( PStorage & storage,
  157. BOOL & fFull,
  158. XInterface<ICiEnumWorkids> & xEnumWorkids,
  159. PSaveProgressTracker & progressTracker );
  160. NTSTATUS CiState(CIF_STATE & state);
  161. NTSTATUS IndexSize( ULONG & mbIndex ); // size of indexes in MBs
  162. NTSTATUS IsLowOnDiskSpace( BOOL & fLow );
  163. NTSTATUS VerifyIfLowOnDiskSpace( BOOL & fLow );
  164. NTSTATUS MarkCorruptIndex();
  165. BOOL IsCiCorrupt();
  166. private:
  167. CContentIndex * _pci; // Active content index
  168. PStorage& _storage; // Storage
  169. CMutexSem _mutex;
  170. SCODE _createStatus; // Status from creation
  171. XInterface<IPropertyMapper> _xPropMapper;
  172. // Property to Propid mapper
  173. };