rippled
State.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_STATE_H_INCLUDED
21 #define RIPPLE_APP_RDB_STATE_H_INCLUDED
22 
23 #include <ripple/app/ledger/Ledger.h>
24 #include <ripple/app/misc/Manifest.h>
25 #include <ripple/core/Config.h>
26 #include <ripple/core/DatabaseCon.h>
27 #include <ripple/overlay/PeerReservationTable.h>
28 #include <ripple/peerfinder/impl/Store.h>
29 #include <boost/filesystem.hpp>
30 
31 namespace ripple {
32 
33 struct SavedState
34 {
38 };
39 
46 void
48  soci::session& session,
49  BasicConfig const& config,
50  std::string const& dbName);
51 
58 getCanDelete(soci::session& session);
59 
67 setCanDelete(soci::session& session, LedgerIndex canDelete);
68 
76 getSavedState(soci::session& session);
77 
85 void
86 setSavedState(soci::session& session, SavedState const& state);
87 
93 void
94 setLastRotated(soci::session& session, LedgerIndex seq);
95 
96 } // namespace ripple
97 
98 #endif
ripple::setCanDelete
LedgerIndex setCanDelete(soci::session &session, LedgerIndex canDelete)
setCanDelete Updates the ledger sequence which can be deleted.
Definition: State.cpp:91
std::string
STL class.
ripple::setSavedState
void setSavedState(soci::session &session, SavedState const &state)
setSavedState Saves the given state.
Definition: State.cpp:111
ripple::SavedState::writableDb
std::string writableDb
Definition: State.h:35
ripple::initStateDB
void initStateDB(soci::session &session, BasicConfig const &config, std::string const &dbName)
initStateDB Opens a session with the State database.
Definition: State.cpp:25
std::uint32_t
ripple::getSavedState
SavedState getSavedState(soci::session &session)
getSavedState Returns the saved state.
Definition: State.cpp:99
ripple::setLastRotated
void setLastRotated(soci::session &session, LedgerIndex seq)
setLastRotated Updates the last rotated ledger sequence.
Definition: State.cpp:123
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::SavedState::archiveDb
std::string archiveDb
Definition: State.h:36
ripple::getCanDelete
LedgerIndex getCanDelete(soci::session &session)
getCanDelete Returns the ledger sequence which can be deleted.
Definition: State.cpp:81
ripple::SavedState::lastRotated
LedgerIndex lastRotated
Definition: State.h:37
ripple::SavedState
Definition: State.h:33
ripple::BasicConfig
Holds unparsed configuration information.
Definition: BasicConfig.h:215