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

Go to the SVN repository for this file.

1 /* $Id: asn_cache_stats.cpp 85949 2019-03-26 12:05:27Z badrazat $
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  * Authors: Cheinan Marks
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 #include <corelib/ncbistre.hpp>
34 
35 #include <db/bdb/bdb_cursor.hpp>
36 
39 
41 
42 size_t CAsnCacheStats::GetGICount( CNcbiOstream * stream ) const
43 {
44  if ( !stream ) {
45  return m_AsnCacheRef.GetGiCount();
46  }
47  else {
48  std::set<uint64_t> gi_coll;
49  m_AsnCacheRef.EnumSeqIds([stream, &gi_coll](string /*seq_id*/,
50  uint32_t /*version*/,
51  uint64_t gi,
52  uint32_t /*timestamp*/) {
53  gi_coll.insert( gi );
54  *stream << gi << '\n';
55 
56  });
57  return gi_coll.size();
58  }
59 }
60 
62 {
63  size_t seqid_count = 0;
64 
65  m_AsnCacheRef.EnumSeqIds([this, &stream, &seqid_count](string seq_id,
67  uint64_t gi,
68  uint32_t timestamp) {
69  stream << seq_id << " | "
70  << version << " | "
71  << gi;
72 
74  stream << " | " << timestamp;
75  }
76  stream << '\n';
77 
78  seqid_count++;
79  });
80 
81  stream << "Total " << seqid_count << " seq_ids found\n.";
82 }
83 
85 {
86  size_t seqid_count = 0;
87 
88  m_AsnCacheRef.EnumIndex([this, &stream, &seqid_count](string seq_id,
90  uint64_t gi,
91  uint32_t timestamp,
92  uint32_t chunk,
94  uint32_t size,
95  uint32_t seq_len,
96  uint32_t taxid) {
97  stream << seq_id << " | "
98  << version << " | "
99  << gi;
100 
102  stream << " | " << timestamp;
103  }
104 
106  stream << " | "
107  << chunk << " | "
108  << offset << " | "
109  << size;
110  }
111 
112  stream << " | "
113  << seq_len << " | "
114  << taxid
115  << '\n';
116 
117  seqid_count++;
118  });
119 
120  stream << "Total " << seqid_count << " seq_ids found\n.";
121 }
122 
123 
124 
Contains the class definiton for CAsnCache, the main client class for accessing the ASN cache data.
USING_NCBI_SCOPE
Berkeley BDB file cursor.
void DumpIndex(CNcbiOstream &stream) const
void DumpSeqIds(CNcbiOstream &stream) const
CAsnCache & m_AsnCacheRef
TIncludeFlags m_IncludeFlags
size_t GetGICount(CNcbiOstream *stream) const
void EnumIndex(IAsnCacheStore::TEnumIndexCallback cb) const
Definition: asn_cache.cpp:189
size_t GetGiCount() const
Definition: asn_cache.cpp:179
void EnumSeqIds(IAsnCacheStore::TEnumSeqidCallback cb) const
Definition: asn_cache.cpp:184
int offset
Definition: replacements.h:160
Uint8 uint64_t
Uint4 uint32_t
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
static int version
Definition: mdb_load.c:29
const struct ncbi::grid::netcache::search::fields::SIZE size
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
Modified on Mon May 20 05:04:00 2024 by modify_doxy.py rev. 669887