NCBI C++ ToolKit
asn_cache_store.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /*
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: Alex Kotliarov
27  *
28  * File Description:
29  */
30 #include <ncbi_pch.hpp>
31 
32 #include <corelib/ncbifile.hpp>
33 #include <db/bdb/bdb_cursor.hpp>
34 
35 #include <serial/serial.hpp>
36 #include <serial/objistrasnb.hpp>
37 
38 #include <util/compress/zlib.hpp>
39 #include <util/compress/stream.hpp>
40 
43 
51 
53 
54 
55 #include <algorithm>
56 #include <numeric>
57 #include <random>
58 
61 
62 namespace
63 {
64 
65 using TBuffer = std::vector<unsigned char>;
66 
67 };
68 
69 CAsnCacheStore::CAsnCacheStore(const string& db_path)
70  : m_DbPath(db_path)
71  , m_CurrChunkId(0)
72 {
76  m_Index->SetCacheSize(128 * 1024 * 1024);
77 
78  string main_fname =
80  if ( !CFile(main_fname).Exists() ) {
82  "cannot open ASN cache: failed to find file: " + main_fname);
83  }
84 
85  m_Index->Open(main_fname, CBDB_RawFile::eReadOnly);
86 
87  string fname = NASNCacheFileName::GetBDBIndex(db_path, CAsnIndex::e_seq_id);
88  if (CFile(fname).Exists()) {
89  try {
91  m_SeqIdIndex->SetCacheSize(128 * 1024 * 1024);
93  m_SeqIdChunk.reset(new CSeqIdChunkFile);
94  m_SeqIdChunk->OpenForRead( m_DbPath );
95  }
96  catch (CException& e) {
97  ERR_POST(Error << "error opening seq-id cache: disabling: " << e);
98  m_SeqIdIndex.reset();
99  m_SeqIdChunk.reset();
100  }
101  }
102 }
103 
105  CAsnIndex& index,
106  vector<CAsnIndex::SIndexInfo>& info,
107  bool multiple)
108 {
109  bool was_id_found = false;
110 
111  ///
112  /// retrieve the correct flattened seq-id
113  ///
114  string seq_id;
115  Uint4 version;
116  GetNormalizedSeqId(idh, seq_id, version);
117  // LOG_POST(Info << "scanning: " << seq_id << " | " << version);
118 
119  ///
120  /// scan for the appropriate sequence
121  ///
122  CBDB_FileCursor cursor(index);
123  cursor.SetCondition(CBDB_FileCursor::eGE, CBDB_FileCursor::eLE);
124  cursor.From << seq_id << version;
125  cursor.To << seq_id;
126 
127  while (cursor.Fetch() == eBDB_Ok) {
128  CAsnIndex::SIndexInfo current_info(index);
129 
130  if (current_info.seq_id != seq_id) {
131  ERR_POST(Error << "error: bad seq-id");
132  break;
133  }
134 
135  bool should_report = (!version || version == current_info.version) &&
136  (
137  info.empty() ||
138  multiple ||
139  ( (!version &&
140  /// versionless - choose best version and timestamp
141  (info[0].version < current_info.version ||
142  (info[0].version == current_info.version && info[0].timestamp < current_info.timestamp))) ||
143  /// version specified; choose best timestamp for this version
144  (version && info[0].timestamp < current_info.timestamp))
145  );
146  if (should_report) {
147  was_id_found = true;
148  if (!multiple) {
149  info.clear();
150  }
151  info.push_back(current_info);
152  }
153  }
154 
155  return was_id_found;
156 }
157 
159  CAsnIndex& index,
161 {
162  vector<CAsnIndex::SIndexInfo> info_vector;
163  if (!s_GetChunkAndOffset(idh, index, info_vector, false)) {
164  return false;
165  }
166  info = info_vector[0];
167  return true;
168 }
169 
171  CAsnIndex::TGi& this_gi,
172  time_t& this_timestamp)
173 {
175  ///
176  /// It is generally better to get GI information out of the new SeqId
177  /// index, because this is often followed by getting other SeqId info,
178  /// so this way we're avoiding a page fault on the subsequent call.
179  /// However, we need to check whether the cache is old-style, without
180  /// a SeqId index, and in that case get the info out of the main index
181  ///
183  info) )
184  {
185  this_gi = info.gi;
186  this_timestamp = info.timestamp;
187  return true;
188  }
189 
190  return false;
191 }
192 
193 /// Get a partial index entry, returning only the externally useful
194 /// metadata. This is a very fast call.
196  CSeq_id_Handle& accession,
197  CAsnIndex::TGi& gi,
198  time_t& timestamp,
199  Uint4& sequence_length,
200  Uint4& tax_id)
201 {
203 
204  if ( !GetIndexEntry(id, info) ) {
205  return false;
206  }
207  gi = info.gi;
208  timestamp = info.timestamp;
209  accession = CSeq_id_Handle::GetHandle(info.seq_id);
210  sequence_length = info.sequence_length;
211  tax_id = info.taxonomy_id;
212  return true;
213 }
214 
216  vector<CSeq_id_Handle>& all_ids,
217  bool cheap_only)
218 {
219  bool was_seqid_blob_found = false;
220 
222 
223  was_seqid_blob_found = m_SeqIdIndex.get() && s_GetChunkAndOffset(id, *m_SeqIdIndex, info);
224 
225  _TRACE("GetSeqIds id=" << id.GetSeqId()->AsFastaString()
226  << " gi=" << info.gi
227  << " timestamp=" << info.timestamp
228  << " offs=" << info.offs
229  << " size=" << info.size);
230 
231  if ( was_seqid_blob_found ){
232  try {
233  m_SeqIdChunk->Read( all_ids, info.offs, info.size );
234  }
235  catch ( CException & e ) {
236  ERR_POST( "Unable to read or unpack a SeqIds chunk."
237  << " offset = " << info.offs << " size = " << info.size );
238  ERR_POST( "SeqId = " << id.AsString() << " gi = " << info.gi
239  << " timestamp = " << info.timestamp );
240  ERR_POST( e );
241  was_seqid_blob_found = false;
242  }
243  }
244  else if(!cheap_only) {
245  ///
246  /// Couldn't get IDs the cheap way; use the expensive way, by getting full entry
247  ///
248  CConstRef<CBioseq> bioseq = ExtractBioseq(GetEntry(id), id);
249  if( bioseq.NotNull() ) {
250  ITERATE(CBioseq::TId, it, bioseq->GetId()) {
251  all_ids.push_back(CSeq_id_Handle::GetHandle(**it));
252  }
253  was_seqid_blob_found = true;
254  }
255  }
256 
257  return was_seqid_blob_found;
258 }
259 
261  CCache_blob& blob)
262 {
263  bool was_blob_found = false;
264 
266 
267  was_blob_found = s_GetChunkAndOffset(idh, *m_Index, info);
268 
269  if (! was_blob_found ) {
270  return false;
271  }
272 
273  return x_GetBlob(info, blob);
274 }
275 
277 {
278  _TRACE("id=" << info.seq_id
279  << " gi=" << info.gi
280  << " timestamp=" << info.timestamp
281  << " chunk=" << info.chunk
282  << " offs=" << info.offs
283  << " size=" << info.size);
284  try {
285  if ( !m_CurrChunk.get() || info.chunk != m_CurrChunkId) {
286  try {
287  m_CurrChunk.reset(new CChunkFile(m_DbPath, info.chunk));
288  m_CurrChunk->OpenForRead( );
289  m_CurrChunkId = info.chunk;
290  }
291  catch (CException& e) {
292  ERR_POST(Error << e);
293  m_CurrChunk.reset();
294  throw;
295  }
296  }
297  m_CurrChunk->Read( blob, info.offs, info.size );
298  }
299  catch ( CException & e ) {
300  ERR_POST( "Unable to read or unpack a raw chunk. ChunkId = " << info.chunk
301  << " offset = " << info.offs << " size = " << info.size );
302  ERR_POST( "SeqId = " << info.seq_id << " gi = " << info.gi
303  << " timestamp = " << info.timestamp );
304  ERR_POST( e );
305  return false;
306  }
307  return true;
308 }
309 
311  vector< CRef<CCache_blob> >& blobs)
312 {
313  vector<CAsnIndex::SIndexInfo> info;
314 
315  bool was_blob_found = s_GetChunkAndOffset(id, *m_Index, info, true);
316 
317  if (! was_blob_found ) {
318  return false;
319  }
320 
321  ITERATE (vector<CAsnIndex::SIndexInfo>, blob_it, info) {
322  CRef<CCache_blob> blob(new CCache_blob);
323  if (x_GetBlob(*blob_it, *blob)) {
324  blobs.push_back(blob);
325  }
326  }
327  return !blobs.empty();
328 }
329 
331  TBuffer& buffer)
332 {
333  CCache_blob blob;
334  if ( !GetBlob(idh, blob) ) {
335  return false;
336  }
337 
338  blob.UnPack(buffer);
339  return true;
340 }
341 
342 bool CAsnCacheStore::GetMultipleRaw(const CSeq_id_Handle& id, vector<TBuffer>& buffer)
343 {
344  vector< CRef<CCache_blob> > blobs;
345  if ( !GetMultipleBlobs(id, blobs) ) {
346  return false;
347  }
348  buffer.resize(blobs.size());
349  ITERATE (vector< CRef<CCache_blob> >, blob_it, blobs) {
350  (*blob_it)->UnPack(buffer[blob_it - blobs.begin()]);
351  }
352  return true;
353 }
354 
355 #if 0
356 bool CAsnCacheStore::EfficientlyGetSeqIds() const
357 {
358 }
359 #endif
360 
362 {
363  CCache_blob blob;
364  if ( !GetBlob(idh, blob) ) {
365  return CRef<CSeq_entry>();
366  }
367 
368  CRef<CSeq_entry> entry(new CSeq_entry);
369  blob.UnPack(*entry);
370  return entry;
371 }
372 
373 vector< CRef<CSeq_entry> > CAsnCacheStore::GetMultipleEntries(const CSeq_id_Handle& id)
374 {
375  vector< CRef<CSeq_entry> > entries;
376  vector< CRef<CCache_blob> > blobs;
377  if ( GetMultipleBlobs(id, blobs) ) {
378  ITERATE (vector< CRef<CCache_blob> >, blob_it, blobs) {
379  CRef<CSeq_entry> entry(new CSeq_entry);
380  (*blob_it)->UnPack(*entry);
381  entries.push_back(entry);
382  }
383  }
384 
385  return entries;
386 }
387 
388 
391 {
392  return s_GetChunkAndOffset(id_handle, *m_Index, info);
393 }
394 
395 bool CAsnCacheStore::GetMultipleIndexEntries(const objects::CSeq_id_Handle & id,
396  vector<CAsnIndex::SIndexInfo> &info)
397 {
398  return s_GetChunkAndOffset(id, *m_Index, info, true);
399 }
400 
401 // IAsnCacheStats implementation
402 
404 {
405  std::set<CAsnIndex::TGi> gi_set;
406 
407  auto & index_ref = x_GetIndexRef();
408  CBDB_FileCursor cursor( index_ref );
410  while (cursor.Fetch() == eBDB_Ok) {
411  auto gi = index_ref.GetGi();
412  gi_set.insert( gi );
413  }
414 
415  return gi_set.size();
416 }
417 
419 {
420  auto & index_ref = x_GetIndexRef();
421  CBDB_FileCursor cursor( index_ref );
423 
424  while (cursor.Fetch() == eBDB_Ok) {
425  cb(index_ref.GetSeqId(),
426  index_ref.GetVersion(),
427  index_ref.GetGi(),
428  index_ref.GetTimestamp());
429  }
430 }
431 
433 {
434  auto & index_ref = x_GetIndexRef();
435  CBDB_FileCursor cursor( index_ref );
437 
438  while (cursor.Fetch() == eBDB_Ok) {
439  cb(index_ref.GetSeqId(),
440  index_ref.GetVersion(),
441  index_ref.GetGi(),
442  index_ref.GetTimestamp(),
443  index_ref.GetChunkId(),
444  index_ref.GetOffset(),
445  index_ref.GetSize(),
446  index_ref.GetSeqLength(),
447  index_ref.GetTaxId());
448  }
449 }
450 
451 //========== CAsnCacheStoreMany
452 //
453 //
454 CAsnCacheStoreMany::CAsnCacheStoreMany(vector<string> const& db_paths)
455  : m_Index(db_paths.size())
456 {
457  std::iota(m_Index.begin(), m_Index.end(), 0);
458 
459  for ( auto const& db_path: db_paths ) {
460  std::unique_ptr<IAsnCacheStore> store(new CAsnCacheStore(db_path) );
461  m_Stores.push_back(std::move(store));
462  }
463 }
464 
465 /// Return the raw blob in an unformatted buffer.
466 bool CAsnCacheStoreMany::GetRaw(const objects::CSeq_id_Handle& id, vector<unsigned char>& buffer)
467 {
468  std::shuffle(m_Index.begin(), m_Index.end(), default_random_engine());
469 
470  for ( auto const& i: m_Index ) {
471 
472  if ( m_Stores[i]->GetRaw(id, buffer) ) {
473  return true;
474  }
475  }
476  return false;
477 }
478 
479 bool CAsnCacheStoreMany::GetMultipleRaw(const objects::CSeq_id_Handle& id, vector<vector<unsigned char>>& buffer)
480 {
481  std::shuffle(m_Index.begin(), m_Index.end(), default_random_engine());
482 
483  for ( auto const& i: m_Index ) {
484  if ( m_Stores[i]->GetMultipleRaw(id, buffer) ) {
485  return true;
486  }
487  }
488  return false;
489 }
490 
491 /// Return the cache blob, packed and uninterpreted
492 bool CAsnCacheStoreMany::GetBlob(const objects::CSeq_id_Handle& id, objects::CCache_blob& blob)
493 {
494  std::shuffle(m_Index.begin(), m_Index.end(), default_random_engine());
495 
496  for ( auto const& i: m_Index ) {
497  if ( m_Stores[i]->GetBlob(id, blob) ) {
498  return true;
499  }
500  }
501  return false;
502 }
503 
504 bool CAsnCacheStoreMany::GetMultipleBlobs(const objects::CSeq_id_Handle& id,
505  vector< CRef<objects::CCache_blob> >& blob)
506 {
507  std::shuffle(m_Index.begin(), m_Index.end(), default_random_engine());
508 
509  for ( auto const& i: m_Index ) {
510  if ( m_Stores[i]->GetMultipleBlobs(id, blob) ) {
511  return true;
512  }
513  }
514  return false;
515 }
516 
517 ///
518 /// Return the set of seq-ids associated with a given ID. By default, if
519 /// the SeqId index is not available, and the SeqIds can't be retrieved
520 /// cheaply, does nothing and return false. If cheap_only is set to false,
521 /// will always retrieve the SeqIds, by retrieving the full blob if that is
522 /// the only available way.
523 ///
524 bool CAsnCacheStoreMany::GetSeqIds(const objects::CSeq_id_Handle& id,
525  vector<objects::CSeq_id_Handle>& all_ids,
526  bool cheap_only)
527 {
528  std::shuffle(m_Index.begin(), m_Index.end(), default_random_engine());
529 
530  for ( auto const& i: m_Index ) {
531  if ( m_Stores[i]->GetSeqIds(id, all_ids, cheap_only) ) {
532  return true;
533  }
534  }
535  return false;
536 }
537 
538 ///
539 /// Check if the SeqId cache, for efficient retrieval of SeqIds, is
540 /// available
541 ///
542 #if 0 // Not used anywhere
543 bool CAsnCacheStoreMany::EfficientlyGetSeqIds() const
544 {
545 }
546 #endif
547 
548 /// Return a blob as a CSeq_entry object.
549 CRef<objects::CSeq_entry> CAsnCacheStoreMany::GetEntry(const objects::CSeq_id_Handle& id)
550 {
551  std::shuffle(m_Index.begin(), m_Index.end(), default_random_engine());
552 
553  for ( auto const& i: m_Index ) {
554  auto entry = m_Stores[i]->GetEntry(id);
555  if ( entry ) {
556  return entry;
557  }
558  }
559 
560  return CRef<CSeq_entry>();
561 }
562 
563 vector< CRef<objects::CSeq_entry> > CAsnCacheStoreMany::GetMultipleEntries(const objects::CSeq_id_Handle& id)
564 {
565  std::shuffle(m_Index.begin(), m_Index.end(), default_random_engine());
566 
567  for ( auto const& i: m_Index ) {
568  auto entries = m_Stores[i]->GetMultipleEntries(id);
569  if ( !entries.empty() ) {
570  return entries;
571  }
572  }
573 
574  return vector<CRef<CSeq_entry> >();
575 }
576 
577 /// Return the GI and timestamp for a given seq_id. This can be a very
578 /// fast way to look up the GI for an accession.version because only the
579 /// index is queried -- the blob is not retrieved.
580 bool CAsnCacheStoreMany::GetIdInfo(const objects::CSeq_id_Handle& id,
581  CAsnIndex::TGi& gi,
582  time_t& timestamp)
583 {
584  std::shuffle(m_Index.begin(), m_Index.end(), default_random_engine());
585 
586  for ( auto const& i: m_Index ) {
587  if ( m_Stores[i]->GetIdInfo(id, gi, timestamp) ) {
588  return true;
589  }
590  }
591  return false;
592 }
593 
594 /// Return the GI and timestamp for a given seq_id. This can be a very
595 /// fast way to look up the GI for an accession.version because only the
596 /// index is queried -- the blob is not retrieved.
597 bool CAsnCacheStoreMany::GetIdInfo(const objects::CSeq_id_Handle& id,
598  objects::CSeq_id_Handle& accession,
599  CAsnIndex::TGi& gi,
600  time_t& timestamp,
601  Uint4& sequence_length,
602  Uint4& tax_id)
603 {
604  std::shuffle(m_Index.begin(), m_Index.end(), default_random_engine());
605 
606  for ( auto const& i: m_Index ) {
607  if ( m_Stores[i]->GetIdInfo(id, accession, gi, timestamp, sequence_length, tax_id) ) {
608  return true;
609  }
610  }
611  return false;
612 }
613 
614 bool CAsnCacheStoreMany::GetIndexEntry(const objects::CSeq_id_Handle & id,
616 {
617  std::shuffle(m_Index.begin(), m_Index.end(), default_random_engine());
618 
619  for ( auto const& i: m_Index ) {
620  if ( m_Stores[i]->GetIndexEntry(id, info) ) {
621  return true;
622  }
623  }
624  return false;
625 }
626 
627 bool CAsnCacheStoreMany::GetMultipleIndexEntries(const objects::CSeq_id_Handle & id,
628  vector<CAsnIndex::SIndexInfo> &info)
629 {
630  std::shuffle(m_Index.begin(), m_Index.end(), default_random_engine());
631 
632  for ( auto const& i: m_Index ) {
633  if ( m_Stores[i]->GetMultipleIndexEntries(id, info) ) {
634  return true;
635  }
636  }
637  return false;
638 }
639 
640 // IAsnCacheStats implementation
641 
643 {
644  size_t count = 0;
645 
646  for ( auto const& store: m_Stores ) {
647  count += store->GetGiCount();
648  }
649  return count;
650 }
651 
653 {
654  for ( auto const& store: m_Stores ) {
655  store->EnumSeqIds(cb);
656  }
657 }
658 
660 {
661  for ( auto const& store: m_Stores ) {
662  store->EnumIndex(cb);
663  }
664 }
665 
667 
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.
USING_SCOPE(objects)
CConstRef< objects::CBioseq > ExtractBioseq(CConstRef< objects::CSeq_entry > entry, const objects::CSeq_id_Handle &id)
void GetNormalizedSeqId(const objects::CSeq_id_Handle &id, string &id_str, Uint4 &version)
Berkeley BDB file cursor.
bool GetMultipleIndexEntries(const objects::CSeq_id_Handle &id, vector< CAsnIndex::SIndexInfo > &info)
void EnumSeqIds(IAsnCacheStore::TEnumSeqidCallback cb) const
CRef< objects::CSeq_entry > GetEntry(const objects::CSeq_id_Handle &id)
Check if the SeqId cache, for efficient retrieval of SeqIds, is available.
size_t GetGiCount() const
bool GetBlob(const objects::CSeq_id_Handle &id, objects::CCache_blob &blob)
Return the cache blob, packed and uninterpreted.
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.
CAsnCacheStoreMany()=delete
std::vector< std::unique_ptr< IAsnCacheStore > > m_Stores
bool GetMultipleRaw(const objects::CSeq_id_Handle &id, vector< vector< unsigned char >> &buffer)
bool GetRaw(const objects::CSeq_id_Handle &id, vector< unsigned char > &buffer)
Return the raw blob in an unformatted buffer.
bool GetMultipleBlobs(const objects::CSeq_id_Handle &id, vector< CRef< objects::CCache_blob > > &blob)
bool GetIdInfo(const objects::CSeq_id_Handle &id, CAsnIndex::TGi &gi, time_t &timestamp)
Return the GI and timestamp for a given seq_id.
bool GetIndexEntry(const objects::CSeq_id_Handle &id, CAsnIndex::SIndexInfo &info)
Get the full ASN cache index entry.
std::vector< int > m_Index
void EnumIndex(IAsnCacheStore::TEnumIndexCallback cb) const
vector< CRef< objects::CSeq_entry > > GetMultipleEntries(const objects::CSeq_id_Handle &id)
std::unique_ptr< CAsnIndex > m_Index
static bool s_GetChunkAndOffset(const objects::CSeq_id_Handle &idh, CAsnIndex &index, vector< CAsnIndex::SIndexInfo > &info, bool multiple)
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.
bool GetBlob(const objects::CSeq_id_Handle &id, objects::CCache_blob &blob)
Return the cache blob, packed and uninterpreted.
bool GetMultipleIndexEntries(const objects::CSeq_id_Handle &id, vector< CAsnIndex::SIndexInfo > &info)
std::unique_ptr< CChunkFile > m_CurrChunk
vector< CRef< objects::CSeq_entry > > GetMultipleEntries(const objects::CSeq_id_Handle &id)
CRef< objects::CSeq_entry > GetEntry(const objects::CSeq_id_Handle &id)
Check if the SeqId cache, for efficient retrieval of SeqIds, is available.
bool GetMultipleBlobs(const objects::CSeq_id_Handle &id, vector< CRef< objects::CCache_blob > > &blob)
size_t GetGiCount() const
std::unique_ptr< CSeqIdChunkFile > m_SeqIdChunk
std::string m_DbPath
CAsnIndex & x_GetIndexRef() const
bool GetMultipleRaw(const objects::CSeq_id_Handle &id, vector< vector< unsigned char >> &buffer)
bool GetIndexEntry(const objects::CSeq_id_Handle &id, CAsnIndex::SIndexInfo &info)
Get the full ASN cache index entry.
bool x_GetBlob(const CAsnIndex::SIndexInfo &info, objects::CCache_blob &blob)
std::unique_ptr< CAsnIndex > m_SeqIdIndex
void EnumIndex(IAsnCacheStore::TEnumIndexCallback cb) const
bool GetRaw(const objects::CSeq_id_Handle &id, vector< unsigned char > &buffer)
Return the raw blob in an unformatted buffer.
bool GetIdInfo(const objects::CSeq_id_Handle &id, CAsnIndex::TGi &gi, time_t &timestamp)
Return the GI and timestamp for a given seq_id.
CAsnIndex::TChunkId m_CurrChunkId
CAsnCacheStore()=delete
void EnumSeqIds(IAsnCacheStore::TEnumSeqidCallback cb) const
This is a simple BDB structure holding information about a given accession and its indexed location.
Definition: asn_index.hpp:53
Uint8 TGi
Definition: asn_index.hpp:57
Berkeley DB file cursor class.
Definition: bdb_cursor.hpp:95
void UnPack(CSeq_entry &entry) const
Definition: Cache_blob.cpp:98
CFile –.
Definition: ncbifile.hpp:1604
CRef –.
Definition: ncbiobj.hpp:618
Definition: Seq_entry.hpp:56
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
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
@ eFollowLinks
Follow symbolic links.
Definition: ncbimisc.hpp:145
void SetCondition(ECondition cond_from, ECondition cond_to=eNotSet)
Set search condition(type of interval)
Definition: bdb_cursor.cpp:263
EBDB_ErrCode Fetch(EFetchDirection fdir=eDefault)
Fetch record.
Definition: bdb_cursor.cpp:665
@ eBDB_Ok
Definition: bdb_file.hpp:58
#define _TRACE(message)
Definition: ncbidbg.hpp:122
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
Definition: ncbidiag.hpp:186
void Error(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1197
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
static string NormalizePath(const string &path, EFollowLinks follow_links=eIgnoreLinks)
Normalize a path.
Definition: ncbifile.cpp:820
static string CreateAbsolutePath(const string &path, ERelativeToWhat rtw=eRelativeToCwd)
Get an absolute path from some, possibly relative, path.
Definition: ncbifile.cpp:665
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
bool NotNull(void) const THROWS_NONE
Check if pointer is not null – same effect as NotEmpty().
Definition: ncbiobj.hpp:1410
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
const TId & GetId(void) const
Get the Id member data.
Definition: Bioseq_.hpp:290
list< CRef< CSeq_id > > TId
Definition: Bioseq_.hpp:94
int i
static MDB_envinfo info
Definition: mdb_load.c:37
static int version
Definition: mdb_load.c:29
string GetBDBIndex()
Definition: file_names.hpp:44
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
static pcre_uint8 * buffer
Definition: pcretest.c:1051
static bool GetSeqId(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
static wxAcceleratorEntry entries[3]
ZLib Compression API.
Modified on Wed Nov 29 02:16:16 2023 by modify_doxy.py rev. 669887