rippled
UnitaryShard.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2021 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_UNITARYSHARD_H_INCLUDED
21 #define RIPPLE_APP_RDB_UNITARYSHARD_H_INCLUDED
22 
23 #include <ripple/app/ledger/Ledger.h>
24 #include <ripple/app/rdb/RelationalDatabase.h>
25 #include <ripple/core/Config.h>
26 #include <ripple/protocol/RippleLedgerHash.h>
27 #include <boost/filesystem.hpp>
28 
29 namespace ripple {
30 
32 {
35 };
36 
47  Config const& config,
48  DatabaseCon::Setup const& setup);
49 
61  Config const& config,
62  DatabaseCon::Setup const& setup,
63  DatabaseCon::CheckpointerSetup const& checkpointerSetup);
64 
75 bool
77  soci::session& txdb,
78  soci::session& lgrdb,
79  std::shared_ptr<Ledger const> const& ledger,
80  std::uint32_t index,
81  std::atomic<bool>& stop,
82  beast::Journal j);
83 
93  DatabaseCon::Setup const& setup,
94  DatabaseCon::CheckpointerSetup const& checkpointerSetup);
95 
102 void
103 insertAcquireDBIndex(soci::session& session, std::uint32_t index);
104 
115 selectAcquireDBLedgerSeqs(soci::session& session, std::uint32_t index);
116 
118 {
121 };
122 
135 selectAcquireDBLedgerSeqsHash(soci::session& session, std::uint32_t index);
136 
145 void
147  soci::session& session,
148  std::shared_ptr<Ledger const> const& ledger,
149  std::uint32_t index,
150  std::uint32_t lastSeq,
151  std::optional<std::string> const& seqs);
152 
153 } // namespace ripple
154 
155 #endif
ripple::makeAcquireDB
std::unique_ptr< DatabaseCon > makeAcquireDB(DatabaseCon::Setup const &setup, DatabaseCon::CheckpointerSetup const &checkpointerSetup)
makeAcquireDB Opens the shard acquire database and returns its descriptor.
Definition: UnitaryShard.cpp:208
ripple::DatabasePair::transactionDb
std::unique_ptr< DatabaseCon > transactionDb
Definition: UnitaryShard.h:34
std::shared_ptr
STL class.
ripple::DatabaseCon::Setup
Definition: DatabaseCon.h:84
std::pair
ripple::selectAcquireDBLedgerSeqsHash
std::pair< bool, AcquireShardSeqsHash > selectAcquireDBLedgerSeqsHash(soci::session &session, std::uint32_t index)
selectAcquireDBLedgerSeqsHash Returns the set of acquired ledger sequences and the last ledger hash f...
Definition: UnitaryShard.cpp:256
ripple::insertAcquireDBIndex
void insertAcquireDBIndex(soci::session &session, std::uint32_t index)
insertAcquireDBIndex Adds a new shard index to the shard acquire database.
Definition: UnitaryShard.cpp:221
ripple::DatabasePair::ledgerDb
std::unique_ptr< DatabaseCon > ledgerDb
Definition: UnitaryShard.h:33
ripple::DatabaseCon::CheckpointerSetup
Definition: DatabaseCon.h:107
ripple::updateAcquireDB
void updateAcquireDB(soci::session &session, std::shared_ptr< Ledger const > const &ledger, std::uint32_t index, std::uint32_t lastSeq, std::optional< std::string > const &seqs)
updateAcquireDB Updates information in the acquire DB.
Definition: UnitaryShard.cpp:287
ripple::Config
Definition: Config.h:89
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint32_t
std::atomic< bool >
ripple::DatabasePair
Definition: UnitaryShard.h:31
ripple::updateLedgerDBs
bool updateLedgerDBs(soci::session &txsession, soci::session &lgrsession, std::shared_ptr< Ledger const > const &ledger, std::uint32_t index, std::atomic< bool > &stop, beast::Journal j)
updateLedgerDBs Saves the given ledger to shard databases.
Definition: UnitaryShard.cpp:71
ripple::AcquireShardSeqsHash
Definition: UnitaryShard.h:117
ripple::AcquireShardSeqsHash::hash
std::optional< std::string > hash
Definition: UnitaryShard.h:120
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::makeShardIncompleteLedgerDBs
DatabasePair makeShardIncompleteLedgerDBs(Config const &config, DatabaseCon::Setup const &setup, DatabaseCon::CheckpointerSetup const &checkpointerSetup)
makeShardIncompleteLedgerDBs Opens shard databases for partially downloaded or unverified shards and ...
Definition: UnitaryShard.cpp:48
std::optional< std::string >
ripple::selectAcquireDBLedgerSeqs
std::pair< bool, std::optional< std::string > > selectAcquireDBLedgerSeqs(soci::session &session, std::uint32_t index)
selectAcquireDBLedgerSeqs Returns the set of acquired ledgers for the given shard.
Definition: UnitaryShard.cpp:229
std::unique_ptr
STL class.
ripple::AcquireShardSeqsHash::sequences
std::optional< std::string > sequences
Definition: UnitaryShard.h:119
ripple::makeShardCompleteLedgerDBs
DatabasePair makeShardCompleteLedgerDBs(Config const &config, DatabaseCon::Setup const &setup)
makeShardCompleteLedgerDBs Opens shard databases for verified shards and returns their descriptors.
Definition: UnitaryShard.cpp:28