Files
rippled/include/xrpl/server/State.h
copilot-swe-agent[bot] 89a6bb495e Merge branch 'develop' into copilot/add-ctid-to-ledger-response
Resolve conflicts in LedgerToJson.cpp:
- Keep both includes: NetworkIDService.h (ours) and TokenHelpers.h (develop)
- Keep CTID block and use develop's ownerFunds check style (!= 0)

Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/949ea030-9a83-49a4-8684-33a1ee221a3d

Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
2026-04-02 17:06:03 +00:00

72 lines
2.0 KiB
C++

#pragma once
#include <xrpl/protocol/Protocol.h>
#include <xrpl/rdb/DatabaseCon.h>
#include <xrpl/server/Manifest.h>
#include <boost/filesystem.hpp>
namespace xrpl {
struct SavedState
{
std::string writableDb;
std::string archiveDb;
LedgerIndex lastRotated{};
};
/**
* @brief initStateDB Opens a session with the State database.
* @param session Provides a session with the database.
* @param config Path to the database and other opening parameters.
* @param dbName Name of the database.
*/
void
initStateDB(soci::session& session, BasicConfig const& config, std::string const& dbName);
/**
* @brief getCanDelete Returns the ledger sequence which can be deleted.
* @param session Session with the database.
* @return Ledger sequence.
*/
LedgerIndex
getCanDelete(soci::session& session);
/**
* @brief setCanDelete Updates the ledger sequence which can be deleted.
* @param session Session with the database.
* @param canDelete Ledger sequence to save.
* @return Previous value of the ledger sequence which can be deleted.
*/
LedgerIndex
setCanDelete(soci::session& session, LedgerIndex canDelete);
/**
* @brief getSavedState Returns the saved state.
* @param session Session with the database.
* @return The SavedState structure which contains the names of the writable
* database, the archive database and the last rotated ledger sequence.
*/
SavedState
getSavedState(soci::session& session);
/**
* @brief setSavedState Saves the given state.
* @param session Session with the database.
* @param state The SavedState structure which contains the names of the
* writable database, the archive database and the last rotated ledger
* sequence.
*/
void
setSavedState(soci::session& session, SavedState const& state);
/**
* @brief setLastRotated Updates the last rotated ledger sequence.
* @param session Session with the database.
* @param seq New value of the last rotated ledger sequence.
*/
void
setLastRotated(soci::session& session, LedgerIndex seq);
} // namespace xrpl