rippled
RelationalDBInterface_postgres.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2021 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_CORE_RELATIONALDBINTERFACE_POSTGRES_H_INCLUDED
21 #define RIPPLE_CORE_RELATIONALDBINTERFACE_POSTGRES_H_INCLUDED
22 
23 #include <ripple/app/ledger/Ledger.h>
24 #include <ripple/app/main/Application.h>
25 #include <ripple/app/misc/Transaction.h>
26 #include <ripple/app/rdb/RelationalDBInterface.h>
27 #include <ripple/core/Pg.h>
28 #include <variant>
29 #include <vector>
30 
31 namespace ripple {
32 
33 class PgPool;
34 
39 
50 
60 
70 
81 
90 
101  std::shared_ptr<PgPool> const& pgPool,
102  std::uint32_t ledgerIndex,
103  Application& app);
104 
114  std::shared_ptr<PgPool> const& pgPool,
115  uint256 const& ledgerHash,
116  Application& app);
117 
126 uint256
128  std::shared_ptr<PgPool> const& pgPool,
129  std::uint32_t ledgerIndex,
130  Application& app);
131 
142 bool
144  std::shared_ptr<PgPool> const& pgPool,
145  std::uint32_t ledgerIndex,
146  uint256& ledgerHash,
147  uint256& parentHash,
148  Application& app);
149 
161  std::shared_ptr<PgPool> const& pgPool,
162  std::uint32_t minSeq,
163  std::uint32_t maxSeq,
164  Application& app);
165 
176  std::shared_ptr<PgPool> const& pgPool,
177  LedgerIndex seq,
178  Application& app);
179 
193  std::shared_ptr<PgPool> const& pgPool,
194  uint256 const& id,
195  Application& app);
196 
209  std::shared_ptr<PgPool> const& pgPool,
210  LedgerIndex startIndex,
211  Application& app,
212  beast::Journal j);
213 
225  std::shared_ptr<PgPool> const& pgPool,
226  AccountTxArgs const& args,
227  Application& app,
228  beast::Journal j);
229 
239 bool
241  std::shared_ptr<PgPool> const& pgPool,
242  LedgerInfo const& info,
243  std::vector<AccountTransactionsData> const& accountTxData,
244  beast::Journal& j);
245 
246 } // namespace ripple
247 
248 #endif
ripple::getLedgerInfoByIndex
std::optional< LedgerInfo > getLedgerInfoByIndex(soci::session &session, LedgerIndex ledgerSeq, beast::Journal j)
getLedgerInfoByIndex Returns ledger by its sequence.
Definition: RelationalDBInterface_nodes.cpp:455
ripple::Application
Definition: Application.h:103
ripple::RelationalDBInterface::AccountTxArgs
Definition: RelationalDBInterface.h:96
ripple::getAccountTx
std::pair< AccountTxResult, RPC::Status > getAccountTx(std::shared_ptr< PgPool > const &pgPool, AccountTxArgs const &args, Application &app, beast::Journal j)
getAccountTx Get last account transactions specifies by passed argumenrs structure.
Definition: RelationalDBInterface_postgres.cpp:542
std::string
STL class.
std::shared_ptr< PgPool >
ripple::getTxHistory
std::pair< std::vector< std::shared_ptr< Transaction > >, int > getTxHistory(soci::session &session, Application &app, LedgerIndex startIndex, int quantity, bool count)
getTxHistory Returns given number of most recent transactions starting from given number of entry.
Definition: RelationalDBInterface_nodes.cpp:615
ripple::getHashByIndex
uint256 getHashByIndex(soci::session &session, LedgerIndex ledgerIndex)
getHashByIndex Returns hash of ledger with given sequence.
Definition: RelationalDBInterface_nodes.cpp:509
std::pair
ripple::RelationalDBInterface::AccountTransactionsData
Struct used to keep track of what to write to transactions and account_transactions tables in Postgre...
Definition: RelationalDBInterface.h:116
vector
ripple::RelationalDBInterface::AccountTxResult
Definition: RelationalDBInterface.h:106
std::chrono::seconds
ripple::getLedgerInfoByHash
std::optional< LedgerInfo > getLedgerInfoByHash(soci::session &session, uint256 const &ledgerHash, beast::Journal j)
getLedgerInfoByHash Returns info of ledger with given hash.
Definition: RelationalDBInterface_nodes.cpp:498
ripple::locateTransaction
Transaction::Locator locateTransaction(std::shared_ptr< PgPool > const &pgPool, uint256 const &id, Application &app)
locateTransaction Returns information used to locate a transaction.
Definition: RelationalDBInterface_postgres.cpp:657
ripple::getCompleteLedgers
std::string getCompleteLedgers(std::shared_ptr< PgPool > const &pgPool)
getCompleteLedgers Returns string which contains list of completed ledgers
Definition: RelationalDBInterface_postgres.cpp:61
ripple::base_uint
Integers of any length that is a multiple of 32-bits.
Definition: base_uint.h:74
ripple::writeLedgerAndTransactions
bool writeLedgerAndTransactions(std::shared_ptr< PgPool > const &pgPool, LedgerInfo const &info, std::vector< AccountTransactionsData > const &accountTxData, beast::Journal &j)
writeLedgerAndTransactions Write new ledger and transaction data to Postgres.
Definition: RelationalDBInterface_postgres.cpp:762
ripple::getValidatedLedgerAge
std::chrono::seconds getValidatedLedgerAge(std::shared_ptr< PgPool > const &pgPool, beast::Journal j)
getValidatedLedgerAge Returns age of last validated ledger
Definition: RelationalDBInterface_postgres.cpp:72
ripple::Transaction::Locator
Definition: Transaction.h:315
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint32_t
std::map
STL class.
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::getHashesByIndex
std::optional< LedgerHashPair > getHashesByIndex(soci::session &session, LedgerIndex ledgerIndex, beast::Journal j)
getHashesByIndex Returns hash of the ledger and hash of parent ledger for the ledger of given sequenc...
Definition: RelationalDBInterface_nodes.cpp:539
std::optional
ripple::LedgerInfo
Information about the notional ledger backing the view.
Definition: ReadView.h:84
ripple::RelationalDBInterface::AccountTxMarker
Definition: RelationalDBInterface.h:58
ripple::getMinLedgerSeq
std::optional< LedgerIndex > getMinLedgerSeq(soci::session &session, TableType type)
getMinLedgerSeq Returns minimum ledger sequence in given table.
Definition: RelationalDBInterface_nodes.cpp:121
ripple::getNewestLedgerInfo
std::optional< LedgerInfo > getNewestLedgerInfo(soci::session &session, beast::Journal j)
getNewestLedgerInfo Returns info of newest saved ledger.
Definition: RelationalDBInterface_nodes.cpp:466
ripple::getMaxLedgerSeq
std::optional< LedgerIndex > getMaxLedgerSeq(soci::session &session, TableType type)
getMaxLedgerSeq Returns maximum ledger sequence in given table.
Definition: RelationalDBInterface_nodes.cpp:131
ripple::getTxHashes
std::vector< uint256 > getTxHashes(std::shared_ptr< PgPool > const &pgPool, LedgerIndex seq, Application &app)
getTxHashes Returns vector of tx hashes by given ledger sequence
Definition: RelationalDBInterface_postgres.cpp:330
variant