📄 hxcache2.h
字号:
STDMETHOD_(UINT32, GetCapacity) (THIS) PURE; /************************************************************************ * Method: * * IHXCacheObject::ChangeCapacity * * Purpose: * * Changes the capacity of the cache object (in bytes). It is used to * increase or decrease the capacity after the cache object has been * created and it's capacity set usinf Init(). This method can * be called any number of times. If new capacity is less than old capacity, * the oldest data are discarded. * */ STDMETHOD(ChangeCapacity) (THIS_ UINT32 /*IN*/ newByteCount) PURE; /************************************************************************ * Method: * * IHXCacheObject::GetUnusedCapacity * * Purpose: * * Obtain the unused capacity in bytes of the cache object. */ STDMETHOD_(UINT32, GetUnusedCapacity) (THIS) PURE; /************************************************************************ * Method: * * IHXCacheObject::AddBlock * * Purpose: * * Adds a block of data to the cache. * NOTE: !!! The data should be added in a linear fashion. To be precise, * the starting offset of the currently being added block should be * exactly one more than the ending offset of the most previously * added block. * Returns HXR_OK for success and HXR_OUTOFMEMORY if the cache can't * accomodate the block (since it has a fixed capacity). * */ STDMETHOD(AddBlock) (THIS_ IHXBuffer* /*IN*/ pBlock) PURE; /************************************************************************ * Method: * * IHXCacheObject::VerifyBlock * * Purpose: * * Verify that a block of data is in the cache. */ STDMETHOD(VerifyBlock) (THIS_ UINT32 /*IN*/ ulBlockOffset, UINT32 /*IN*/ ulBlockLength) PURE; /************************************************************************ * Method: * * IHXCacheObject::ReadBlock * * Purpose: * * Read a block out of the cache. Returns HXR_OK if it can supply * *all* data. It returns HXR_FAIL if, at some point in the past, * it had the data but has since discarded (a part of whole of) it. * It returns HXR_INCOMPLETE in all other cases, viz * * (1) Only part of the data is present but no part of the data * was discarded in the past. * (2) No part of the requested data is present but is expected * to be recieved in the future. * * To understand it clearly, visulaize yourself storing the data of a * remote file as it arrives to you. As you keep storing more and more * data, then the cache keeps discarding some of the old data. Now, this * discarded data can never be got back by cache. Hence when the user * request contains some data which has already been discarded, then * the cache replies back with HXR_FAIL otherwise it is HXR_INCOMPLETE * or HXR_OK depending on whether on how much of data it can supply *now*. * */ STDMETHOD(ReadBlock) (THIS_ UINT32 /*IN*/ ulBlockOffset, UINT32 /*IN*/ ulBlockLength) PURE; /************************************************************************ * Method: * IHXCacheObject::Flush * * Purpose: * * Releases all data buffers cached in the object. The object now * gets to a same state as it was when newly created. After flushing, * the object can be used for writing/reading as before. */ STDMETHOD(Flush) (THIS) PURE; /************************************************************************ * Method: * * IHXCacheObject::IsFull * * Purpose: * * Is UnusedCapacity = 0? */ STDMETHOD_(BOOL, IsFull) (THIS) PURE; /************************************************************************ * Method: * * IHXCacheObject::IsEmpty * * Purpose: * * Is UnusedCapacity = TotalCapacity? */ STDMETHOD_(BOOL, IsEmpty) (THIS) PURE;}; // IHXCacheObject/**************************************************************************** * * Interface: * * IHXCacheObjectResponse * * Purpose: * * Response interface for IHXCacheObject operations * * IID_IHXCacheObjectResponse: * * {00002E11-0901-11d1-8B06-00A024406D59} * */DEFINE_GUID(IID_IHXCacheObjectResponse, 0x00002E11, 0x901, 0x11d1, 0x8b, 0x6, 0x0, 0xa0, 0x24, 0x40, 0x6d, 0x59);#undef INTERFACE#define INTERFACE IHXCacheObjectResponseDECLARE_INTERFACE_(IHXCacheObjectResponse, IUnknown){ /* * IUnknown methods */ STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj) PURE; STDMETHOD_(ULONG32,AddRef) (THIS) PURE; STDMETHOD_(ULONG32,Release) (THIS) PURE; /* * IHXCacheObjectResponse methods */ /************************************************************************ * Method: * * IHXCacheObjectResponse::InitDone * * Purpose: * * Notification that IHXCacheObject::Init call has completed. */ STDMETHOD(InitDone) (THIS_ HX_RESULT /*IN*/ status) PURE; /************************************************************************ * Method: * * IHXCacheObjectResponse::ChangeCapacityDone * * Purpose: * * Notification that IHXCacheObject::ChangeCapacity call has completed. */ STDMETHOD(ChangeCapacityDone) (THIS_ HX_RESULT /*IN*/ status) PURE; /************************************************************************ * Method: * * IHXCacheObjectResponse::AddBlockDone * * Purpose: * * Notification that IHXCacheObject::AddBlock operation has completed. */ STDMETHOD(AddBlockDone) (THIS_ HX_RESULT /*IN*/ status) PURE; /************************************************************************ * Method: * * IHXCacheObjectResponse::VerifyBlockDone * * Purpose: * * Notification that IHXCacheObject::VerifyBlock operation has * completed. */ STDMETHOD(VerifyBlockDone) (THIS_ BOOL /*IN*/ bExist) PURE; /************************************************************************ * Method: * * IHXCacheObjectResponse::ReadBlockDone * * Purpose: * * Notification that IHXCacheObject::ReadBlock operation has * completed. */ STDMETHOD(ReadBlockDone) (THIS_ HX_RESULT /*IN*/ status, IHXBuffer* /*IN*/ pBuffer) PURE; /************************************************************************ * Method: * * IHXCacheObjectResponse::FlushDone * * Purpose: * * Notification that IHXCacheObject::Flush operation has completed. */ STDMETHOD(FlushDone) (THIS_ HX_RESULT /*IN*/ status) PURE;}; // IHXCacheObjectResponse#endif /* _HXCACHE2_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -