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

Go to the SVN repository for this file.

1 #ifndef OBJTOOLS__PUBSEQ_GATEWAY__CASSANDRA__BLOB_TASK__FETCH_SPLIT_HISTORY_HPP_
2 #define OBJTOOLS__PUBSEQ_GATEWAY__CASSANDRA__BLOB_TASK__FETCH_SPLIT_HISTORY_HPP_
3 
4 /* $Id: fetch_split_history.hpp 97228 2022-06-28 14:10:54Z 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: Dmitrii Saprykin
30  *
31  * File Description:
32  *
33  * Fetch operation for Cassandra blob split history
34  *
35  */
36 
39 
40 #include <functional>
41 #include <memory>
42 #include <string>
43 #include <utility>
44 #include <vector>
45 
48 
50 {
52 
56  string id2_info;
57 };
58 
60  : public CCassBlobWaiter
61 {
62  enum ETaskState {
63  eInit = 0,
67  };
68 
69  public:
71  using TConsumeCallback = function<void(vector<SSplitHistoryRecord> &&)>;
72 
74  shared_ptr<CCassConnection> conn,
75  const string & keyspace,
76  CBlobRecord::TSatKey sat_key,
77  TConsumeCallback consume_callback,
78  TDataErrorCallback data_error_cb
79  );
80 
82  shared_ptr<CCassConnection> conn,
83  const string & keyspace,
84  CBlobRecord::TSatKey sat_key,
86  TConsumeCallback consume_callback,
87  TDataErrorCallback data_error_cb
88  );
89 
91  {
92  return m_SplitVersion;
93  }
94 
95  void SetDataReadyCB(shared_ptr<CCassDataCallbackReceiver> callback);
96  void SetConsumeCallback(TConsumeCallback callback);
97 
98  protected:
99  void Wait1() override;
100 
101  private:
103  vector<SSplitHistoryRecord> m_Result;
105  unsigned int m_RestartCounter{0};
106 };
107 
109 
110 #endif // OBJTOOLS__PUBSEQ_GATEWAY__CASSANDRA__BLOB_TASK__FETCH_SPLIT_HISTORY_HPP_
#define END_IDBLOB_SCOPE
Definition: IdCassScope.hpp:40
#define BEGIN_IDBLOB_SCOPE
Definition: IdCassScope.hpp:39
function< void(CRequestStatus::ECode status, int code, EDiagSev severity, const string &message)> TDataErrorCallback
int64_t TTimestamp
Definition: blob_record.hpp:56
int32_t TSatKey
Definition: blob_record.hpp:54
CCassBlobTaskFetchSplitHistory(shared_ptr< CCassConnection > conn, const string &keyspace, CBlobRecord::TSatKey sat_key, TConsumeCallback consume_callback, TDataErrorCallback data_error_cb)
SSplitHistoryRecord::TSplitVersion GetSplitVersion() const
function< void(vector< SSplitHistoryRecord > &&)> TConsumeCallback
vector< SSplitHistoryRecord > m_Result
SSplitHistoryRecord::TSplitVersion m_SplitVersion
void SetDataReadyCB(shared_ptr< CCassDataCallbackReceiver > callback)
static const SSplitHistoryRecord::TSplitVersion kAllVersions
void SetConsumeCallback(TConsumeCallback callback)
BEGIN_IDBLOB_SCOPE USING_NCBI_SCOPE
static CS_CONNECTION * conn
Definition: ct_dynamic.c:25
Int4 int32_t
CBlobRecord::TTimestamp modified
CBlobRecord::TSatKey sat_key
Modified on Thu May 23 12:31:11 2024 by modify_doxy.py rev. 669887