NCBI C++ ToolKit
|
Search Toolkit Book for CWriteDB_TaxID
This class supports creation of tax id list lookup files. More...
#include <objtools/blast/seqdb_writer/writedb_lmdb.hpp>
Classes | |
struct | SKeyValuePair |
Public Member Functions | |
CWriteDB_TaxID (const string &dbname, Uint8 map_size=500000, Uint8 capacity=500000) | |
Constructor for LMDB write access. More... | |
~CWriteDB_TaxID () | |
int | InsertEntries (const set< TTaxId > &tax_ids, const blastdb::TOid oid) |
Add tax id entries in bulk for each oid This api needs to be called in sequential order of OIDs This api should only be called once for each OID. More... | |
![]() | |
CObject (void) | |
Constructor. More... | |
CObject (const CObject &src) | |
Copy constructor. More... | |
virtual | ~CObject (void) |
Destructor. More... | |
CObject & | operator= (const CObject &src) THROWS_NONE |
Assignment operator. More... | |
bool | CanBeDeleted (void) const THROWS_NONE |
Check if object can be deleted. More... | |
bool | IsAllocatedInPool (void) const THROWS_NONE |
Check if object is allocated in memory pool (not system heap) More... | |
bool | Referenced (void) const THROWS_NONE |
Check if object is referenced. More... | |
bool | ReferencedOnlyOnce (void) const THROWS_NONE |
Check if object is referenced only once. More... | |
void | AddReference (void) const |
Add reference to object. More... | |
void | RemoveReference (void) const |
Remove reference to object. More... | |
void | ReleaseReference (void) const |
Remove reference without deleting object. More... | |
virtual void | DoNotDeleteThisObject (void) |
Mark this object as not allocated in heap – do not delete this object. More... | |
virtual void | DoDeleteThisObject (void) |
Mark this object as allocated in heap – object can be deleted. More... | |
void * | operator new (size_t size) |
Define new operator for memory allocation. More... | |
void * | operator new[] (size_t size) |
Define new[] operator for 'array' memory allocation. More... | |
void | operator delete (void *ptr) |
Define delete operator for memory deallocation. More... | |
void | operator delete[] (void *ptr) |
Define delete[] operator for memory deallocation. More... | |
void * | operator new (size_t size, void *place) |
Define new operator. More... | |
void | operator delete (void *ptr, void *place) |
Define delete operator. More... | |
void * | operator new (size_t size, CObjectMemoryPool *place) |
Define new operator using memory pool. More... | |
void | operator delete (void *ptr, CObjectMemoryPool *place) |
Define delete operator. More... | |
virtual void | DebugDump (CDebugDumpContext ddc, unsigned int depth) const |
Define method for dumping debug information. More... | |
![]() | |
CDebugDumpable (void) | |
virtual | ~CDebugDumpable (void) |
void | DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const |
void | DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const |
void | DumpToConsole (void) const |
Private Member Functions | |
void | x_CommitTransaction () |
void | x_CreateOidToTaxIdsLookupFile () |
void | x_CreateTaxIdToOidsLookupFile () |
void | x_Resize () |
void | x_IncreaseEnvMapSize () |
Private Attributes | |
string | m_Db |
lmdb::env & | m_Env |
Uint8 | m_ListCapacity |
unsigned int | m_MaxEntryPerTxn |
vector< SKeyValuePair< blastdb::TOid > > | m_TaxId2OidList |
vector< SKeyValuePair< Uint8 > > | m_TaxId2OffsetsList |
Additional Inherited Members | |
![]() | |
enum | EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern } |
Control filling of newly allocated memory. More... | |
typedef CObjectCounterLocker | TLockerType |
Default locker type for CRef. More... | |
typedef atomic< Uint8 > | TCounter |
Counter type is CAtomiCounter. More... | |
typedef Uint8 | TCount |
Alias for value type of counter. More... | |
![]() | |
static NCBI_XNCBI_EXPORT void | ThrowNullPointerException (void) |
Define method to throw null pointer exception. More... | |
static NCBI_XNCBI_EXPORT void | ThrowNullPointerException (const type_info &type) |
static EAllocFillMode | GetAllocFillMode (void) |
static void | SetAllocFillMode (EAllocFillMode mode) |
static void | SetAllocFillMode (const string &value) |
Set mode from configuration parameter value. More... | |
![]() | |
static void | EnableDebugDump (bool on) |
![]() | |
static const TCount | eCounterBitsCanBeDeleted = 1 << 0 |
Define possible object states. More... | |
static const TCount | eCounterBitsInPlainHeap = 1 << 1 |
Heap signature was found. More... | |
static const TCount | eCounterBitsPlaceMask |
Mask for 'in heap' state flags. More... | |
static const int | eCounterStep = 1 << 2 |
Skip over the "in heap" bits. More... | |
static const TCount | eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2) |
Minimal value for valid objects (reference counter is zero) Must be a single bit value. More... | |
static const TCount | eCounterStateMask |
Valid object, and object in heap. More... | |
![]() | |
virtual void | DeleteThis (void) |
Virtual method "deleting" this object. More... | |
This class supports creation of tax id list lookup files.
Definition at line 136 of file writedb_lmdb.hpp.
CWriteDB_TaxID::CWriteDB_TaxID | ( | const string & | dbname, |
Uint8 | map_size = 500000 , |
||
Uint8 | capacity = 500000 |
||
) |
Constructor for LMDB write access.
dbname | Database name |
Definition at line 425 of file writedb_lmdb.cpp.
References _TRACE, m_ListCapacity, m_MaxEntryPerTxn, m_TaxId2OidList, and NStr::StringToInt().
CWriteDB_TaxID::~CWriteDB_TaxID | ( | ) |
Definition at line 437 of file writedb_lmdb.cpp.
References CBlastLMDBManager::CloseEnv(), CBlastLMDBManager::GetInstance(), m_Db, CDirEntry::Remove(), x_CommitTransaction(), x_CreateOidToTaxIdsLookupFile(), and x_CreateTaxIdToOidsLookupFile().
Add tax id entries in bulk for each oid This api needs to be called in sequential order of OIDs This api should only be called once for each OID.
oid | OID |
tax_ids | list for oid |
Definition at line 446 of file writedb_lmdb.cpp.
References ITERATE, m_TaxId2OidList, set< Key, Compare >::size(), x_Resize(), and ZERO_TAX_ID.
Referenced by BOOST_AUTO_TEST_CASE(), and CWriteDB_Impl::x_Publish().
|
private |
Definition at line 490 of file writedb_lmdb.cpp.
References _ASSERT, lmdb::txn::begin(), lmdb::txn::commit(), lmdb::dbi_put(), lmdb::dbi::handle(), i, ncbi::grid::netcache::search::fields::key, m_Env, m_MaxEntryPerTxn, m_TaxId2OffsetsList, MDB_APPENDDUP, MDB_CREATE, MDB_DUPFIXED, MDB_DUPSORT, NCBI_THROW, NStr::NumericToString(), offset, lmdb::dbi::open(), ct::sort(), taxid2offset_str, value, and x_IncreaseEnvMapSize().
Referenced by ~CWriteDB_TaxID().
|
private |
Definition at line 532 of file writedb_lmdb.cpp.
References _ASSERT, eOid2TaxIds, GetFileNameFromExistingLMDBFile(), i, m_Db, m_TaxId2OidList, NCBI_THROW, offset, out(), s_WirteTaxIds(), and value.
Referenced by ~CWriteDB_TaxID().
|
private |
Definition at line 589 of file writedb_lmdb.cpp.
References eTaxId2Oids, GetFileNameFromExistingLMDBFile(), i, m_Db, m_TaxId2OffsetsList, m_TaxId2OidList, offset, out(), s_WirteOids(), ct::sort(), and value.
Referenced by ~CWriteDB_TaxID().
|
private |
Definition at line 466 of file writedb_lmdb.cpp.
References env, lmdb::env_info(), lmdb::env_stat(), lmdb::env::handle(), Info(), info, LOG_POST, m_Env, m_TaxId2OffsetsList, MDB_envinfo::me_last_pgno, MDB_envinfo::me_mapsize, MDB_stat::ms_psize, lmdb::env::set_mapsize(), and ncbi::grid::netcache::search::fields::size.
Referenced by x_CommitTransaction().
|
private |
Definition at line 616 of file writedb_lmdb.cpp.
References m_ListCapacity, and m_TaxId2OidList.
Referenced by InsertEntries().
|
private |
Definition at line 166 of file writedb_lmdb.hpp.
Referenced by x_CreateOidToTaxIdsLookupFile(), x_CreateTaxIdToOidsLookupFile(), and ~CWriteDB_TaxID().
|
private |
Definition at line 167 of file writedb_lmdb.hpp.
Referenced by x_CommitTransaction(), and x_IncreaseEnvMapSize().
|
private |
Definition at line 168 of file writedb_lmdb.hpp.
Referenced by CWriteDB_TaxID(), and x_Resize().
|
private |
Definition at line 169 of file writedb_lmdb.hpp.
Referenced by CWriteDB_TaxID(), and x_CommitTransaction().
|
private |
Definition at line 183 of file writedb_lmdb.hpp.
Referenced by x_CommitTransaction(), x_CreateTaxIdToOidsLookupFile(), and x_IncreaseEnvMapSize().
|
private |
Definition at line 182 of file writedb_lmdb.hpp.
Referenced by CWriteDB_TaxID(), InsertEntries(), x_CreateOidToTaxIdsLookupFile(), x_CreateTaxIdToOidsLookupFile(), and x_Resize().