NCBI C++ ToolKit
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
CAsnCacheStore Class Reference

Search Toolkit Book for CAsnCacheStore

#include <objtools/data_loaders/asn_cache/asn_cache_store.hpp>

+ Inheritance diagram for CAsnCacheStore:
+ Collaboration diagram for CAsnCacheStore:

Public Member Functions

 CAsnCacheStore ()=delete
 
 CAsnCacheStore (CAsnCacheStore const &)=delete
 
CAsnCacheStoreoperator= (CAsnCacheStore const &)=delete
 
 CAsnCacheStore (string const &dbpath)
 
bool GetRaw (const objects::CSeq_id_Handle &id, vector< unsigned char > &buffer)
 Return the raw blob in an unformatted buffer. More...
 
bool GetMultipleRaw (const objects::CSeq_id_Handle &id, vector< vector< unsigned char >> &buffer)
 
bool GetBlob (const objects::CSeq_id_Handle &id, objects::CCache_blob &blob)
 Return the cache blob, packed and uninterpreted. More...
 
bool GetMultipleBlobs (const objects::CSeq_id_Handle &id, vector< CRef< objects::CCache_blob > > &blob)
 
bool GetSeqIds (const objects::CSeq_id_Handle &id, vector< objects::CSeq_id_Handle > &all_ids, bool cheap_only)
 Return the set of seq-ids associated with a given ID. More...
 
CRef< objects::CSeq_entry > GetEntry (const objects::CSeq_id_Handle &id)
 Check if the SeqId cache, for efficient retrieval of SeqIds, is available. More...
 
vector< CRef< objects::CSeq_entry > > GetMultipleEntries (const objects::CSeq_id_Handle &id)
 
bool GetIdInfo (const objects::CSeq_id_Handle &id, CAsnIndex::TGi &gi, time_t &timestamp)
 Return the GI and timestamp for a given seq_id. More...
 
bool GetIdInfo (const objects::CSeq_id_Handle &id, objects::CSeq_id_Handle &accession, CAsnIndex::TGi &gi, time_t &timestamp, Uint4 &sequence_length, Uint4 &tax_id)
 Return the GI and timestamp for a given seq_id. More...
 
bool GetIndexEntry (const objects::CSeq_id_Handle &id, CAsnIndex::SIndexInfo &info)
 Get the full ASN cache index entry. More...
 
bool GetMultipleIndexEntries (const objects::CSeq_id_Handle &id, vector< CAsnIndex::SIndexInfo > &info)
 
size_t GetGiCount () const
 
void EnumSeqIds (IAsnCacheStore::TEnumSeqidCallback cb) const
 
void EnumIndex (IAsnCacheStore::TEnumIndexCallback cb) const
 
- Public Member Functions inherited from IAsnCacheStore
virtual ~IAsnCacheStore ()
 

Private Member Functions

CAsnIndexx_GetIndexRef () const
 
bool x_GetBlob (const CAsnIndex::SIndexInfo &info, objects::CCache_blob &blob)
 

Static Private Member Functions

static bool s_GetChunkAndOffset (const objects::CSeq_id_Handle &idh, CAsnIndex &index, vector< CAsnIndex::SIndexInfo > &info, bool multiple)
 
static bool s_GetChunkAndOffset (const objects::CSeq_id_Handle &idh, CAsnIndex &index, CAsnIndex::SIndexInfo &info)
 

Private Attributes

std::string m_DbPath
 
std::unique_ptr< CAsnIndexm_Index
 
std::unique_ptr< CAsnIndexm_SeqIdIndex
 
CAsnIndex::TChunkId m_CurrChunkId
 
std::unique_ptr< CChunkFilem_CurrChunk
 
std::unique_ptr< CSeqIdChunkFilem_SeqIdChunk
 

Additional Inherited Members

- Public Types inherited from IAsnCacheStore
using TEnumSeqidCallback = std::function< void(string, uint32_t, uint64_t, uint32_t)>
 
using TEnumIndexCallback = std::function< void(string, uint32_t, uint64_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t)>
 

Detailed Description

Definition at line 38 of file asn_cache_store.hpp.

Constructor & Destructor Documentation

◆ CAsnCacheStore() [1/3]

CAsnCacheStore::CAsnCacheStore ( )
delete

◆ CAsnCacheStore() [2/3]

CAsnCacheStore::CAsnCacheStore ( CAsnCacheStore const )
delete

◆ CAsnCacheStore() [3/3]

CAsnCacheStore::CAsnCacheStore ( string const dbpath)
explicit

Member Function Documentation

◆ EnumIndex()

void CAsnCacheStore::EnumIndex ( IAsnCacheStore::TEnumIndexCallback  cb) const
virtual

◆ EnumSeqIds()

void CAsnCacheStore::EnumSeqIds ( IAsnCacheStore::TEnumSeqidCallback  cb) const
virtual

◆ GetBlob()

bool CAsnCacheStore::GetBlob ( const objects::CSeq_id_Handle &  id,
objects::CCache_blob &  blob 
)
virtual

Return the cache blob, packed and uninterpreted.

Implements IAsnCacheStore.

Definition at line 260 of file asn_cache_store.cpp.

References info, m_Index, s_GetChunkAndOffset(), and x_GetBlob().

Referenced by GetEntry(), and GetRaw().

◆ GetEntry()

CRef< CSeq_entry > CAsnCacheStore::GetEntry ( const objects::CSeq_id_Handle &  id)
virtual

Check if the SeqId cache, for efficient retrieval of SeqIds, is available.

Return a blob as a CSeq_entry object.

Implements IAsnCacheStore.

Definition at line 361 of file asn_cache_store.cpp.

References GetBlob(), and CCache_blob::UnPack().

Referenced by GetSeqIds().

◆ GetGiCount()

size_t CAsnCacheStore::GetGiCount ( ) const
virtual

◆ GetIdInfo() [1/2]

bool CAsnCacheStore::GetIdInfo ( const objects::CSeq_id_Handle &  id,
CAsnIndex::TGi gi,
time_t &  timestamp 
)
virtual

Return the GI and timestamp for a given seq_id.

This can be a very fast way to look up the GI for an accession.version because only the index is queried – the blob is not retrieved.

Implements IAsnCacheStore.

◆ GetIdInfo() [2/2]

bool CAsnCacheStore::GetIdInfo ( const objects::CSeq_id_Handle &  id,
objects::CSeq_id_Handle &  accession,
CAsnIndex::TGi gi,
time_t &  timestamp,
Uint4 sequence_length,
Uint4 tax_id 
)
virtual

Return the GI and timestamp for a given seq_id.

This can be a very fast way to look up the GI for an accession.version because only the index is queried – the blob is not retrieved.

Implements IAsnCacheStore.

◆ GetIndexEntry()

bool CAsnCacheStore::GetIndexEntry ( const objects::CSeq_id_Handle &  id,
CAsnIndex::SIndexInfo info 
)
virtual

Get the full ASN cache index entry.

This does not retrieve the full blob and is very fast.

Implements IAsnCacheStore.

Definition at line 389 of file asn_cache_store.cpp.

References info, m_Index, and s_GetChunkAndOffset().

◆ GetMultipleBlobs()

bool CAsnCacheStore::GetMultipleBlobs ( const objects::CSeq_id_Handle &  id,
vector< CRef< objects::CCache_blob > > &  blob 
)
virtual

Implements IAsnCacheStore.

Definition at line 310 of file asn_cache_store.cpp.

References info, ITERATE, m_Index, s_GetChunkAndOffset(), and x_GetBlob().

Referenced by GetMultipleEntries(), and GetMultipleRaw().

◆ GetMultipleEntries()

vector< CRef< CSeq_entry > > CAsnCacheStore::GetMultipleEntries ( const objects::CSeq_id_Handle &  id)
virtual

Implements IAsnCacheStore.

Definition at line 373 of file asn_cache_store.cpp.

References entries, GetMultipleBlobs(), and ITERATE.

◆ GetMultipleIndexEntries()

bool CAsnCacheStore::GetMultipleIndexEntries ( const objects::CSeq_id_Handle &  id,
vector< CAsnIndex::SIndexInfo > &  info 
)
virtual

Implements IAsnCacheStore.

Definition at line 395 of file asn_cache_store.cpp.

References info, m_Index, and s_GetChunkAndOffset().

◆ GetMultipleRaw()

bool CAsnCacheStore::GetMultipleRaw ( const objects::CSeq_id_Handle &  id,
vector< vector< unsigned char >> &  buffer 
)
virtual

Implements IAsnCacheStore.

Definition at line 342 of file asn_cache_store.cpp.

References buffer, GetMultipleBlobs(), and ITERATE.

◆ GetRaw()

bool CAsnCacheStore::GetRaw ( const objects::CSeq_id_Handle &  id,
vector< unsigned char > &  buffer 
)
virtual

Return the raw blob in an unformatted buffer.

Implements IAsnCacheStore.

Definition at line 330 of file asn_cache_store.cpp.

References buffer, GetBlob(), and CCache_blob::UnPack().

◆ GetSeqIds()

bool CAsnCacheStore::GetSeqIds ( const objects::CSeq_id_Handle &  id,
vector< objects::CSeq_id_Handle > &  all_ids,
bool  cheap_only 
)
virtual

Return the set of seq-ids associated with a given ID.

By default, if the SeqId index is not available, and the SeqIds can't be retrieved cheaply, does nothing and return false. If cheap_only is set to false, will always retrieve the SeqIds, by retrieving the full blob if that is the only available way.

Implements IAsnCacheStore.

Definition at line 215 of file asn_cache_store.cpp.

References _TRACE, ERR_POST, ExtractBioseq(), GetEntry(), CSeq_id_Handle::GetHandle(), CBioseq_Base::GetId(), GetSeqId(), info, ITERATE, m_SeqIdChunk, m_SeqIdIndex, CConstRef< C, Locker >::NotNull(), and s_GetChunkAndOffset().

◆ operator=()

CAsnCacheStore& CAsnCacheStore::operator= ( CAsnCacheStore const )
delete

◆ s_GetChunkAndOffset() [1/2]

static bool CAsnCacheStore::s_GetChunkAndOffset ( const objects::CSeq_id_Handle &  idh,
CAsnIndex index,
CAsnIndex::SIndexInfo info 
)
staticprivate

◆ s_GetChunkAndOffset() [2/2]

static bool CAsnCacheStore::s_GetChunkAndOffset ( const objects::CSeq_id_Handle &  idh,
CAsnIndex index,
vector< CAsnIndex::SIndexInfo > &  info,
bool  multiple 
)
staticprivate

◆ x_GetBlob()

bool CAsnCacheStore::x_GetBlob ( const CAsnIndex::SIndexInfo info,
objects::CCache_blob &  blob 
)
private

Definition at line 276 of file asn_cache_store.cpp.

References _TRACE, ERR_POST, Error(), info, m_CurrChunk, m_CurrChunkId, and m_DbPath.

Referenced by GetBlob(), and GetMultipleBlobs().

◆ x_GetIndexRef()

CAsnIndex& CAsnCacheStore::x_GetIndexRef ( ) const
inlineprivate

Definition at line 54 of file asn_cache_store.hpp.

References m_Index.

Referenced by EnumIndex(), EnumSeqIds(), and GetGiCount().

Member Data Documentation

◆ m_CurrChunk

std::unique_ptr<CChunkFile> CAsnCacheStore::m_CurrChunk
private

Definition at line 45 of file asn_cache_store.hpp.

Referenced by x_GetBlob().

◆ m_CurrChunkId

CAsnIndex::TChunkId CAsnCacheStore::m_CurrChunkId
private

Definition at line 44 of file asn_cache_store.hpp.

Referenced by x_GetBlob().

◆ m_DbPath

std::string CAsnCacheStore::m_DbPath
private

Definition at line 40 of file asn_cache_store.hpp.

Referenced by CAsnCacheStore(), and x_GetBlob().

◆ m_Index

std::unique_ptr<CAsnIndex> CAsnCacheStore::m_Index
private

◆ m_SeqIdChunk

std::unique_ptr<CSeqIdChunkFile> CAsnCacheStore::m_SeqIdChunk
private

Definition at line 47 of file asn_cache_store.hpp.

Referenced by CAsnCacheStore(), and GetSeqIds().

◆ m_SeqIdIndex

std::unique_ptr<CAsnIndex> CAsnCacheStore::m_SeqIdIndex
private

Definition at line 42 of file asn_cache_store.hpp.

Referenced by CAsnCacheStore(), and GetSeqIds().


The documentation for this class was generated from the following files:
Modified on Wed Jun 19 17:06:48 2024 by modify_doxy.py rev. 669887