rippled
DBHelpers.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2020 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef RIPPLE_APP_REPORTING_DBHELPERS_H_INCLUDED
21 #define RIPPLE_APP_REPORTING_DBHELPERS_H_INCLUDED
22 
23 #include <ripple/app/reporting/ReportingETL.h>
24 #include <ripple/basics/Log.h>
25 #include <ripple/core/Pg.h>
26 #include <boost/container/flat_set.hpp>
27 
28 namespace ripple {
29 
33 {
34  boost::container::flat_set<AccountID> accounts;
35  uint32_t ledgerSequence;
36  uint32_t transactionIndex;
39 
41  TxMeta& meta,
43  beast::Journal& j)
44  : accounts(meta.getAffectedAccounts(j))
45  , ledgerSequence(meta.getLgrSeq())
46  , transactionIndex(meta.getIndex())
47  , txHash(meta.getTxID())
49  {
50  }
51 };
52 
53 #ifdef RIPPLED_REPORTING
54 bool
61 writeToPostgres(
62  LedgerInfo const& info,
63  std::vector<AccountTransactionsData> const& accountTxData,
64  std::shared_ptr<PgPool> const& pgPool,
65  beast::Journal& j);
66 
67 #endif
68 } // namespace ripple
69 #endif
std::shared_ptr
STL class.
ripple::AccountTransactionsData
Struct used to keep track of what to write to transactions and account_transactions tables in Postgre...
Definition: DBHelpers.h:32
std::vector
STL class.
ripple::AccountTransactionsData::txHash
uint256 txHash
Definition: DBHelpers.h:37
ripple::TxMeta
Definition: TxMeta.h:32
ripple::base_uint< 256 >
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
ripple::AccountTransactionsData::AccountTransactionsData
AccountTransactionsData(TxMeta &meta, uint256 &&nodestoreHash, beast::Journal &j)
Definition: DBHelpers.h:40
ripple::AccountTransactionsData::accounts
boost::container::flat_set< AccountID > accounts
Definition: DBHelpers.h:34
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::AccountTransactionsData::nodestoreHash
uint256 nodestoreHash
Definition: DBHelpers.h:38
ripple::AccountTransactionsData::ledgerSequence
uint32_t ledgerSequence
Definition: DBHelpers.h:35
std
STL namespace.
ripple::AccountTransactionsData::transactionIndex
uint32_t transactionIndex
Definition: DBHelpers.h:36