rippled
Loading...
Searching...
No Matches
OrderBookDB.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_ORDERBOOKDB_H_INCLUDED
21#define RIPPLE_APP_LEDGER_ORDERBOOKDB_H_INCLUDED
22
23#include <xrpld/app/ledger/AcceptedLedgerTx.h>
24#include <xrpld/app/ledger/BookListeners.h>
25#include <xrpld/app/main/Application.h>
26#include <xrpl/protocol/MultiApiJson.h>
27
28#include <mutex>
29
30namespace ripple {
31
33{
34public:
35 explicit OrderBookDB(Application& app);
36
37 void
39 void
41
42 void
43 addOrderBook(Book const&);
44
49
52 int
53 getBookSize(Issue const&);
54
55 bool
56 isBookToXRP(Issue const&);
57
59 getBookListeners(Book const&);
61 makeBookListeners(Book const&);
62
63 // see if this txn effects any orderbook
64 void
67 const AcceptedLedgerTx& alTx,
68 MultiApiJson const& jvObj);
69
70private:
72
73 // Maps order books by "issue in" to "issue out":
75
76 // does an order book to XRP exist
78
80
82
84
86
88};
89
90} // namespace ripple
91
92#endif
A generic endpoint for log messages.
Definition: Journal.h:59
A transaction that is in a closed ledger.
Specifies an order book.
Definition: Book.h:34
A currency issued by an account.
Definition: Issue.h:36
BookListeners::pointer getBookListeners(Book const &)
void addOrderBook(Book const &)
bool isBookToXRP(Issue const &)
BookListeners::pointer makeBookListeners(Book const &)
std::atomic< std::uint32_t > seq_
Definition: OrderBookDB.h:85
void processTxn(std::shared_ptr< ReadView const > const &ledger, const AcceptedLedgerTx &alTx, MultiApiJson const &jvObj)
std::vector< Book > getBooksByTakerPays(Issue const &)
void update(std::shared_ptr< ReadView const > const &ledger)
Definition: OrderBookDB.cpp:76
int getBookSize(Issue const &)
std::recursive_mutex mLock
Definition: OrderBookDB.h:79
beast::Journal const j_
Definition: OrderBookDB.h:87
BookToListenersMap mListeners
Definition: OrderBookDB.h:83
hash_set< Issue > xrpBooks_
Definition: OrderBookDB.h:77
hardened_hash_map< Issue, hardened_hash_set< Issue > > allBooks_
Definition: OrderBookDB.h:74
void setup(std::shared_ptr< ReadView const > const &ledger)
Definition: OrderBookDB.cpp:38
Application & app_
Definition: OrderBookDB.h:71
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26