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 
48  fetch(uint256 const&, error_code_i& ec);
49 
59  boost::variant<Transaction::pointer, bool>
60  fetch(
61  uint256 const&,
63  error_code_i& ec);
64 
66  fetch(
67  std::shared_ptr<SHAMapItem> const& item,
69  std::uint32_t uCommitLedger);
70 
71  // return value: true = we had the transaction already
72  bool
73  inLedger(uint256 const& hash, std::uint32_t ledger);
74 
75  void
77 
78  void
79  sweep(void);
80 
82  getCache();
83 
84 private:
87 };
88 
89 } // namespace ripple
90 
91 #endif
ripple::Application
Definition: Application.h:97
std::shared_ptr< Transaction >
ripple::TaggedCache
Map/cache combination.
Definition: TaggedCache.h:52
ripple::TransactionMaster::sweep
void sweep(void)
Definition: TransactionMaster.cpp:145
ripple::TransactionMaster
Definition: TransactionMaster.h:36
ripple::TransactionMaster::fetch
std::shared_ptr< Transaction > fetch(uint256 const &, error_code_i &ec)
Definition: TransactionMaster.cpp:58
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:86
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:151
std::uint32_t
ripple::range
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
Definition: RangeSet.h:53
ripple::SHAMapAbstractNode::TNType
TNType
Definition: SHAMapTreeNode.h:125
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:132
ripple::TransactionMaster::mApp
Application & mApp
Definition: TransactionMaster.h:85
ripple::ClosedInterval
boost::icl::closed_interval< T > ClosedInterval
A closed interval over the domain T.
Definition: RangeSet.h:44