rippled
RelationalDBInterfaceSqlite.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_CORE_RELATIONALDBINTERFACESQLITE_H_INCLUDED
21 #define RIPPLE_CORE_RELATIONALDBINTERFACESQLITE_H_INCLUDED
22 
23 #include <ripple/app/rdb/RelationalDBInterface.h>
24 
25 namespace ripple {
26 
28 {
29 public:
37 
45 
51  virtual void
53 
59  virtual void
60  deleteBeforeLedgerSeq(LedgerIndex ledgerSeq) = 0;
61 
67  virtual void
69 
76  virtual void
78 
83  virtual std::size_t
84  getTransactionCount() = 0;
85 
91  virtual std::size_t
93 
100  virtual struct CountMinMax
101  getLedgerCountMinMax() = 0;
102 
109  virtual bool
111  std::shared_ptr<Ledger const> const& ledger,
112  bool current) = 0;
113 
121  getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) = 0;
122 
130  getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) = 0;
131 
142  virtual AccountTxs
143  getOldestAccountTxs(AccountTxOptions const& options) = 0;
144 
155  virtual AccountTxs
156  getNewestAccountTxs(AccountTxOptions const& options) = 0;
157 
169  virtual MetaTxsList
170  getOldestAccountTxsB(AccountTxOptions const& options) = 0;
171 
184  virtual MetaTxsList
185  getNewestAccountTxsB(AccountTxOptions const& options) = 0;
186 
199  oldestAccountTxPage(AccountTxPageOptions const& options) = 0;
200 
213  newestAccountTxPage(AccountTxPageOptions const& options) = 0;
214 
228  oldestAccountTxPageB(AccountTxPageOptions const& options) = 0;
229 
243  newestAccountTxPageB(AccountTxPageOptions const& options) = 0;
244 
261  uint256 const& id,
263  error_code_i& ec) = 0;
264 
269  virtual uint32_t
270  getKBUsedAll() = 0;
271 
276  virtual uint32_t
277  getKBUsedLedger() = 0;
278 
284  virtual uint32_t
285  getKBUsedTransaction() = 0;
286 
290  virtual void
291  closeLedgerDB() = 0;
292 
296  virtual void
297  closeTransactionDB() = 0;
298 };
299 
300 } // namespace ripple
301 
302 #endif
ripple::RelationalDBInterfaceSqlite::getLimitedNewestLedgerInfo
virtual std::optional< LedgerInfo > getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex)=0
getLimitedNewestLedgerInfo Returns info of newest ledger from ledgers with sequences greater or equal...
ripple::RelationalDBInterfaceSqlite::getKBUsedTransaction
virtual uint32_t getKBUsedTransaction()=0
getKBUsedTransaction Returns space used by transaction database.
std::shared_ptr
STL class.
ripple::RelationalDBInterfaceSqlite::oldestAccountTxPageB
virtual std::pair< MetaTxsList, std::optional< AccountTxMarker > > oldestAccountTxPageB(AccountTxPageOptions const &options)=0
oldestAccountTxPageB Returns oldest transactions in binary form for given account which match given c...
std::pair
std::vector
STL class.
ripple::RelationalDBInterfaceSqlite::getNewestAccountTxs
virtual AccountTxs getNewestAccountTxs(AccountTxOptions const &options)=0
getNewestAccountTxs Returns newest transactions for given account which match given criteria starting...
ripple::RelationalDBInterfaceSqlite::deleteBeforeLedgerSeq
virtual void deleteBeforeLedgerSeq(LedgerIndex ledgerSeq)=0
deleteBeforeLedgerSeq Deletes all ledgers with given sequence and all sequences below it.
ripple::RelationalDBInterfaceSqlite::newestAccountTxPage
virtual std::pair< AccountTxs, std::optional< AccountTxMarker > > newestAccountTxPage(AccountTxPageOptions const &options)=0
newestAccountTxPage Returns newest transactions for given account which match given criteria starting...
ripple::RelationalDBInterfaceSqlite::getAccountTransactionCount
virtual std::size_t getAccountTransactionCount()=0
getAccountTransactionCount Returns number of account transactions.
ripple::RelationalDBInterface
Definition: RelationalDBInterface.h:48
ripple::RelationalDBInterfaceSqlite::saveValidatedLedger
virtual bool saveValidatedLedger(std::shared_ptr< Ledger const > const &ledger, bool current)=0
saveValidatedLedger Saves ledger into database.
ripple::RelationalDBInterfaceSqlite::getTransactionsMinLedgerSeq
virtual std::optional< LedgerIndex > getTransactionsMinLedgerSeq()=0
getTransactionsMinLedgerSeq Returns minimum ledger sequence among records in the Transactions table.
ripple::RelationalDBInterfaceSqlite::getLimitedOldestLedgerInfo
virtual std::optional< LedgerInfo > getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex)=0
getLimitedOldestLedgerInfo Returns info of oldest ledger from ledgers with sequences greater or equal...
ripple::RelationalDBInterfaceSqlite::getOldestAccountTxsB
virtual MetaTxsList getOldestAccountTxsB(AccountTxOptions const &options)=0
getOldestAccountTxsB Returns oldest transactions in binary form for given account which match given c...
ripple::RelationalDBInterfaceSqlite::deleteTransactionsBeforeLedgerSeq
virtual void deleteTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq)=0
deleteTransactionsBeforeLedgerSeq Deletes all transactions with given ledger sequence and all sequenc...
ripple::error_code_i
error_code_i
Definition: ErrorCodes.h:40
ripple::RelationalDBInterfaceSqlite::newestAccountTxPageB
virtual std::pair< MetaTxsList, std::optional< AccountTxMarker > > newestAccountTxPageB(AccountTxPageOptions const &options)=0
newestAccountTxPageB Returns newest transactions in binary form for given account which match given c...
ripple::RelationalDBInterfaceSqlite::getOldestAccountTxs
virtual AccountTxs getOldestAccountTxs(AccountTxOptions const &options)=0
getOldestAccountTxs Returns oldest transactions for given account which match given criteria starting...
ripple::RelationalDBInterface::CountMinMax
Definition: RelationalDBInterface.h:51
ripple::base_uint< 256 >
ripple::RelationalDBInterfaceSqlite::getKBUsedLedger
virtual uint32_t getKBUsedLedger()=0
getKBUsedLedger Returns space used by ledger database.
ripple::RelationalDBInterfaceSqlite::closeTransactionDB
virtual void closeTransactionDB()=0
Closes the transaction database.
ripple::RelationalDBInterfaceSqlite
Definition: RelationalDBInterfaceSqlite.h:27
ripple::RelationalDBInterfaceSqlite::getTransaction
virtual std::variant< AccountTx, TxSearched > getTransaction(uint256 const &id, std::optional< ClosedInterval< uint32_t >> const &range, error_code_i &ec)=0
getTransaction Returns transaction with given hash.
ripple::ValStatus::current
@ current
This was a new validation and was added.
std::uint32_t
ripple::range
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
Definition: RangeSet.h:53
ripple::RelationalDBInterfaceSqlite::deleteTransactionByLedgerSeq
virtual void deleteTransactionByLedgerSeq(LedgerIndex ledgerSeq)=0
deleteTransactionByLedgerSeq Deletes transactions from ledger with given sequence.
ripple::RelationalDBInterfaceSqlite::getNewestAccountTxsB
virtual MetaTxsList getNewestAccountTxsB(AccountTxOptions const &options)=0
getNewestAccountTxsB Returns newest transactions in binary form for given account which match given c...
ripple::RelationalDBInterfaceSqlite::deleteAccountTransactionsBeforeLedgerSeq
virtual void deleteAccountTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq)=0
deleteAccountTransactionsBeforeLedgerSeq Deletes all account transactions with given ledger sequence ...
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::RelationalDBInterfaceSqlite::oldestAccountTxPage
virtual std::pair< AccountTxs, std::optional< AccountTxMarker > > oldestAccountTxPage(AccountTxPageOptions const &options)=0
oldestAccountTxPage Returns oldest transactions for given account which match given criteria starting...
std::optional
std::size_t
ripple::RelationalDBInterfaceSqlite::getKBUsedAll
virtual uint32_t getKBUsedAll()=0
getKBUsedAll Returns space used by all databases.
ripple::RelationalDBInterface::AccountTxPageOptions
Definition: RelationalDBInterface.h:74
ripple::ClosedInterval
boost::icl::closed_interval< T > ClosedInterval
A closed interval over the domain T.
Definition: RangeSet.h:44
ripple::RelationalDBInterfaceSqlite::getTransactionCount
virtual std::size_t getTransactionCount()=0
getTransactionCount Returns number of transactions.
ripple::RelationalDBInterfaceSqlite::getAccountTransactionsMinLedgerSeq
virtual std::optional< LedgerIndex > getAccountTransactionsMinLedgerSeq()=0
getAccountTransactionsMinLedgerSeq Returns minimum ledger sequence among records in the AccountTransa...
ripple::RelationalDBInterface::AccountTxOptions
Definition: RelationalDBInterface.h:64
ripple::RelationalDBInterfaceSqlite::getLedgerCountMinMax
virtual struct CountMinMax getLedgerCountMinMax()=0
getLedgerCountMinMax Returns minumum ledger sequence, maximum ledger sequence and total number of sav...
ripple::RelationalDBInterfaceSqlite::closeLedgerDB
virtual void closeLedgerDB()=0
Closes the ledger database.
std::variant