NCBI C++ ToolKit
psg_cache_si2csi.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef PSG_CACHE_SI2CSI__HPP
2 #define PSG_CACHE_SI2CSI__HPP
3 
4 /* $Id: psg_cache_si2csi.hpp 99744 2023-05-05 15:04:59Z saprykin $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Dmitri Dmitrienko
30  *
31  * File Description: si2csi table cache
32  *
33  */
34 
35 #include "psg_cache_base.hpp"
36 
37 #include <functional>
38 #include <memory>
39 #include <string>
40 #include <vector>
41 
44 
47 
50 {
51  public:
52  explicit CPubseqGatewayCacheSi2Csi(const string& file_name);
54  void Open();
55 
56  vector<CSI2CSIRecord> Fetch(CSi2CsiFetchRequest const& request);
57  vector<CSI2CSIRecord> FetchLast();
58 
59  static string PackKey(const string& sec_seqid, int sec_seq_id_type);
60  static bool UnpackKey(const char* key, size_t key_sz, int& sec_seq_id_type);
61  static bool UnpackKey(const char* key, size_t key_sz, string& sec_seqid, int& sec_seq_id_type);
62 
63  private:
64  bool x_ExtractRecord(CSI2CSIRecord& record, lmdb::val const& value) const;
65  unique_ptr<lmdb::dbi, function<void(lmdb::dbi*)>> m_Dbi;
66 };
67 
69 
70 #endif // PSG_CACHE_SI2CSI__HPP
#define END_IDBLOB_SCOPE
Definition: IdCassScope.hpp:40
#define BEGIN_IDBLOB_SCOPE
Definition: IdCassScope.hpp:39
static string PackKey(const string &sec_seqid, int sec_seq_id_type)
vector< CSI2CSIRecord > Fetch(CSi2CsiFetchRequest const &request)
bool x_ExtractRecord(CSI2CSIRecord &record, lmdb::val const &value) const
CPubseqGatewayCacheSi2Csi(const string &file_name)
vector< CSI2CSIRecord > FetchLast()
unique_ptr< lmdb::dbi, function< void(lmdb::dbi *)> > m_Dbi
~CPubseqGatewayCacheSi2Csi() override
static bool UnpackKey(const char *key, size_t key_sz, int &sec_seq_id_type)
Resource class for `MDB_dbi` handles.
Definition: lmdb++.h:1395
Wrapper class for `MDB_val` structures.
Definition: lmdb++.h:948
const char * file_name[]
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
BEGIN_IDBLOB_SCOPE USING_NCBI_SCOPE
Modified on Tue May 21 10:59:32 2024 by modify_doxy.py rev. 669887