NCBI C++ ToolKit
|
Search Toolkit Book for CMergeVolumes
Main volume merge algorithm class. More...
#include <algo/volume_merge/volume_merge.hpp>
Public Types | |
typedef CSimpleBuffer | TRawBuffer |
Raw BLOB buffer type used for raw information exchange between merge algorithm interfaces Raw buffers are allocated/deallocated using one central resource pool. More... | |
typedef CResourcePool< TRawBuffer, CFastMutex > | TBufResourcePool |
Memory manager for raw buffers to avoid unnecessary reallocations and memory fragmentation. More... | |
typedef CResourcePoolGuard< TBufResourcePool > | TBufPoolGuard |
Buffer pool guard. More... | |
Public Member Functions | |
CMergeVolumes () | |
~CMergeVolumes () | |
void | SetMergeAccumulator (IMergeBlob *merger, EOwnership own=eTakeOwnership) |
Set merge accumulator component. More... | |
void | SetVolumes (const vector< IMergeVolumeWalker * > &vol_vector, EOwnership own=eTakeOwnership) |
Set merge volumes. More... | |
void | SetMergeStore (IMergeStore *store, EOwnership own=eTakeOwnership) |
Set merge store (destination) More... | |
TBufResourcePool & | GetBufResourcePool () |
Get BLOB buffer pool. More... | |
void | Run () |
Execute merge process (main merge loop) More... | |
Private Member Functions | |
void | x_EvaluateMinKey (unsigned new_key, size_t volume_idx) |
check if volume key is new minimum or equals to old minimum More... | |
void | x_ResetMinKey () |
Reset min. evaluation. More... | |
void | x_MergeCandidates () |
Merge all discovered min key candidates. More... | |
void | x_MergeVolume (IMergeVolumeWalker *volume) |
void | x_StoreMerger () |
Private Attributes | |
TBufResourcePool | m_BufResourcePool |
AutoPtr< IMergeBlob > | m_Merger |
vector< IMergeVolumeWalker * > | m_VolumeVect |
EOwnership | m_OwnVolumeVect |
AutoPtr< IMergeStore > | m_Store |
unsigned | m_MergeKey |
key in the merger More... | |
unsigned | m_MinKey |
min key value More... | |
vector< size_t > | m_MinKeyCandidates |
min-key volumes More... | |
Main volume merge algorithm class.
Definition at line 56 of file volume_merge.hpp.
Buffer pool guard.
Definition at line 70 of file volume_merge.hpp.
Memory manager for raw buffers to avoid unnecessary reallocations and memory fragmentation.
Definition at line 67 of file volume_merge.hpp.
Raw BLOB buffer type used for raw information exchange between merge algorithm interfaces Raw buffers are allocated/deallocated using one central resource pool.
Definition at line 63 of file volume_merge.hpp.
CMergeVolumes::CMergeVolumes | ( | ) |
Definition at line 40 of file volume_merge.cpp.
CMergeVolumes::~CMergeVolumes | ( | ) |
Definition at line 49 of file volume_merge.cpp.
References eTakeOwnership, i, m_OwnVolumeVect, and m_VolumeVect.
|
inline |
void CMergeVolumes::Run | ( | void | ) |
Execute merge process (main merge loop)
Definition at line 98 of file volume_merge.cpp.
References _ASSERT, IMergeStore::Close(), IAsyncInterface::eFailed, IAsyncInterface::eNoMoreData, IAsyncInterface::eNotReady, IAsyncInterface::eReady, AutoPtr< X, Del >::get(), IMergeVolumeWalker::GetUint4Key(), i, IMergeVolumeWalker::IsEof(), IMergeVolumeWalker::IsGood(), m_MergeKey, m_Merger, m_MinKeyCandidates, m_Store, m_VolumeVect, NCBI_THROW, NON_CONST_ITERATE, IMergeVolumeWalker::QueryIAsync(), s_GetAsyncStatus(), x_EvaluateMinKey(), x_MergeCandidates(), x_MergeVolume(), x_ResetMinKey(), and x_StoreMerger().
Referenced by CBDB_MergeTest::Run().
void CMergeVolumes::SetMergeAccumulator | ( | IMergeBlob * | merger, |
EOwnership | own = eTakeOwnership |
||
) |
Set merge accumulator component.
Definition at line 58 of file volume_merge.cpp.
References m_BufResourcePool, m_Merger, AutoPtr< X, Del >::reset(), and IMergeBlob::SetResourcePool().
Referenced by CBDB_MergeTest::Run().
void CMergeVolumes::SetMergeStore | ( | IMergeStore * | store, |
EOwnership | own = eTakeOwnership |
||
) |
Set merge store (destination)
Definition at line 80 of file volume_merge.cpp.
References m_BufResourcePool, m_Store, AutoPtr< X, Del >::reset(), and IMergeStore::SetResourcePool().
Referenced by CBDB_MergeTest::Run().
void CMergeVolumes::SetVolumes | ( | const vector< IMergeVolumeWalker * > & | vol_vector, |
EOwnership | own = eTakeOwnership |
||
) |
Set merge volumes.
Definition at line 67 of file volume_merge.cpp.
References eTakeOwnership, i, m_OwnVolumeVect, and m_VolumeVect.
Referenced by CBDB_MergeTest::Run().
|
private |
check if volume key is new minimum or equals to old minimum
Definition at line 298 of file volume_merge.cpp.
References m_MinKey, and m_MinKeyCandidates.
Referenced by Run().
|
private |
Merge all discovered min key candidates.
Definition at line 288 of file volume_merge.cpp.
References ITERATE, m_MergeKey, m_MinKey, m_MinKeyCandidates, m_VolumeVect, and x_MergeVolume().
Referenced by Run().
|
private |
Definition at line 265 of file volume_merge.cpp.
References _ASSERT, buf, IMergeVolumeWalker::Fetch(), CResourcePool_Base< Value, Lock, CF >::Get(), IMergeVolumeWalker::GetBufferPtr(), m_BufResourcePool, m_Merger, IMergeBlob::Merge(), CResourcePoolGuard< Pool >::Release(), CSimpleBufferT< T, ResizeStrategy >::resize(), and IMergeVolumeWalker::SetRecordMoved().
Referenced by Run(), and x_MergeCandidates().
|
private |
Reset min. evaluation.
Definition at line 311 of file volume_merge.cpp.
References kMax_UInt, m_MinKey, and m_MinKeyCandidates.
Referenced by Run().
|
private |
Definition at line 216 of file volume_merge.cpp.
References _ASSERT, IAsyncInterface::eFailed, IAsyncInterface::eNoMoreData, IAsyncInterface::eNotReady, IAsyncInterface::eReady, IMergeBlob::GetMergeBuffer(), IMergeStore::IsGood(), m_BufResourcePool, m_MergeKey, m_Merger, m_Store, IMergeBlob::Merge(), NCBI_THROW, IMergeStore::QueryIAsync(), IMergeStore::ReadBlob(), CResourcePoolGuard< Pool >::Release(), IMergeBlob::Reset(), IMergeStore::Store(), and IAsyncInterface::WaitReady().
Referenced by Run().
|
private |
Definition at line 104 of file volume_merge.hpp.
Referenced by GetBufResourcePool(), SetMergeAccumulator(), SetMergeStore(), x_MergeVolume(), and x_StoreMerger().
|
private |
key in the merger
Definition at line 110 of file volume_merge.hpp.
Referenced by Run(), x_MergeCandidates(), and x_StoreMerger().
|
private |
Definition at line 105 of file volume_merge.hpp.
Referenced by Run(), SetMergeAccumulator(), x_MergeVolume(), and x_StoreMerger().
|
private |
min key value
Definition at line 111 of file volume_merge.hpp.
Referenced by x_EvaluateMinKey(), x_MergeCandidates(), and x_ResetMinKey().
|
private |
min-key volumes
Definition at line 112 of file volume_merge.hpp.
Referenced by Run(), x_EvaluateMinKey(), x_MergeCandidates(), and x_ResetMinKey().
|
private |
Definition at line 107 of file volume_merge.hpp.
Referenced by SetVolumes(), and ~CMergeVolumes().
|
private |
Definition at line 108 of file volume_merge.hpp.
Referenced by Run(), SetMergeStore(), and x_StoreMerger().
|
private |
Definition at line 106 of file volume_merge.hpp.
Referenced by Run(), SetVolumes(), x_MergeCandidates(), and ~CMergeVolumes().