rippled
app/rdb/backend/detail/Shard.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_DETAIL_SHARD_H_INCLUDED
21 #define RIPPLE_APP_RDB_BACKEND_DETAIL_SHARD_H_INCLUDED
22 
23 #include <ripple/app/ledger/Ledger.h>
24 #include <ripple/app/rdb/RelationalDatabase.h>
25 #include <ripple/app/rdb/UnitaryShard.h>
26 #include <ripple/core/Config.h>
27 #include <ripple/protocol/RippleLedgerHash.h>
28 #include <boost/filesystem.hpp>
29 
30 namespace ripple {
31 namespace detail {
32 
43 DatabasePair
45  Config const& config,
46  DatabaseCon::Setup const& setup,
47  DatabaseCon::CheckpointerSetup const& checkpointerSetup);
48 
59 bool
61  std::shared_ptr<Ledger const> const& ledger,
62  Application& app,
63  soci::session& lgrMetaSession,
64  soci::session& txnMetaSession,
65  std::uint32_t shardIndex);
66 
75 getShardIndexforLedger(soci::session& session, LedgerHash const& hash);
76 
85 getShardIndexforTransaction(soci::session& session, TxID const& id);
86 
87 } // namespace detail
88 } // namespace ripple
89 
90 #endif
ripple::detail::getShardIndexforTransaction
std::optional< std::uint32_t > getShardIndexforTransaction(soci::session &session, TxID const &id)
getShardIndexforTransaction Queries the transaction meta database to retrieve the index of the shard ...
Definition: app/rdb/backend/detail/impl/Shard.cpp:131
ripple::LedgerHash
uint256 LedgerHash
Definition: RippleLedgerHash.h:27
ripple::TxID
uint256 TxID
A transaction identifier.
Definition: Protocol.h:96
std::shared_ptr
STL class.
ripple::detail::saveLedgerMeta
bool saveLedgerMeta(std::shared_ptr< Ledger const > const &ledger, Application &app, soci::session &lgrMetaSession, soci::session &txnMetaSession, std::uint32_t const shardIndex)
saveLedgerMeta Stores (transaction ID -> shard index) and (ledger hash -> shard index) mappings in th...
Definition: app/rdb/backend/detail/impl/Shard.cpp:56
ripple::detail::makeMetaDBs
DatabasePair makeMetaDBs(Config const &config, DatabaseCon::Setup const &setup, DatabaseCon::CheckpointerSetup const &checkpointerSetup)
makeMetaDBs Opens ledger and transaction 'meta' databases which map ledger hashes and transaction IDs...
Definition: app/rdb/backend/detail/impl/Shard.cpp:32
std::uint32_t
ripple::detail::getShardIndexforLedger
std::optional< std::uint32_t > getShardIndexforLedger(soci::session &session, LedgerHash const &hash)
getShardIndexforLedger Queries the ledger meta database to retrieve the index of the shard that conta...
Definition: app/rdb/backend/detail/impl/Shard.cpp:117
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
std::optional< std::uint32_t >