partial refactor of CassandraBackend

This commit is contained in:
CJ Cobb
2021-03-02 16:19:14 -05:00
parent 8691cff8df
commit 308c585801
15 changed files with 490 additions and 1247 deletions

View File

@@ -26,10 +26,7 @@
// }
boost::json::object
doTx(
boost::json::object const& request,
BackendInterface const& backend,
std::shared_ptr<PgPool>& postgres)
doTx(boost::json::object const& request, BackendInterface const& backend)
{
boost::json::object response;
if (!request.contains("transaction"))
@@ -44,7 +41,7 @@ doTx(
return response;
}
auto range = getLedgerRange(postgres);
auto range = backend.fetchLedgerRange();
if (!range)
{
response["error"] = "Database is empty";
@@ -55,8 +52,8 @@ doTx(
if (!dbResponse)
{
response["error"] = "Transaction not found in Cassandra";
response["ledger_range"] = std::to_string(range->lower()) + " - " +
std::to_string(range->upper());
response["ledger_range"] = std::to_string(range->minSequence) + " - " +
std::to_string(range->maxSequence);
return response;
}