mirror of
https://github.com/Xahau/xahaud.git
synced 2026-01-18 13:45:16 +00:00
Compare commits
1 Commits
memory-tes
...
mongo-db
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74ce9743a7 |
@@ -145,6 +145,7 @@ target_link_libraries (xrpl_core
|
||||
OpenSSL::Crypto
|
||||
Ripple::boost
|
||||
NIH::WasmEdge
|
||||
NIH::MongoCxx
|
||||
Ripple::syslibs
|
||||
NIH::secp256k1
|
||||
NIH::ed25519-donna
|
||||
@@ -726,7 +727,6 @@ if (tests)
|
||||
src/test/app/LedgerReplay_test.cpp
|
||||
src/test/app/LoadFeeTrack_test.cpp
|
||||
src/test/app/Manifest_test.cpp
|
||||
src/test/app/Memory_test.cpp
|
||||
src/test/app/MultiSign_test.cpp
|
||||
src/test/app/NetworkID_test.cpp
|
||||
src/test/app/NFToken_test.cpp
|
||||
|
||||
100
Builds/CMake/deps/Mongo.cmake
Normal file
100
Builds/CMake/deps/Mongo.cmake
Normal file
@@ -0,0 +1,100 @@
|
||||
#[===================================================================[
|
||||
NIH dep: mongo: MongoDB C++ driver (bsoncxx and mongocxx).
|
||||
#]===================================================================]
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(
|
||||
mongo_c_driver_src
|
||||
GIT_REPOSITORY https://github.com/mongodb/mongo-c-driver.git
|
||||
GIT_TAG 1.17.4
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(mongo_c_driver_src)
|
||||
if(NOT mongo_c_driver_src_POPULATED)
|
||||
message(STATUS "Pausing to download MongoDB C driver...")
|
||||
FetchContent_Populate(mongo_c_driver_src)
|
||||
endif()
|
||||
|
||||
set(MONGO_C_DRIVER_BUILD_DIR "${mongo_c_driver_src_BINARY_DIR}")
|
||||
set(MONGO_C_DRIVER_INCLUDE_DIR "${mongo_c_driver_src_SOURCE_DIR}/src/libbson/src")
|
||||
set(MONGO_C_DRIVER_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/mongo_c_install")
|
||||
|
||||
set(MONGO_C_DRIVER_CMAKE_ARGS
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF
|
||||
-DENABLE_STATIC=ON
|
||||
-DENABLE_SHARED=OFF
|
||||
-DCMAKE_INSTALL_PREFIX=${MONGO_C_DRIVER_INSTALL_PREFIX}
|
||||
)
|
||||
|
||||
ExternalProject_Add(mongo_c_driver
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mongo_c
|
||||
SOURCE_DIR ${mongo_c_driver_src_SOURCE_DIR}
|
||||
CMAKE_ARGS ${MONGO_C_DRIVER_CMAKE_ARGS}
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} --install .
|
||||
)
|
||||
|
||||
FetchContent_Declare(
|
||||
mongo_cxx_driver_src
|
||||
GIT_REPOSITORY https://github.com/mongodb/mongo-cxx-driver.git
|
||||
GIT_TAG r3.10.2
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(mongo_cxx_driver_src)
|
||||
if(NOT mongo_cxx_driver_src_POPULATED)
|
||||
message(STATUS "Pausing to download MongoDB C++ driver...")
|
||||
FetchContent_Populate(mongo_cxx_driver_src)
|
||||
endif()
|
||||
|
||||
set(MONGO_CXX_DRIVER_BUILD_DIR "${mongo_cxx_driver_src_BINARY_DIR}")
|
||||
set(MONGO_CXX_DRIVER_INCLUDE_DIR "${mongo_cxx_driver_src_SOURCE_DIR}/include")
|
||||
set(MONGO_CXX_DRIVER_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/mongo_cxx_install")
|
||||
|
||||
set(MONGO_CXX_DRIVER_CMAKE_ARGS
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DBUILD_SHARED_AND_STATIC_LIBS=ON
|
||||
-DBSONCXX_ENABLE_MONGOC=ON
|
||||
-DCMAKE_INSTALL_PREFIX=${MONGO_CXX_DRIVER_INSTALL_PREFIX}
|
||||
-DCMAKE_PREFIX_PATH=${MONGO_C_DRIVER_INSTALL_PREFIX}
|
||||
)
|
||||
|
||||
ExternalProject_Add(mongo_cxx_driver
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mongo_cxx
|
||||
SOURCE_DIR ${mongo_cxx_driver_src_SOURCE_DIR}
|
||||
CMAKE_ARGS ${MONGO_CXX_DRIVER_CMAKE_ARGS}
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} --install .
|
||||
DEPENDS mongo_c_driver
|
||||
)
|
||||
|
||||
add_library(bsoncxx STATIC IMPORTED GLOBAL)
|
||||
add_library(mongocxx STATIC IMPORTED GLOBAL)
|
||||
add_dependencies(bsoncxx mongo_cxx_driver)
|
||||
add_dependencies(mongocxx mongo_cxx_driver)
|
||||
|
||||
ExternalProject_Get_Property(mongo_cxx_driver BINARY_DIR)
|
||||
execute_process(
|
||||
COMMAND
|
||||
mkdir -p "${BINARY_DIR}/include/bsoncxx/v_noabi"
|
||||
mkdir -p "${BINARY_DIR}/include/mongocxx/v_noabi"
|
||||
)
|
||||
|
||||
set_target_properties(bsoncxx PROPERTIES
|
||||
IMPORTED_LOCATION "${MONGO_CXX_DRIVER_INSTALL_PREFIX}/lib/libbsoncxx-static.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${MONGO_CXX_DRIVER_INSTALL_PREFIX}/include/bsoncxx/v_noabi"
|
||||
)
|
||||
|
||||
set_target_properties(mongocxx PROPERTIES
|
||||
IMPORTED_LOCATION "${MONGO_CXX_DRIVER_INSTALL_PREFIX}/lib/libmongocxx-static.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${MONGO_CXX_DRIVER_INSTALL_PREFIX}/include/mongocxx/v_noabi"
|
||||
)
|
||||
|
||||
# Link the C driver libraries
|
||||
find_library(BSON_LIB bson-1.0 PATHS ${MONGO_C_DRIVER_INSTALL_PREFIX}/lib)
|
||||
find_library(MONGOC_LIB mongoc-1.0 PATHS ${MONGO_C_DRIVER_INSTALL_PREFIX}/lib)
|
||||
|
||||
target_link_libraries(ripple_libs INTERFACE bsoncxx mongocxx ${BSON_LIB} ${MONGOC_LIB})
|
||||
|
||||
add_library(NIH::MongoCxx ALIAS mongocxx)
|
||||
@@ -75,6 +75,7 @@ include(deps/gRPC)
|
||||
include(deps/cassandra)
|
||||
include(deps/Postgres)
|
||||
include(deps/WasmEdge)
|
||||
include(deps/Mongo)
|
||||
|
||||
###
|
||||
|
||||
|
||||
@@ -733,7 +733,7 @@ private:
|
||||
|
||||
RCLConsensus mConsensus;
|
||||
|
||||
ConsensusPhase mLastConsensusPhase = ConsensusPhase::unknown;
|
||||
ConsensusPhase mLastConsensusPhase;
|
||||
|
||||
LedgerMaster& m_ledgerMaster;
|
||||
|
||||
|
||||
@@ -101,9 +101,6 @@ to_string(ConsensusMode m)
|
||||
consensus will internally go back to open (see Consensus::handleWrongLedger).
|
||||
*/
|
||||
enum class ConsensusPhase {
|
||||
//! We dont know the ConsensusPhase
|
||||
unknown,
|
||||
|
||||
//! We haven't closed our ledger yet, but others might have
|
||||
open,
|
||||
|
||||
|
||||
@@ -182,7 +182,6 @@ Value::Value(ValueType type) : type_(type), allocated_(0)
|
||||
switch (type)
|
||||
{
|
||||
case nullValue:
|
||||
value_.map_ = nullptr;
|
||||
break;
|
||||
|
||||
case intValue:
|
||||
|
||||
@@ -201,30 +201,24 @@ Door<Handler>::Detector::do_detect(boost::asio::yield_context do_yield)
|
||||
buf.data(),
|
||||
std::move(stream_)))
|
||||
sp->run();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (auto sp = ios().template emplace<PlainHTTPPeer<Handler>>(
|
||||
port_,
|
||||
handler_,
|
||||
ioc_,
|
||||
j_,
|
||||
remote_address_,
|
||||
buf.data(),
|
||||
std::move(stream_)))
|
||||
sp->run();
|
||||
}
|
||||
if (auto sp = ios().template emplace<PlainHTTPPeer<Handler>>(
|
||||
port_,
|
||||
handler_,
|
||||
ioc_,
|
||||
j_,
|
||||
remote_address_,
|
||||
buf.data(),
|
||||
std::move(stream_)))
|
||||
sp->run();
|
||||
return;
|
||||
}
|
||||
else
|
||||
if (ec != boost::asio::error::operation_aborted)
|
||||
{
|
||||
if (ec != boost::asio::error::operation_aborted)
|
||||
{
|
||||
JLOG(j_.trace()) << "Error detecting ssl: " << ec.message() << " from "
|
||||
<< remote_address_;
|
||||
}
|
||||
JLOG(j_.trace()) << "Error detecting ssl: " << ec.message() << " from "
|
||||
<< remote_address_;
|
||||
}
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2023 XRPL-Labs
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <test/jtx.h>
|
||||
|
||||
namespace ripple {
|
||||
namespace test {
|
||||
|
||||
class Memory_test : public beast::unit_test::suite
|
||||
{
|
||||
void
|
||||
testPayment(FeatureBitset features)
|
||||
{
|
||||
testcase("payment");
|
||||
|
||||
using namespace test::jtx;
|
||||
using namespace std::literals;
|
||||
|
||||
Env env{*this, envconfig(), features};
|
||||
|
||||
auto const account = Account("alice");
|
||||
env.fund(XRP(1000), account);
|
||||
env.close();
|
||||
}
|
||||
|
||||
void
|
||||
testHook(FeatureBitset features)
|
||||
{
|
||||
testcase("hook");
|
||||
|
||||
using namespace test::jtx;
|
||||
using namespace std::literals;
|
||||
|
||||
Env env{*this, envconfig(), features};
|
||||
|
||||
auto const account = Account("alice");
|
||||
auto const dest = Account("bob");
|
||||
env.fund(XRP(10000), account, dest);
|
||||
env.close();
|
||||
|
||||
env(genesis::setAcceptHook(account), fee(XRP(2)));
|
||||
env.close();
|
||||
|
||||
env(genesis::setAcceptHook(dest), fee(XRP(2)));
|
||||
env.close();
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
env(pay(account, dest, XRP(2)), fee(XRP(1)));
|
||||
env.close();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
testWithFeats(FeatureBitset features)
|
||||
{
|
||||
// testPayment(features);
|
||||
testHook(features);
|
||||
}
|
||||
|
||||
public:
|
||||
void
|
||||
run() override
|
||||
{
|
||||
using namespace test::jtx;
|
||||
auto const sa = supported_amendments();
|
||||
testWithFeats(sa);
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(Memory, app, ripple);
|
||||
|
||||
} // namespace test
|
||||
} // namespace ripple
|
||||
Reference in New Issue
Block a user