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

Go to the SVN repository for this file.

1 #ifndef OBJTOOLS__PUBSEQ_GATEWAY__IPG__IPG_HUGE_REPORT_HELPER_HPP_
2 #define OBJTOOLS__PUBSEQ_GATEWAY__IPG__IPG_HUGE_REPORT_HELPER_HPP_
3 /*****************************************************************************
4  * $Id: ipg_huge_report_helper.hpp 98361 2022-11-02 14:51:49Z 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  * IPG report huge groups helper
28  *
29  *****************************************************************************/
30 
31 #include <corelib/ncbistd.hpp>
32 
33 #include <atomic>
34 
37 
39 BEGIN_SCOPE(ipg)
41 
43 {
45  public:
46  static void PrepareHugeIpgConfigQuery(TIpg ipg, string const& keyspace, CCassQuery* query, CassConsistency consistency, bool async)
47  {
48  query->SetSQL("SELECT ipg, subgroups_status, subgroups_hash, subgroups FROM " + keyspace + ".ipg_report_config WHERE ipg = ?", 1);
49  query->BindInt64(0, ipg);
50  query->Query(consistency, async);
51  }
52 
54  {
55  query->NextRow();
56  if (!query->IsEOF()) {
57  config.ipg = query->FieldGetInt64Value(0);
58  auto status_value = query->FieldGetInt32Value(1, 0);
59  config.hash_type = static_cast<EIpgSubgroupHashType>(query->FieldGetInt32Value(2, 0));
60  config.status = static_cast<EIpgSubgroupsStatus>(status_value);
61  query->FieldGetContainerValue(3, back_inserter(config.subgroups));
62  }
63  }
64 
65  static void SetHugeIpgDisabled(bool value)
66  {
67  sm_HugeIpgDisabled = value;
68  }
69 
70  static bool HugeIpgEnabled()
71  {
72  return !sm_HugeIpgDisabled;
73  }
74 private:
75  static atomic_bool sm_HugeIpgDisabled;
76 };
77 
78 END_SCOPE(ipg)
80 
81 #endif // OBJTOOLS__PUBSEQ_GATEWAY__IPG__IPG_HUGE_REPORT_HELPER_HPP_
static void FetchHugeIpgConfigResult(SIpgSubgroupsConfig &config, CCassQuery *query, bool async)
static void PrepareHugeIpgConfigQuery(TIpg ipg, string const &keyspace, CCassQuery *query, CassConsistency consistency, bool async)
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
EIpgSubgroupsStatus
Definition: ipg_types.hpp:65
EIpgSubgroupHashType
Definition: ipg_types.hpp:59
Int8 TIpg
Definition: ipg_types.hpp:43
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
static string query
Modified on Fri Sep 20 14:57:12 2024 by modify_doxy.py rev. 669887