Add state data cache and successor table. Remove keys table

* Adds a cache for the most recently validated ledger state
* Replaces the keys table with successor table
* Adds support for ledger diffs in the database
* Removes BackendIndexer
This commit is contained in:
CJ Cobb
2021-11-19 16:10:50 -05:00
parent e930ff04df
commit c7e31aff56
35 changed files with 2801 additions and 1241 deletions

View File

@@ -6,7 +6,7 @@ namespace RPC {
std::optional<Context>
make_WsContext(
boost::json::object const& request,
std::shared_ptr<BackendInterface> const& backend,
std::shared_ptr<BackendInterface const> const& backend,
std::shared_ptr<SubscriptionManager> const& subscriptions,
std::shared_ptr<ETLLoadBalancer> const& balancer,
std::shared_ptr<WsBase> const& session,
@@ -24,7 +24,7 @@ make_WsContext(
std::optional<Context>
make_HttpContext(
boost::json::object const& request,
std::shared_ptr<BackendInterface> const& backend,
std::shared_ptr<BackendInterface const> const& backend,
std::shared_ptr<SubscriptionManager> const& subscriptions,
std::shared_ptr<ETLLoadBalancer> const& balancer,
Backend::LedgerRange const& range)

View File

@@ -29,7 +29,7 @@ struct Context
std::string method;
std::uint32_t version;
boost::json::object const& params;
std::shared_ptr<BackendInterface> const& backend;
std::shared_ptr<BackendInterface const> const& backend;
std::shared_ptr<ETLLoadBalancer> const& balancer;
// this needs to be an actual shared_ptr, not a reference. The above
// references refer to shared_ptr members of WsBase, but WsBase contains
@@ -42,7 +42,7 @@ struct Context
std::string const& command_,
std::uint32_t version_,
boost::json::object const& params_,
std::shared_ptr<BackendInterface> const& backend_,
std::shared_ptr<BackendInterface const> const& backend_,
std::shared_ptr<SubscriptionManager> const& subscriptions_,
std::shared_ptr<ETLLoadBalancer> const& balancer_,
std::shared_ptr<WsBase> const& session_,
@@ -129,7 +129,7 @@ make_error(Error err);
std::optional<Context>
make_WsContext(
boost::json::object const& request,
std::shared_ptr<BackendInterface> const& backend,
std::shared_ptr<BackendInterface const> const& backend,
std::shared_ptr<SubscriptionManager> const& subscriptions,
std::shared_ptr<ETLLoadBalancer> const& balancer,
std::shared_ptr<WsBase> const& session,
@@ -138,7 +138,7 @@ make_WsContext(
std::optional<Context>
make_HttpContext(
boost::json::object const& request,
std::shared_ptr<BackendInterface> const& backend,
std::shared_ptr<BackendInterface const> const& backend,
std::shared_ptr<SubscriptionManager> const& subscriptions,
std::shared_ptr<ETLLoadBalancer> const& balancer,
Backend::LedgerRange const& range);

View File

@@ -61,12 +61,12 @@ doAccountObjects(Context const& context)
}
ripple::uint256 cursor;
if (request.contains("cursor"))
if (request.contains("marker"))
{
if (!request.at("cursor").is_string())
return Status{Error::rpcINVALID_PARAMS, "cursorNotString"};
if (!request.at("marker").is_string())
return Status{Error::rpcINVALID_PARAMS, "markerNotString"};
if (!cursor.parseHex(request.at("cursor").as_string().c_str()))
if (!cursor.parseHex(request.at("marker").as_string().c_str()))
return Status{Error::rpcINVALID_PARAMS, "malformedCursor"};
}

View File

@@ -208,7 +208,7 @@ unsubscribeToAccountsProposed(
std::variant<Status, std::pair<std::vector<ripple::Book>, boost::json::array>>
validateAndGetBooks(
boost::json::object const& request,
std::shared_ptr<Backend::BackendInterface> const& backend)
std::shared_ptr<Backend::BackendInterface const> const& backend)
{
if (!request.at("books").is_array())
return Status{Error::rpcINVALID_PARAMS, "booksNotArray"};