rippled
TransactionMaster.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 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_LEDGER_TRANSACTIONMASTER_H_INCLUDED
21 #define RIPPLE_APP_LEDGER_TRANSACTIONMASTER_H_INCLUDED
22 
23 #include <ripple/app/misc/Transaction.h>
24 #include <ripple/basics/RangeSet.h>
25 #include <ripple/protocol/ErrorCodes.h>
26 #include <ripple/shamap/SHAMapItem.h>
27 #include <ripple/shamap/SHAMapTreeNode.h>
28 
29 namespace ripple {
30 
31 class Application;
32 class STTx;
33 
34 // Tracks all transactions in memory
35 
37 {
38 public:
40  TransactionMaster(TransactionMaster const&) = delete;
42  operator=(TransactionMaster const&) = delete;
43 
45  fetch_from_cache(uint256 const&);
46 
49  TxSearched>
50  fetch(uint256 const&, error_code_i& ec);
51 
63  TxSearched>
64  fetch(
65  uint256 const&,
67  error_code_i& ec);
68 
70  fetch(
71  boost::intrusive_ptr<SHAMapItem> const& item,
72  SHAMapNodeType type,
73  std::uint32_t uCommitLedger);
74 
75  // return value: true = we had the transaction already
76  bool
77  inLedger(uint256 const& hash, std::uint32_t ledger);
78 
79  void
81 
82  void
83  sweep(void);
84 
86  getCache();
87 
88 private:
91 };
92 
93 } // namespace ripple
94 
95 #endif
ripple::Application
Definition: Application.h:115
std::shared_ptr< Transaction >
ripple::TaggedCache
Map/cache combination.
Definition: Application.h:64
ripple::TransactionMaster::sweep
void sweep(void)
Definition: TransactionMaster.cpp:156
ripple::TransactionMaster
Definition: TransactionMaster.h:36
std::pair
ripple::TxSearched
TxSearched
Definition: Transaction.h:57
ripple::SHAMapNodeType
SHAMapNodeType
Definition: SHAMapTreeNode.h:46
ripple::error_code_i
error_code_i
Definition: ErrorCodes.h:40
ripple::base_uint< 256 >
ripple::TransactionMaster::mCache
TaggedCache< uint256, Transaction > mCache
Definition: TransactionMaster.h:90
ripple::TransactionMaster::fetch_from_cache
std::shared_ptr< Transaction > fetch_from_cache(uint256 const &)
Definition: TransactionMaster.cpp:52
ripple::TransactionMaster::TransactionMaster
TransactionMaster(Application &app)
Definition: TransactionMaster.cpp:28
ripple::TransactionMaster::getCache
TaggedCache< uint256, Transaction > & getCache()
Definition: TransactionMaster.cpp:162
std::uint32_t
ripple::range
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
Definition: RangeSet.h:53
ripple::TransactionMaster::inLedger
bool inLedger(uint256 const &hash, std::uint32_t ledger)
Definition: TransactionMaster.cpp:40
ripple::TransactionMaster::operator=
TransactionMaster & operator=(TransactionMaster const &)=delete
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::TransactionMaster::canonicalize
void canonicalize(std::shared_ptr< Transaction > *pTransaction)
Definition: TransactionMaster.cpp:143
ripple::TransactionMaster::fetch
std::variant< std::pair< std::shared_ptr< Transaction >, std::shared_ptr< TxMeta > >, TxSearched > fetch(uint256 const &, error_code_i &ec)
Definition: TransactionMaster.cpp:60
ripple::TransactionMaster::mApp
Application & mApp
Definition: TransactionMaster.h:89
ripple::ClosedInterval
boost::icl::closed_interval< T > ClosedInterval
A closed interval over the domain T.
Definition: RangeSet.h:44
std::variant