rippled
SQLiteDatabase.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_RDB_BACKEND_SQLITEDATABASE_H_INCLUDED
21 #define RIPPLE_APP_RDB_BACKEND_SQLITEDATABASE_H_INCLUDED
22 
23 #include <ripple/app/rdb/RelationalDatabase.h>
24 
25 namespace ripple {
26 
28 {
29 public:
37 
45 
51  virtual void
53 
59  virtual void
60  deleteBeforeLedgerSeq(LedgerIndex ledgerSeq) = 0;
61 
68  virtual void
70 
77  virtual void
79 
84  virtual std::size_t
85  getTransactionCount() = 0;
86 
92  virtual std::size_t
94 
101  virtual struct CountMinMax
102  getLedgerCountMinMax() = 0;
103 
110  virtual bool
112  std::shared_ptr<Ledger const> const& ledger,
113  bool current) = 0;
114 
123  getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex) = 0;
124 
133  getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex) = 0;
134 
146  virtual AccountTxs
147  getOldestAccountTxs(AccountTxOptions const& options) = 0;
148 
160  virtual AccountTxs
161  getNewestAccountTxs(AccountTxOptions const& options) = 0;
162 
174  virtual MetaTxsList
175  getOldestAccountTxsB(AccountTxOptions const& options) = 0;
176 
189  virtual MetaTxsList
190  getNewestAccountTxsB(AccountTxOptions const& options) = 0;
191 
205  oldestAccountTxPage(AccountTxPageOptions const& options) = 0;
206 
220  newestAccountTxPage(AccountTxPageOptions const& options) = 0;
221 
236  oldestAccountTxPageB(AccountTxPageOptions const& options) = 0;
237 
252  newestAccountTxPageB(AccountTxPageOptions const& options) = 0;
253 
271  uint256 const& id,
273  error_code_i& ec) = 0;
274 
279  virtual uint32_t
280  getKBUsedAll() = 0;
281 
287  virtual uint32_t
288  getKBUsedLedger() = 0;
289 
295  virtual uint32_t
296  getKBUsedTransaction() = 0;
297 
301  virtual void
302  closeLedgerDB() = 0;
303 
307  virtual void
308  closeTransactionDB() = 0;
309 };
310 
311 } // namespace ripple
312 
313 #endif
ripple::SQLiteDatabase
Definition: SQLiteDatabase.h:27
std::shared_ptr
STL class.
ripple::SQLiteDatabase::saveValidatedLedger
virtual bool saveValidatedLedger(std::shared_ptr< Ledger const > const &ledger, bool current)=0
saveValidatedLedger Saves a ledger into the database.
ripple::SQLiteDatabase::newestAccountTxPageB
virtual std::pair< MetaTxsList, std::optional< AccountTxMarker > > newestAccountTxPageB(AccountTxPageOptions const &options)=0
newestAccountTxPageB Returns the newest transactions in binary form for the account that matches the ...
std::pair
std::vector
STL class.
ripple::SQLiteDatabase::getLimitedNewestLedgerInfo
virtual std::optional< LedgerInfo > getLimitedNewestLedgerInfo(LedgerIndex ledgerFirstIndex)=0
getLimitedNewestLedgerInfo Returns the info of the newest ledger whose sequence number is greater tha...
ripple::SQLiteDatabase::oldestAccountTxPageB
virtual std::pair< MetaTxsList, std::optional< AccountTxMarker > > oldestAccountTxPageB(AccountTxPageOptions const &options)=0
oldestAccountTxPageB Returns the oldest transactions in binary form for the account that matches the ...
ripple::RelationalDatabase::AccountTxOptions
Definition: RelationalDatabase.h:64
ripple::SQLiteDatabase::newestAccountTxPage
virtual std::pair< AccountTxs, std::optional< AccountTxMarker > > newestAccountTxPage(AccountTxPageOptions const &options)=0
newestAccountTxPage Returns the newest transactions for the account that matches the given criteria s...
ripple::SQLiteDatabase::getAccountTransactionsMinLedgerSeq
virtual std::optional< LedgerIndex > getAccountTransactionsMinLedgerSeq()=0
getAccountTransactionsMinLedgerSeq Returns the minimum ledger sequence stored in the AccountTransacti...
ripple::error_code_i
error_code_i
Definition: ErrorCodes.h:40
ripple::SQLiteDatabase::getNewestAccountTxs
virtual AccountTxs getNewestAccountTxs(AccountTxOptions const &options)=0
getNewestAccountTxs Returns the newest transactions for the account that matches the given criteria s...
ripple::SQLiteDatabase::getTransactionsMinLedgerSeq
virtual std::optional< LedgerIndex > getTransactionsMinLedgerSeq()=0
getTransactionsMinLedgerSeq Returns the minimum ledger sequence stored in the Transactions table.
ripple::RelationalDatabase::CountMinMax
Definition: RelationalDatabase.h:51
ripple::base_uint< 256 >
ripple::SQLiteDatabase::getKBUsedAll
virtual uint32_t getKBUsedAll()=0
getKBUsedAll Returns the amount of space used by all databases.
ripple::SQLiteDatabase::closeTransactionDB
virtual void closeTransactionDB()=0
Closes the transaction database.
ripple::SQLiteDatabase::getTransactionCount
virtual std::size_t getTransactionCount()=0
getTransactionCount Returns the number of transactions.
ripple::SQLiteDatabase::deleteAccountTransactionsBeforeLedgerSeq
virtual void deleteAccountTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq)=0
deleteAccountTransactionsBeforeLedgerSeq Deletes all account transactions with a sequence number less...
ripple::SQLiteDatabase::getAccountTransactionCount
virtual std::size_t getAccountTransactionCount()=0
getAccountTransactionCount Returns the number of account transactions.
ripple::SQLiteDatabase::getKBUsedTransaction
virtual uint32_t getKBUsedTransaction()=0
getKBUsedTransaction Returns the amount of space used by the transaction database.
ripple::SQLiteDatabase::deleteTransactionByLedgerSeq
virtual void deleteTransactionByLedgerSeq(LedgerIndex ledgerSeq)=0
deleteTransactionByLedgerSeq Deletes transactions from the ledger with the given sequence.
ripple::ValStatus::current
@ current
This was a new validation and was added.
std::uint32_t
ripple::SQLiteDatabase::getLimitedOldestLedgerInfo
virtual std::optional< LedgerInfo > getLimitedOldestLedgerInfo(LedgerIndex ledgerFirstIndex)=0
getLimitedOldestLedgerInfo Returns the info of the oldest ledger whose sequence number is greater tha...
ripple::range
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
Definition: RangeSet.h:53
ripple::SQLiteDatabase::getOldestAccountTxsB
virtual MetaTxsList getOldestAccountTxsB(AccountTxOptions const &options)=0
getOldestAccountTxsB Returns the oldest transactions in binary form for the account that matches the ...
ripple::SQLiteDatabase::getTransaction
virtual std::variant< AccountTx, TxSearched > getTransaction(uint256 const &id, std::optional< ClosedInterval< uint32_t >> const &range, error_code_i &ec)=0
getTransaction Returns the transaction with the given hash.
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::SQLiteDatabase::oldestAccountTxPage
virtual std::pair< AccountTxs, std::optional< AccountTxMarker > > oldestAccountTxPage(AccountTxPageOptions const &options)=0
oldestAccountTxPage Returns the oldest transactions for the account that matches the given criteria s...
ripple::SQLiteDatabase::deleteTransactionsBeforeLedgerSeq
virtual void deleteTransactionsBeforeLedgerSeq(LedgerIndex ledgerSeq)=0
deleteTransactionsBeforeLedgerSeq Deletes all transactions with a sequence number less than or equal ...
ripple::SQLiteDatabase::deleteBeforeLedgerSeq
virtual void deleteBeforeLedgerSeq(LedgerIndex ledgerSeq)=0
deleteBeforeLedgerSeq Deletes all ledgers with a sequence number less than or equal to the given ledg...
ripple::SQLiteDatabase::getOldestAccountTxs
virtual AccountTxs getOldestAccountTxs(AccountTxOptions const &options)=0
getOldestAccountTxs Returns the oldest transactions for the account that matches the given criteria s...
std::optional
std::size_t
ripple::SQLiteDatabase::getKBUsedLedger
virtual uint32_t getKBUsedLedger()=0
getKBUsedLedger Returns the amount of space space used by the ledger database.
ripple::SQLiteDatabase::getLedgerCountMinMax
virtual struct CountMinMax getLedgerCountMinMax()=0
getLedgerCountMinMax Returns the minimum ledger sequence, maximum ledger sequence and total number of...
ripple::ClosedInterval
boost::icl::closed_interval< T > ClosedInterval
A closed interval over the domain T.
Definition: RangeSet.h:44
ripple::RelationalDatabase
Definition: RelationalDatabase.h:48
ripple::SQLiteDatabase::getNewestAccountTxsB
virtual MetaTxsList getNewestAccountTxsB(AccountTxOptions const &options)=0
getNewestAccountTxsB Returns the newest transactions in binary form for the account that matches the ...
ripple::RelationalDatabase::AccountTxPageOptions
Definition: RelationalDatabase.h:74
ripple::SQLiteDatabase::closeLedgerDB
virtual void closeLedgerDB()=0
Closes the ledger database.
std::variant