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.

154 lines
6.1 KiB

  1. /*++
  2. Module Name:
  3. hsmreclq.h
  4. Abstract:
  5. This header file defines the CHsmRecallQueue object, which is used by the HSM
  6. Engine to direct work to be performed by the Remote Storage system.
  7. Author:
  8. Ravisankar Pudipeddi [ravisp]
  9. Revision History:
  10. --*/
  11. #include "resource.h" // main symbols
  12. #include "wsb.h" // Wsb structure definitions
  13. #include "rms.h" // RMS structure definitions
  14. #include "job.h" // RMS structure definitions
  15. #include "metalib.h" // metadata library structure definitions
  16. #include "fsalib.h" // FSA structure definitions
  17. #include "tsklib.h" // FSA structure definitions
  18. #include "mvrint.h" // Datamover interface
  19. #ifndef __HSMRECALLQUEUE__
  20. #define __HSMRECALLQUEUE__
  21. /////////////////////////////////////////////////////////////////////////////
  22. // task
  23. class CHsmRecallQueue :
  24. public CComObjectRoot,
  25. public IHsmRecallQueue,
  26. public IHsmSessionSinkEveryEvent,
  27. public IHsmSessionSinkEveryState,
  28. public CComCoClass<CHsmRecallQueue,&CLSID_CHsmRecallQueue>
  29. {
  30. public:
  31. CHsmRecallQueue() {}
  32. BEGIN_COM_MAP(CHsmRecallQueue)
  33. COM_INTERFACE_ENTRY(IHsmRecallQueue)
  34. COM_INTERFACE_ENTRY(IHsmSessionSinkEveryEvent)
  35. COM_INTERFACE_ENTRY(IHsmSessionSinkEveryState)
  36. END_COM_MAP()
  37. DECLARE_REGISTRY_RESOURCEID( IDR_CHsmRecallQueue )
  38. // IHsmRecallQueue
  39. public:
  40. STDMETHOD(FinalConstruct)(void);
  41. STDMETHOD(FinalRelease)(void);
  42. STDMETHOD(Add)(IFsaPostIt *pFsaWorkItem, IN GUID *pBagId, IN LONGLONG dataSetStart);
  43. STDMETHOD(Init)(IUnknown *pServer, IHsmFsaTskMgr *pTskMgr);
  44. STDMETHOD(Start)( void );
  45. STDMETHOD(Stop)( void );
  46. STDMETHOD(ContactOk)( void );
  47. STDMETHOD(ProcessSessionEvent)(IHsmSession *pSession, HSM_JOB_PHASE phase,
  48. HSM_JOB_EVENT event);
  49. STDMETHOD(ProcessSessionState)(IHsmSession* pSession, IHsmPhase* pPhase,
  50. OLECHAR* currentPath);
  51. STDMETHOD(RaisePriority)(HSM_JOB_PHASE jobPhase, IHsmSession *pSession);
  52. STDMETHOD(Remove)(IHsmRecallItem *pWorkItem);
  53. STDMETHOD(LowerPriority)(HSM_JOB_PHASE jobPhase, IHsmSession *pSession);
  54. STDMETHOD(GetMediaId) (OUT GUID *mediaId);
  55. STDMETHOD(SetMediaId) (IN GUID *mediaId);
  56. STDMETHOD(IsEmpty) ( void );
  57. // IHsmSystemState
  58. STDMETHOD( ChangeSysState )( HSM_SYSTEM_STATE* pSysState );
  59. // Internal Helper functions
  60. STDMETHOD(RecallIt)( IHsmRecallItem *pWorkItem );
  61. STDMETHOD(CheckRms)(void);
  62. STDMETHOD(CheckSession)(IHsmSession* pSession, IHsmRecallItem *pWorkItem);
  63. STDMETHOD(MountMedia)(IHsmRecallItem *pWorkItem, GUID mediaToMount, BOOL bShortWait=FALSE );
  64. STDMETHOD(GetSource)(IFsaPostIt *pFsaWorkItem, OLECHAR **pSourceString);
  65. STDMETHOD(EndRecallSession)(IHsmRecallItem *pWorkItem, BOOL cancelled);
  66. STDMETHOD(GetScanItem)(IFsaPostIt *fsaWorkItem, IFsaScanItem** ppIFsaScanItem);
  67. STDMETHOD(DoWork)(void);
  68. STDMETHOD(DoFsaWork)(IHsmRecallItem *pWorkItem);
  69. STDMETHOD(SetState)(HSM_JOB_STATE state, HSM_JOB_PHASE phase, IHsmSession *pSession);
  70. STDMETHOD(Cancel)(HSM_JOB_PHASE jobPhase, IHsmSession *pSession);
  71. STDMETHOD(FailJob)(IHsmRecallItem *pWorkItem);
  72. STDMETHOD(GetMediaParameters)(void);
  73. STDMETHOD(DismountMedia)( BOOL bNoDelay = FALSE);
  74. STDMETHOD(ConvertRmsCartridgeType)(LONG rmsCartridgeType,
  75. HSM_JOB_MEDIA_TYPE *pMediaType);
  76. void (ReportMediaProgress)(HSM_JOB_MEDIA_STATE state, HRESULT status);
  77. STDMETHOD(MarkWorkItemAsDone)(IHsmSession *pSession, HSM_JOB_PHASE jobPhase);
  78. STDMETHOD(CheckRegistry)(void);
  79. STDMETHOD(TranslateRmsMountHr)(HRESULT rmsHr);
  80. STDMETHOD(UnsetMediaInfo)(void);
  81. STDMETHOD(FindRecallItemToCancel(IHsmRecallItem *pWorkItem, IHsmRecallItem **pWorkItemToCancel));
  82. // Data
  83. // We want the next pointers (to the Hsm Server) to be weak
  84. // references and **not** add ref the object. This is so shutting
  85. // down the server really works.
  86. IHsmServer *m_pServer;
  87. IWsbCreateLocalObject *m_pHsmServerCreate;
  88. IHsmFsaTskMgr *m_pTskMgr;
  89. CComPtr<IRmsServer> m_pRmsServer;
  90. CComPtr<IRmsCartridge> m_pRmsCartridge;
  91. CComPtr<IDataMover> m_pDataMover;
  92. //
  93. // The recall queue..
  94. //
  95. CComPtr<IWsbIndexedCollection> m_pWorkToDo;
  96. BOOL m_TerminateQueue; // True only if the queue should terminate while
  97. // there is still work in progress
  98. // Data mover info
  99. GUID m_MediaId;
  100. GUID m_MountedMedia;
  101. HSM_JOB_MEDIA_TYPE m_MediaType;
  102. CWsbStringPtr m_MediaName;
  103. CWsbStringPtr m_MediaBarCode;
  104. LONGLONG m_MediaFreeSpace;
  105. LONGLONG m_MediaCapacity;
  106. BOOL m_MediaReadOnly;
  107. GUID m_HsmId;
  108. GUID m_RmsMediaSetId;
  109. CWsbBstrPtr m_RmsMediaSetName;
  110. HSM_WORK_QUEUE_TYPE m_QueueType;
  111. FILETIME m_MediaUpdate;
  112. // Session reporting information
  113. HSM_JOB_PRIORITY m_JobPriority;
  114. HANDLE m_WorkerThread;
  115. CWsbStringPtr m_CurrentPath;
  116. CWsbStringPtr m_MediaBaseName;
  117. // Job abort on errors parameters
  118. ULONG m_JobAbortMaxConsecutiveErrors;
  119. ULONG m_JobAbortMaxTotalErrors;
  120. ULONG m_JobConsecutiveErrors;
  121. ULONG m_JobTotalErrors;
  122. ULONG m_JobAbortSysDiskSpace;
  123. LONGLONG m_CurrentSeekOffset;
  124. };
  125. #endif // __HSMRECALLQUEUE__