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.

167 lines
3.2 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1994 **/
  4. /**********************************************************************/
  5. /*
  6. blobcach.hxx
  7. This module declares the private interface to the Blob cache
  8. FILE HISTORY:
  9. MCourage 18-Dec-1997 Created
  10. */
  11. #ifndef _BLOBCACH_HXX_
  12. #define _BLOBCACH_HXX_
  13. typedef BOOL (*PBLOBFILTERRTN)(PBLOB_HEADER pBlob, PVOID pv);
  14. BOOL
  15. BlobCache_Initialize(
  16. VOID
  17. );
  18. VOID
  19. BlobCache_Terminate(
  20. VOID
  21. );
  22. BOOL
  23. CacheBlob(
  24. IN PBLOB_HEADER pBlob
  25. );
  26. VOID
  27. DecacheBlob(
  28. IN PBLOB_HEADER pBlob
  29. );
  30. VOID
  31. FlushBlobCache(
  32. VOID
  33. );
  34. VOID
  35. FilteredFlushBlobCache (
  36. IN PBLOBFILTERRTN pFilterRoutine,
  37. IN PVOID pv
  38. );
  39. VOID
  40. FilteredFlushURIBlobCache (
  41. IN PBLOBFILTERRTN pFilterRoutine,
  42. IN PVOID pv
  43. );
  44. BOOL
  45. CheckoutBlob(
  46. IN LPCSTR pstrPath,
  47. IN ULONG cchPath,
  48. IN DWORD dwService,
  49. IN DWORD dwInstance,
  50. IN ULONG iDemux,
  51. OUT PBLOB_HEADER * ppBlob
  52. );
  53. BOOL
  54. CheckoutBlobEntry(
  55. IN PBLOB_HEADER pBlob
  56. );
  57. VOID
  58. CheckinBlob(
  59. IN PBLOB_HEADER pBlob
  60. );
  61. class TS_BLOB_FLUSH_STATE
  62. {
  63. public:
  64. LIST_ENTRY ListHead;
  65. PBLOBFILTERRTN pfnFilter;
  66. PVOID pvParm;
  67. };
  68. class CBlobCacheStats
  69. {
  70. private:
  71. DWORD BlobsCached; // # of blobs currently in the cache
  72. DWORD TotalBlobsCached; // # of blobs added to the cache ever
  73. DWORD Hits; // cache hits
  74. DWORD Misses; // cache misses
  75. DWORD Flushes; // flushes due to dir change or other
  76. DWORD TotalFlushed; // # of entries ever flushed from the cache
  77. public:
  78. CBlobCacheStats()
  79. : BlobsCached(0),
  80. TotalBlobsCached(0),
  81. Hits(0),
  82. Misses(0),
  83. Flushes(0),
  84. TotalFlushed(0)
  85. {}
  86. BOOL DumpToHtml(CHAR * pchBuffer, LPDWORD lpcbBuffer) const;
  87. BOOL QueryStats(INETA_CACHE_STATISTICS * pCacheCtrs) const;
  88. DWORD GetBlobsCached() const
  89. {
  90. return BlobsCached;
  91. }
  92. DWORD GetTotalBlobsCached() const
  93. {
  94. return TotalBlobsCached;
  95. }
  96. DWORD GetHits() const
  97. {
  98. return Hits;
  99. }
  100. DWORD GetMisses() const
  101. {
  102. return Misses;
  103. }
  104. DWORD GetFlushes() const
  105. {
  106. return Flushes;
  107. }
  108. DWORD GetTotalFlushed() const
  109. {
  110. return TotalFlushed;
  111. }
  112. VOID IncBlobsCached(VOID)
  113. {
  114. InterlockedIncrement((LONG *)&BlobsCached);
  115. InterlockedIncrement((LONG *)&TotalBlobsCached);
  116. }
  117. VOID DecBlobsCached(VOID)
  118. {
  119. InterlockedDecrement((LONG *)&BlobsCached);
  120. }
  121. VOID IncHits(VOID)
  122. {
  123. InterlockedIncrement((LONG *)&Hits);
  124. }
  125. VOID IncMisses(VOID)
  126. {
  127. InterlockedIncrement((LONG *)&Misses);
  128. }
  129. VOID IncFlushes(VOID)
  130. {
  131. InterlockedIncrement((LONG *)&Flushes);
  132. }
  133. };
  134. #endif