66 vector<string> db_paths;
70 db_paths.push_back(db_path);
76 string const kSubcacheMask =
"subcache*";
79 for (
auto const& item: items ) {
80 if ( item->IsDir() ) {
81 string path = item->GetPath();
86 if (
CFile(main_fname).Exists() ) {
87 db_paths.push_back(path);
92 if ( db_paths.empty() ) {
94 "No ASN.1 Cache database is found in " + db_path);
97 if ( 1 == db_paths.size() ) {
107 time_t& this_timestamp)
109 return m_Store->GetIdInfo(idh, this_gi, this_timestamp);
118 Uint4& sequence_length,
121 return m_Store->GetIdInfo(
id, accession, gi, timestamp, sequence_length, tax_id);
125 vector<CSeq_id_Handle>& all_ids,
128 return m_Store->GetSeqIds(
id, all_ids, cheap_only);
134 return m_Store->GetBlob(idh, blob);
140 return m_Store->GetMultipleBlobs(
id, blobs);
161 return m_Store->GetMultipleEntries(
id);
171 vector<CAsnIndex::SIndexInfo> &
info)
User-defined methods of the data storage class.
User-defined methods of the data storage class.
Contains the class definiton for CAsnCache, the main client class for accessing the ASN cache data.
Berkeley BDB file cursor.
void EnumIndex(IAsnCacheStore::TEnumIndexCallback cb) const
bool GetBlob(const objects::CSeq_id_Handle &id, objects::CCache_blob &blob)
Return the cache blob, packed and uninterpreted.
size_t GetGiCount() const
void EnumSeqIds(IAsnCacheStore::TEnumSeqidCallback cb) const
vector< unsigned char > TBuffer
Type used to hold raw (unformatted) blob data.
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 ×tamp)
Return the GI and timestamp for a given seq_id.
bool GetMultipleRaw(const objects::CSeq_id_Handle &id, vector< TBuffer > &buffer)
bool GetRaw(const objects::CSeq_id_Handle &id, TBuffer &buffer)
Return the raw blob in an unformatted buffer.
bool GetIndexEntry(const objects::CSeq_id_Handle &id, CAsnIndex::SIndexInfo &info)
Get the full ASN cache index entry.
CRef< objects::CSeq_entry > GetEntry(const objects::CSeq_id_Handle &id)
Return a blob as a CSeq_entry object.
bool GetMultipleIndexEntries(const objects::CSeq_id_Handle &id, vector< CAsnIndex::SIndexInfo > &info)
bool GetMultipleBlobs(const objects::CSeq_id_Handle &id, vector< CRef< objects::CCache_blob > > &blob)
CAsnCache(const CAsnCache &)=delete
bool GetSeqIds(const objects::CSeq_id_Handle &id, vector< objects::CSeq_id_Handle > &all_ids, bool cheap_only=true)
Return the set of seq-ids associated with a given ID.
std::unique_ptr< IAsnCacheStore > m_Store
std::function< void(string, uint32_t, uint64_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t)> TEnumIndexCallback
std::function< void(string, uint32_t, uint64_t, uint32_t)> TEnumSeqidCallback
@ eFollowLinks
Follow symbolic links.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
static string NormalizePath(const string &path, EFollowLinks follow_links=eIgnoreLinks)
Normalize a path.
TEntries GetEntries(const string &mask=kEmptyStr, TGetEntriesFlags flags=0) const
Get directory entries based on the specified "mask".
static string CreateAbsolutePath(const string &path, ERelativeToWhat rtw=eRelativeToCwd)
Get an absolute path from some, possibly relative, path.
@ fIgnoreRecursive
Suppress "self recursive" elements (the directories "." and "..").
uint32_t Uint4
4-byte (32-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...